This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ILiteEvent<T> { | |
on(handler: { (data?: T): void }) : void; | |
off(handler: { (data?: T): void }) : void; | |
} | |
class LiteEvent<T> implements ILiteEvent<T> { | |
private handlers: { (data?: T): void; }[] = []; | |
public on(handler: { (data?: T): void }) : void { | |
this.handlers.push(handler); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {OnInit, Type} from '@angular/core'; | |
/** | |
* Decorator with params for Angular components. | |
* InterfaceName is name of interface that declare required fields, which component should have. | |
* How to use: | |
* ` | |
@DecoratorName(params) | |
@Component({ | |
selector: 'app-example', |