- In
tsconfig.json, set"target"to"es6". - Add
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],in theNgModuledecorator of the Angular Module where your components will live. - Use Angular CLI to generate a component.
- Refactor generated Component's import statement, decorator, constructor, and add a render function as seen in the example below.
- Refactor the import statement of the Component in the parent Module from
import { HelloWorldComponent } from './hello-world/hello-world.component'toimport './hello-world/hello-world.component'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TEST_ID=$(uuid) | |
| echo "Running 100 with Test ID of $TEST_ID" | |
| mkdir $TEST_ID | |
| cd $TEST_ID | |
| dat share & | |
| sleep 5 | |
| for i in {1..100} | |
| do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sleep = (milliseconds) => new Promise((res) => setTimeout(() => res(true), milliseconds)) | |
| const fillUpWithRevisions = async (numberOfDocs = 100, numberOfRevisionsPerDoc = 10, templateDoc, compactCompare = true, autoCompact = false, destroy = true) => { | |
| let initialEstimate = await navigator.storage.estimate() | |
| let dbName = `test-${new Date().getTime()}` | |
| let db = new PouchDB(dbName, {auto_compaction: autoCompact}) | |
| delete templateDoc._rev | |
| let docNumber = 0 | |
| let revisionNumber = 0 | |
| while (numberOfDocs > docNumber) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var numberOfDocs = 1000 | |
| var userName = 'RJ' | |
| var templateDoc = { | |
| yourDocHere: true | |
| } | |
| var fillUp = async (numberOfDocs, templateDoc, dbName) => { | |
| let initialEstimate = await navigator.storage.estimate() | |
| let db = new PouchDB(dbName) | |
| delete templateDoc._rev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fillUp = async (numberOfDocs, templateDoc, destroy = true) => { | |
| let initialEstimate = await navigator.storage.estimate() | |
| let dbName = `test-${new Date().getTime()}` | |
| let db = new PouchDB(dbName) | |
| delete templateDoc._rev | |
| let i = 0 | |
| while (numberOfDocs > i) { | |
| let doc = Object.assign({}, templateDoc, { _id: `${i}` }) | |
| await db.put(doc) | |
| i++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (inputs.location.value[3]) { | |
| let selectedLocationNode = Loc | |
| .flatten(inputs.location.locationList) | |
| .find(node => node.id === inputs.location.value[3]) | |
| if (selectedLocationNode.label === 'Other') { | |
| // Do something. | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var items = [ | |
| { name: 'Edward', value: 21 }, | |
| { name: 'Sharpe', value: 37 }, | |
| { name: 'And', value: 45 }, | |
| { name: 'The', value: -12 }, | |
| { name: 'Magnetic', value: 13 }, | |
| { name: 'Zeros', value: 37 } | |
| ] | |
| // sort by value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createStore } from 'redux-dat' | |
| import reducer from './reducer.js' | |
| const myActions = new DatArchive() | |
| const store = createStore(myActions, reducer) | |
| store.addPeer('...') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function a() { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| console.log('a') | |
| resolve() | |
| }, 1000) | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [...document.querySelectorAll('div')].map(el => console.log(el)) |