source: Dev/trunk/src/client/dojox/mvc/_DataBindingExtension.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 860 bytes
Line 
1define([
2        "dojo/_base/array",
3        "dojo/aspect",
4        "dojo/_base/lang",
5        "dijit/_WidgetBase",
6        "./_DataBindingMixin"
7], function(array, aspect, lang, WidgetBase, DataBindingMixin){
8
9        //Apply the data binding mixin to all dijits, see mixin class description for details
10        lang.extend(WidgetBase, /*===== {} || =====*/ new DataBindingMixin());
11
12        // monkey patch dijit/_WidgetBase.startup to get data binds set up
13        aspect.before(WidgetBase.prototype, "startup", function(){
14                this._dbstartup();
15        });
16
17        // monkey patch dijit/_WidgetBase.destroy to remove watches setup in _DataBindingMixin
18        aspect.before(WidgetBase.prototype, "destroy", function(){
19                if(this._modelWatchHandles){
20                        array.forEach(this._modelWatchHandles, function(h){ h.unwatch(); });
21                }
22                if(this._viewWatchHandles){
23                        array.forEach(this._viewWatchHandles, function(h){ h.unwatch(); });
24                }
25        });
26});
Note: See TracBrowser for help on using the repository browser.