Last active
August 29, 2015 14:01
-
-
Save hojberg/fc856dc2c6d8dbab75b8 to your computer and use it in GitHub Desktop.
YUI to ES6 to YUI
This file contains hidden or 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
YUI.add('models:my_model', function (Y, NAME, __imports__, __exports__) { | |
"use strict"; | |
var MyOtherModel = __imports__['models/my_other_model']['default']; | |
var MyModel = Y.Base.create('models:myModel', | |
MyOtherModel | |
[], | |
{ | |
// .. some implementation | |
}, | |
{ | |
ATTRS: { | |
name: {} | |
} | |
}); | |
__exports['default'] = MyModel; | |
return __exports__; | |
}, | |
'@VERSION@', | |
{ | |
es: true, | |
requires: [ | |
'base' | |
'models/my_other_model' | |
] | |
}); |
This file contains hidden or 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
import 'base'; | |
import MyOtherModel from 'models/my_other_model'; | |
var MyModel = Y.Base.create('models:myModel', | |
MyOtherModel | |
[], | |
{ | |
// .. some implementation | |
}, | |
{ | |
ATTRS: { | |
name: {} | |
} | |
}); | |
export default MyModel; |
This file contains hidden or 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
YUI.add('models:my_model', function (Y) { | |
var MyModel = Y.Base.create('models:myModel', | |
Y.MyOtherModel | |
[], | |
{ | |
// .. some implementation | |
}, | |
{ | |
ATTRS: { | |
name: {} | |
} | |
}); | |
Y.MyModel = MyModel; | |
}, | |
'0.0.1', | |
{ | |
requires: [ | |
'base' | |
'models:my_other_model' | |
] | |
}); |
This file contains hidden or 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
YUI().require('models/my_model', function (Y, imports) { | |
var MyModel = imports['models/my_model'].default; | |
var myModel = new MyModel(); | |
// .... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment