import { AsyncEventEmitter , Events } from "./asyncEventEmitter" ; type TaskEvents = Events & { completed : ( ) => Promise < void > ; uncompleted : ( ) => Promise < void > ; } ; export class Task extends AsyncEventEmitter < TaskEvents > { complete : boolean = false ; ID : number ; constructor ( ID ) { super ( ) ; this . ID = ID ; } private SetCompleteStatus ( status ) { } Complete ( ) { this . emit ( "completed" ) ; this . SetCompleteStatus ( true ) ; } Uncomplete ( ) { if ( this . complete === true ) { this . emit ( "uncompleted" ) ; this . complete = false ; } else { this . complete = false ; } } }