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
| constructor(private bpObserable: BreakpointObserver) { } | |
| ngOnInit(): void { | |
| let result = this.bpObserable.isMatched('(orientation: portrait)')); | |
| } |
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 memoizeAny = (func) => { | |
| // Use this variable memoizedKeyValues to save results | |
| // Identify each result with it's input. | |
| // If the memoized function is called with the same input, use the existing value. | |
| let memoizedKeyValues = [ | |
| /* { | |
| args: stringified_input_parameters | |
| result: result | |
| }*/ |
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
| console.log("--- Web Worker Ready! ---"); | |
| let state | |
| onmessage = (event) => { | |
| state = event.data; | |
| iterateAndPrint(); // once data is received, invoke the function to print | |
| }; | |
| // print data in global variable. Iteratively call same function every second. | |
| const iterateAndPrint = () => { |
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
| // Create Worker | |
| var work1 = new Worker('workerFile.js'); | |
| // Create SharedArrayBuffer | |
| var sab = new SharedArrayBuffer(4); | |
| var ia = new Int32Array(sab); | |
| // set value | |
| ia[0] = 10; |
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 work1 = new Worker('workerFile.js'); | |
| var msg = {"key1": "sample value"}; | |
| work1.postMessage(msg); |
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 func = (p1, | |
| p2, | |
| ) => `parameter1: ${p1}. parameter2: ${p2}`; |
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 processData = async () => { | |
| let data = await getData(); | |
| return { "ticks": data.key || 0 }; | |
| } |
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
| async function processData() { | |
| // getData() function returns a promise. | |
| let data = await getData(); | |
| return { "ticks": data.key || 0 }; | |
| } |