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 { AsyncStorage } from 'react-native'; | |
| const storeKey = (dbName, storeName, key) => dbName + '_' + storeName + '_' + key; | |
| const stringify = JSON.stringify; | |
| const parse = JSON.parse; | |
| export const RNAsyncStorageAdapter = { | |
| get(dbName, storeName, key) { | |
| return AsyncStorage.getItem(storeKey(dbName, storeName, key)).then(value => parse(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 { Component, OnInit, OnDestroy, HostBinding } from '@angular/core'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import 'rxjs/add/observable/timer'; | |
| import 'rxjs/add/observable/merge'; | |
| import 'rxjs/add/operator/takeWhile'; | |
| import 'rxjs/add/operator/mapTo'; | |
| @Component({ | |
| selector: 'blink', | |
| template: `<ng-content></ng-content>` |
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 { Operator } from '../Operator'; | |
| import { Subscriber } from '../Subscriber'; | |
| import { Observable } from '../Observable'; | |
| /** | |
| * Emits gas on the output Observable every time the source | |
| * Observable emits a value. | |
| * | |
| * <span class="informal">Like {@link map}, but it maps every source value to | |
| * the same predefined output value every time.</span> |
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 { Component, OnInit, ElementRef, OnDestroy, Renderer } from '@angular/core'; | |
| import { Observable } from 'rxjs/Observable'; | |
| import 'rxjs/add/observable/timer'; | |
| import 'rxjs/add/observable/merge'; | |
| import 'rxjs/add/operator/takeWhile'; | |
| import 'rxjs/add/operator/mapTo'; | |
| @Component({ | |
| selector: 'blink', | |
| template: `<ng-content></ng-content>` |
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({ | |
| selector: 'blink', | |
| template: `<ng-content></ng-content>` | |
| }) | |
| export class BlinkComponent implements OnInit { | |
| private element: Element; | |
| private blinker$: Observable<string>; | |
| constructor(private renderer: Renderer, elementRef: ElementRef) { | |
| this.element = elementRef.nativeElement; |
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({ | |
| selector: 'blink', | |
| template: `<ng-content></ng-content>` | |
| }) | |
| export class BlinkComponent implements OnInit { | |
| private element: Element; | |
| constructor(private renderer: Renderer, elementRef: ElementRef) { | |
| this.element = elementRef.nativeElement; | |
| } |
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 show$ = Observable.timer(0, 1000); | |
| const hide$ = Observable.timer(750, 1000); | |
| const blinker$ = Observable.merge( | |
| show$.mapTo('visible'), | |
| hide$.mapTo('hidden') | |
| ); | |
| blinker$.subscribe(value => element.style['visibility'] = 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
| const show$ = Observable.timer(0, 1000); | |
| const hide$ = Observable.timer(750, 1000); | |
| const blinker$ = Observable.merge( | |
| show$.mapTo('showing'), | |
| hide$.mapTo('hiding') | |
| ); | |
| blinker$.subscribe(value => { | |
| // Let's assume the "element" variable holds a reference to the |
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 show$ = Observable.timer(0, 1000); | |
| const hide$ = Observable.timer(750, 1000); | |
| const blinker$ = Observable.merge( | |
| show$.mapTo('showing'), | |
| hide$.mapTo('hiding') | |
| ); | |
| blinker$.subscribe(value => console.log(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
| const show$ = Observable.timer(0, 1000); | |
| const hide$ = Observable.timer(750, 1000); | |
| const blinker$ = Observable.merge( | |
| show$, | |
| hide$ | |
| ); | |
| blinker$.subscribe(value => console.log(value)); |
NewerOlder