Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 519 Bytes

jquery-ember-run.md

File metadata and controls

18 lines (14 loc) · 519 Bytes

Don’t use jQuery without Ember Run Loop

Rule name: jquery-ember-run

Using plain jQuery invokes actions out of the Ember Run Loop. In order to have a control on all operations in Ember it's good practice to trigger actions in run loop.

/// GOOD
Ember.$('#something-rendered-by-jquery-plugin').on(
  'click',
  Ember.run.bind(this, this._handlerActionFromController)
);

// BAD
Ember.$('#something-rendered-by-jquery-plugin').on('click', () => {
  this._handlerActionFromController();
});