Mercurial > pub > ImplabJs
comparison src/djol/_ToolBase.js @ 34:27e8e9e38e07 default tip
Слияние
| author | nickolay |
|---|---|
| date | Wed, 05 Jun 2019 20:44:15 +0300 |
| parents | 8af8e840dd49 1dc2fd263b90 |
| children |
comparison
equal
deleted
inserted
replaced
| 33:8af8e840dd49 | 34:27e8e9e38e07 |
|---|---|
| 1 define([ | |
| 2 "dojo/_base/declare", | |
| 3 "dojo/when", | |
| 4 "implab/safe", | |
| 5 "implab/guard", | |
| 6 "implab/components/_ActivatableMixin", | |
| 7 "implab/log/_LogMixin", | |
| 8 "dojo/Evented", | |
| 9 "./ToolType" ], | |
| 10 | |
| 11 function(declare, when, safe, guard, _ActivatableMixin, _LogMixin, Evented, ToolType) { | |
| 12 return declare([ _ActivatableMixin, Evented ], { | |
| 13 toolType : ToolType.Activatable, | |
| 14 | |
| 15 module : null, | |
| 16 | |
| 17 constructor : function(opts) { | |
| 18 if (opts) { | |
| 19 if (opts.controller) | |
| 20 this.setController(opts.controller); | |
| 21 } | |
| 22 }, | |
| 23 | |
| 24 onActivating : function() { | |
| 25 var me = this, inherited = this.getInherited(arguments); | |
| 26 if (me.module && !me.module.isActive()) | |
| 27 return me.module.activate().then(function(active) { | |
| 28 return active ? inherited.apply(me) : false; | |
| 29 }); | |
| 30 else | |
| 31 return inherited.apply(me); | |
| 32 }, | |
| 33 | |
| 34 onActivated : function() { | |
| 35 this.emit("active", true); | |
| 36 }, | |
| 37 | |
| 38 onDeactivated : function() { | |
| 39 this.emit("active", false); | |
| 40 }, | |
| 41 | |
| 42 destroy : function() { | |
| 43 | |
| 44 } | |
| 45 }); | |
| 46 }); |
