mirror of
https://github.com/amark/gun.git
synced 2026-03-22 16:13:47 +00:00
angular-demo: rewrite rx wrapper
Use latest API and ensure unsubscription will be done.
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { $rx } from 'gun-edge/edge/observable/rx';
|
||||
import Gun from 'gun/gun';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { GunDb } from 'app/gun.service';
|
||||
import { omit } from 'underscore';
|
||||
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { GunDb } from 'app/gun.service';
|
||||
import { rx$ } from 'app/gun.helper';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -16,7 +15,7 @@ export class AppComponent implements OnInit {
|
||||
newTodo = '';
|
||||
|
||||
todos = this.db.gun.get('todos');
|
||||
todos$: Observable<string[]> = $rx(this.todos)
|
||||
todos$: Observable<string[]> = rx$(this.todos)
|
||||
.map(o => omit(o, '_'));
|
||||
|
||||
constructor(private db: GunDb) { }
|
||||
|
||||
Reference in New Issue
Block a user