import * as Utils from '../utils/_index' ; import * as Options from '../options/_index' ; export class BaseFactory implements Utils . IFactory { protected key : string ; protected factoryMgr : Utils . FactoryManager ; protected eventMgr : Utils . EventManager ; private enabled : Boolean = true ; init ( key , eventMgr , factoryMgr ) { this . key = key ; this . eventMgr = eventMgr ; this . factoryMgr = factoryMgr ; this . eventMgr . on ( 'create.' + this . key , this . create . bind ( this ) ) ; this . eventMgr . on ( 'update.' + this . key , this . update . bind ( this ) ) ; this . eventMgr . on ( 'destroy.' + this . key , this . destroy . bind ( this ) ) ; } on ( ) { this . enabled = true ; } off ( ) { this . enabled = false ; } isOn ( ) { return this . enabled === true ; } isOff ( ) { return this . enabled === false ; } create ( options ) { } update ( data , options ) { } destroy ( ) { } }