Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const log = (function() {
- return function(msg: string) {
- return function(v: any) {
- console.log(msg, " => ",v);
- };
- }
- })();
- export const subscriber = (f:any) => function(end: number): any {
- let i = 0;
- const obj: any = {
- next: function(v: any) {
- log('Subscription value')(v);
- if(f) f();
- i++ === end ? this.unsubscribe() : null;
- },
- error: log('Subscription Error'),
- complete: function(){if(f) f();log('completed')(this)}
- }
- return obj;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement