Skip to content

Instantly share code, notes, and snippets.

@odoe
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odoe/df387a13305b01207958 to your computer and use it in GitHub Desktop.
Save odoe/df387a13305b01207958 to your computer and use it in GitHub Desktop.
// 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