Last active
January 26, 2017 05:56
-
-
Save nathanhammond/927e2fb56cbabb1b66693389321c2dbc to your computer and use it in GitHub Desktop.
New Twiddle
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 Ember from 'ember'; | |
let i = 0; | |
export default Ember.Controller.extend({ | |
foo: function(event) { | |
console.log(++i, this, event); | |
}, | |
actions: { | |
thing: function(event) { | |
// 1. You've passed off the function without the invocation context. | |
Ember.run(this.foo); | |
// 2. this works. | |
Ember.run(() => { this.foo(event) }); | |
// 3. this works, it is a two step create + invoke thing. | |
// Use this when you want to pass the function out of Ember. | |
var result = Ember.run.bind(this, this.foo); | |
result(event); | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
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
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment