Prototypes with ember-cli
1 answer
You have several options.
-
Add the file to the directory
vendor/
with your extensions and include it in yoursBrocfile.js
like so:app.import('vendor/my-prototype-extensions.js');
-
Do this in the initializer.
ember g initializer extensions
Then
app/initializers/extension.js
add your extensions like so:export var initialize = function() { Array.prototype.move = function (old_index, new_index) { .... }; } export default { name: 'extensions', initialize: initialize }
I personally prefer the initializer approach, as is done in the ember-cli ecosystem, so you have access to whatever is available there if you need it.
+5
source to share