Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 This file is part of the Juju GUI, which lets users view and manage Juju | 2 This file is part of the Juju GUI, which lets users view and manage Juju |
3 environments within a graphical interface (https://launchpad.net/juju-gui). | 3 environments within a graphical interface (https://launchpad.net/juju-gui). |
4 Copyright (C) 2012-2013 Canonical Ltd. | 4 Copyright (C) 2012-2013 Canonical Ltd. |
5 | 5 |
6 This program is free software: you can redistribute it and/or modify it under | 6 This program is free software: you can redistribute it and/or modify it under |
7 the terms of the GNU Affero General Public License version 3, as published by | 7 the terms of the GNU Affero General Public License version 3, as published by |
8 the Free Software Foundation. | 8 the Free Software Foundation. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, but WITHOUT | 10 This program is distributed in the hope that it will be useful, but WITHOUT |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 /** | 69 /** |
70 The rendered viewlet element | 70 The rendered viewlet element |
71 | 71 |
72 @property container | 72 @property container |
73 @type {Y.Node} | 73 @type {Y.Node} |
74 @default null | 74 @default null |
75 */ | 75 */ |
76 container: null, | 76 container: null, |
77 | 77 |
78 /** | 78 /** |
79 The list of events the viewlet has bound so we can clean up on destroy. | |
80 | |
81 @attribute events | |
82 @default [] | |
83 @type {Array} | |
84 | |
85 */ | |
86 events: [], | |
rharding
2013/09/11 14:24:17
Add support for viewlets to have events they bind
| |
87 | |
88 /** | |
79 Optional logical slot name for this viewlet to fill. | 89 Optional logical slot name for this viewlet to fill. |
80 | 90 |
81 @property slot | 91 @property slot |
82 @type {String} | 92 @type {String} |
83 @default null | 93 @default null |
84 */ | 94 */ |
85 slot: null, | 95 slot: null, |
86 | 96 |
87 /** | 97 /** |
88 When defined it allows the developer to specify another model to bind | 98 When defined it allows the developer to specify another model to bind |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 @default {noop function} | 147 @default {noop function} |
138 */ | 148 */ |
139 conflict: function(node) {}, | 149 conflict: function(node) {}, |
140 | 150 |
141 /** | 151 /** |
142 A destroy callback called when removing a viewlet for cleanup. | 152 A destroy callback called when removing a viewlet for cleanup. |
143 | 153 |
144 @method destroy | 154 @method destroy |
145 @return {undefined} nothing. | 155 @return {undefined} nothing. |
146 */ | 156 */ |
147 destroy: function() {}, | 157 destroy: function() { |
158 this.events.forEach(function(ev) { | |
159 ev.detach(); | |
160 }); | |
161 this.events = []; | |
162 }, | |
rharding
2013/09/11 14:24:17
and make the default destroy clean any of those up
| |
148 | 163 |
149 /** | 164 /** |
150 Called by the databinding engine when fields drop out of sync with | 165 Called by the databinding engine when fields drop out of sync with |
151 the supplied model. | 166 the supplied model. |
152 | 167 |
153 @method unsyncedFields | 168 @method unsyncedFields |
154 @param {Array} dirtyFields an array of keys representing changed fields. | 169 @param {Array} dirtyFields an array of keys representing changed fields. |
155 */ | 170 */ |
156 unsyncedFields: function(dirtyFields) {}, | 171 unsyncedFields: function(dirtyFields) {}, |
157 | 172 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 }); | 627 }); |
613 | 628 |
614 }, '', { | 629 }, '', { |
615 requires: [ | 630 requires: [ |
616 'juju-databinding', | 631 'juju-databinding', |
617 'view', | 632 'view', |
618 'node', | 633 'node', |
619 'base-build', | 634 'base-build', |
620 'handlebars' | 635 'handlebars' |
621 ]}); | 636 ]}); |
OLD | NEW |