Skip to content

Instantly share code, notes, and snippets.

@HenryVonfire
Last active May 25, 2016 15:08
Show Gist options
  • Save HenryVonfire/19d736235d3e704c6981 to your computer and use it in GitHub Desktop.
Save HenryVonfire/19d736235d3e704c6981 to your computer and use it in GitHub Desktop.
Mouse events
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Component.extend({
notification:[],
mouseEnter(){
this.get('notification').pushObject('mouse have entered in the building');
},
mouseLeave(){
this.get('notification').pushObject('mouse have left the building');
},
click(){
this.get('notification').pushObject('mouse have clicked on me, yey!');
},
mouseDown(){
this.get('notification').pushObject('mouse is pushing me!');
},
mouseUp(){
this.get('notification').pushObject('mouse has realeased me!');
},
mouseMove(e){
//use e.screenX, e.screenY
this.get('notification').pushObject('what a swing!');
}
});
<p>this is the content of the component</p>
<br><br>
Notifiactions:<br>
{{#each notification as |message|}}
{{message}}<br>
{{/each}}
{
"version": "0.4.13",
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.10/ember.debug.js",
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.13/ember-data.js",
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.10/ember-template-compiler.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment