@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
Singular | Plural | |
---|---|---|
Sync | Value | Iterable <Value> |
Async | Promise <Value> |
Observable <Value>
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
const myObserver = {
next: (value) => { console.log(value); },
error: (err) => { console.error(err); },
complete: () => { console.log('Complete!'); }
};
@N_Tepluhina
const myObservable = new Observable(observer => {
const datasource = new DataSource();
datasource.ondata = (e) => observer.next(e);
datasource.onerror = (err) => observer.error(err);
datasource.oncomplete = () => observer.complete();
return () => {
datasource.destroy();
};
});
@N_Tepluhina
@N_Tepluhina
const subscription =
myObservable.subscribe(myObserver);
subscription.unsubscribe();
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina
@N_Tepluhina