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
| emitValue(observer) { | |
| let i = 0; | |
| const id = setInterval(() => { | |
| observer.next(i++) | |
| }, 1000) | |
| return () => { clearInterval(id) } | |
| } | |
| createObservable(emitValueFn) { | |
| return { |
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 observable = Rx.Observable.interval(1000).take(5); | |
| const observerA = {...}; | |
| const observerB = {...}; | |
| const hybrid = { | |
| observers: [], | |
| subscribe: (obs) => { | |
| this.observers.push(obs); | |
| } | |
| next: (v) => { |
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 observable = Rx.Observable.interval(1000).take(5); | |
| const observerA = {...}; | |
| const observerB = {...}; | |
| const subject = new Rx.Subject(); | |
| observable.subscribe(subject); | |
| subject.subscribe(observerA); // first execution | |
| setTimeout(() => { |
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 connectableObservable = Rx.Observable | |
| .interval(1000) | |
| .take(5) | |
| .multicast(new Rx.Subject()); | |
| const observerA = {...}; | |
| const observerB = {...}; | |
| connectableObservable.connect(); | |
| connectableObservable.subscribe(observerA); // first execution |
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 observable = Rx.Observable | |
| .interval(1000) | |
| .take(5) | |
| .multicast(new Rx.Subject()) | |
| .refCount(); |
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
| @Component({ | |
| template: | |
| `<span>I am {{name}}</span> | |
| `, | |
| }) | |
| export class MyComponent { | |
| name = 'Angular'; | |
| } |
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
| // simplified component factory | |
| function View_MyComponent_0(l) { | |
| return jit_viewDef1(0, | |
| // view defenition nodes | |
| [ | |
| jit_elementDef2(0, null, null, 1, "span", ...), | |
| jit_textDef3(null, ["I am ", ...]) | |
| ] | |
| ); | |
| } |
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
| export interface ViewDefinition { | |
| ... | |
| } |
OlderNewer