1.0.0 • Published 6 years ago

ir-events v1.0.0

Weekly downloads
3
License
-
Repository
-
Last release
6 years ago

ir-events

Events for angular 6 like ionic events. This is based on angular4-events package

Usage

in app.component.ts :

import { IrEventsService } from 'ir-events';
import { Subscription } from 'rxjs';

@Component({...})
export class AppComponent implements OnInit, OnDestroy {
    evt: Subscription;
    
    constructor(public event: IrEventsService) {}
    
    ngOnInit() {
        this.evt = this.event.create('evtName').subscribe((data) => {
            // Your code here
        });
    }
    
    ngOnDestroy() {
        this.evt.unsubscribe();
    }
}

in another component use this code :

import { IrEventsService } from 'ir-events';

@Component({...})
export class Home {        
    constructor(public event: IrEventsService) {
        this.event.publish('evtName', data);
    }
}
1.0.0

6 years ago

0.0.1

6 years ago