Skip to content

Instantly share code, notes, and snippets.

@foxnewsnetwork
Created February 23, 2017 23:04
Show Gist options
  • Save foxnewsnetwork/71ed4b5c973e0c2249b80dd421e99acd to your computer and use it in GitHub Desktop.
Save foxnewsnetwork/71ed4b5c973e0c2249b80dd421e99acd to your computer and use it in GitHub Desktop.
How to get ember-life working in your 1.x.x ember app

What?

Are you using setInterval, setTimeout, or Ember.run in your components?

If the answer is "yes", you probably should look into using https://www.npmjs.com/package/ember-lifeline instead

Why?

The read the long answer on the addon repo itself, but the TL;DR is using ember-lifeline plays better with component life-cycles and avoids your queues never flushing

What's the problem

You can't use it if you're in 1.x.x... even though you probably need the most. This is because the import statements expect ember-metal which isn't a thing in the earlier versions

app.import('vendor/shims/ember-metal.js');
app.import('vendor/shims/ember-runloop.js');
(function() {
'use strict';
function vendorMixinModule() {
return {
'default': self['Ember'].Mixin
};
}
function vendorUtilsModule() {
var assert = self['Ember'].assert;
return {
'assert': assert,
'default': { assert: assert }
};
}
define('ember-metal/mixin', [], vendorMixinModule);
define('ember-metal/utils', [], vendorUtilsModule);
})();
(function() {
function vendorModule() {
'use strict';
return { 'default': self['Ember'].run };
}
define('ember-runloop', [], vendorModule);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment