KarlPurk/redux-decorators

View on GitHub
src/store.decorator/angular2.binding.ts

Summary

Maintainability
A
1 hr
Test Coverage
export function angular2Binding(target: any) {
    const existingNgOnInit = target.prototype.ngOnInit;
    const existingNgOnDestroy = target.prototype.ngOnDestroy;
    target.prototype.ngOnInit = function() {
        this.storeInit();
        !existingNgOnInit || existingNgOnInit.call(this);
    }
    target.prototype.ngOnDestroy = function() {
        this.storeDestroy();
        !existingNgOnDestroy || existingNgOnDestroy.call(this);
    }
    return target;
}