Last active
August 29, 2015 14:22
-
-
Save odoe/df387a13305b01207958 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// original AMD syntax | |
define([ | |
'dojo/_base/declare', | |
'dijit/_WidgetBase', | |
'dijit/_TemplatedMixin', | |
'dbind/bind', | |
'stores/LocatorStore', | |
'helpers/NumFormatter', | |
'dojo/text!./templates/LocatorView.html' | |
], function( | |
declare, | |
_WidgetBase, _TemplatedMixin, | |
bind, store, format, | |
template | |
) { | |
var fixed = format(3); | |
return declare([_WidgetBase, _TemplatedMixin], { | |
templateString: template, | |
postCreate: function() { | |
var xStore = bind(fixed).to(store, 'x'); | |
var yStore = bind(fixed).to(store, 'y'); | |
bind(this.yNode).to(yStore); | |
bind(this.xNode).to(xStore); | |
} | |
}); | |
}); | |
// ES6 syntax | |
import declare from 'dojo/_base/declare'; | |
import _WidgetBase from 'dijit/_WidgetBase'; | |
import _TemplatedMixin from 'dijit/_TemplatedMixin'; | |
import bind from 'dbind/bind'; | |
import store from 'stores/LocatorStore'; | |
import format from 'helpers/NumFormatter'; | |
import template from 'dojo/text!./templates/LocatorView.html'; | |
var fixed = format(3); | |
// export the module, not return it | |
export default declare([_WidgetBase, _TemplatedMixin], { | |
templateString: template, | |
postCreate() { // notice no function keyword | |
var xStore = bind(fixed).to(store, 'x'); | |
var yStore = bind(fixed).to(store, 'y'); | |
bind(this.yNode).to(yStore); | |
bind(this.xNode).to(xStore); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment