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 {from} from 'rxjs/internal/observable/from'; | |
| import {bufferCount, count, filter} from 'rxjs/operators'; | |
| const source = 'acbqibekboabkdnopenmenuckofqamdqlvopenmenuasdqweascqwekasdcnaskdeqweqwcasdopenmenu'; | |
| const sequence$ = from(source); | |
| const matchSequence = 'openmenu'; | |
| sequence$ | |
| .pipe( | |
| bufferCount(matchSequence.length, 1), |
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 {fromEvent} from 'rxjs/internal/observable/fromEvent'; | |
| import {interval} from 'rxjs/internal/observable/interval'; | |
| import {buffer, filter, map} from 'rxjs/operators'; | |
| let stream$ = fromEvent(document.getElementById('hit-me') as HTMLElement, 'click'); | |
| stream$ | |
| .pipe( | |
| buffer(interval(3000)), | |
| map((val: number[]) => val.length), |
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 {fromEvent} from 'rxjs/internal/observable/fromEvent'; | |
| import {buffer, map} from 'rxjs/operators'; | |
| import {interval} from 'rxjs/internal/observable/interval'; | |
| let stream$ = fromEvent(document.getElementById('hit-me'), 'click'); | |
| stream$ | |
| .pipe( | |
| buffer(interval(3000)), | |
| map((val) => val.length) | |
| ) |
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 {fromEvent} from 'rxjs/internal/observable/fromEvent'; | |
| const source$ = fromEvent(document.getElementById('hit-me'), 'click'); | |
| source$.subscribe((event: Event) => { | |
| const currentClicked = ( event.currentTarget.getAttribute('number-of-clicked') ) ? event.currentTarget.getAttribute('number-of-clicked') : 1; | |
| event.currentTarget.setAttribute('number-of-clicked', parseInt(currentClicked) + 1); | |
| console.log(parseInt(currentClicked)) | |
| }); |
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 subject = new ReplaySubject(1 /* buffer size */); |
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 {ReplaySubject} from 'rxjs/internal/ReplaySubject'; | |
| const subject = new ReplaySubject(2 /* buffer size */); | |
| subject.next('a'); | |
| subject.next('b'); | |
| subject.next('c'); | |
| const subscription = subject.subscribe((x: string) => { | |
| console.log(`Next: ${x}`); |
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
| /* Initialize with initial value of 42 */ | |
| import {BehaviorSubject} from 'rxjs/internal/BehaviorSubject'; | |
| const subject = new BehaviorSubject(42); | |
| const subscription = subject.subscribe((x: number) => { | |
| console.log(`Next: ${String(x)}`); | |
| }, (error: Error) => { | |
| console.log(`Error: ${error}`); | |
| }, () => { |
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 {AsyncSubject} from 'rxjs/internal/AsyncSubject'; | |
| let subject = new AsyncSubject; | |
| let i = 0; | |
| const handle = setInterval(() => { | |
| subject.next(i); | |
| if (++i > 3) { | |
| subject.complete(); | |
| clearInterval(handle); |
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
| functions: | |
| hello: | |
| handler: handler.hello | |
| events: | |
| - http: | |
| path: hello | |
| method: get |
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
| { | |
| "compilerOptions": { | |
| "module": "commonjs", | |
| "target": "es6", | |
| "lib": [ "es6", "dom" ], | |
| "moduleResolution": "node", | |
| "rootDir": "./", | |
| "sourceMap": true, | |
| "allowJs": true, | |
| "noImplicitAny": true, |