Mercurial > pub > ImplabJs
comparison src/djol/_ToolBase.js @ 10:8705103f074f
Слияние
author | cin |
---|---|
date | Mon, 21 Aug 2017 18:03:00 +0300 |
parents | f0035923ff3e |
children |
comparison
equal
deleted
inserted
replaced
9:37e9e6bbe87a | 10:8705103f074f |
---|---|
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 }); |