Last active
June 16, 2017 06:15
-
-
Save cbou/1b948596e573e99e492e476bdcd096f5 to your computer and use it in GitHub Desktop.
Performance
This file contains 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.Component.extend({ | |
}); |
This file contains 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.Component.extend({ | |
}); |
This file contains 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.Component.extend({ | |
}); |
This file contains 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.Component.extend({ | |
actions: { | |
click: function() { | |
}, | |
doubleClick: function() { | |
}, | |
mouseDown: function() { | |
}, | |
nothing: function() { | |
}, | |
simulate: function() {}, | |
duplicate: function() {}, | |
toggleEditingName: function() {}, | |
delete: function() {}, | |
} | |
}); |
This file contains 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.Component.extend({ | |
willRender: function() { | |
this.set('start', new Date().getTime()); | |
}, | |
didRender: function() { | |
console.log('list ' + (new Date().getTime() - this.get('start')) + 'ms'); | |
} | |
}); |
This file contains 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.Component.extend({ | |
}); |
This file contains 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'; | |
import FactoryGuy from 'ember-data-factory-guy'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
items: Ember.A(), | |
generateData: Ember.on('init', function() { | |
FactoryGuy.define('my-model', { | |
// Put default 'user' attributes in the default section | |
default: { | |
firstName: FactoryGuy.generate((num)=> `firstName #${num}`), | |
lastName: FactoryGuy.generate((num)=> `lastName #${num}`), | |
age: FactoryGuy.generate((num)=> num), | |
city: FactoryGuy.generate((num)=> `City #${num}`), | |
} | |
}); | |
for (var i = 0; i < 500; i++) { | |
this.get('items').pushObject(FactoryGuy.make('my-model')); | |
} | |
}) | |
}); |
This file contains 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 function disableBubbling([action]) { | |
return function(event) { | |
event.stopPropagation(); | |
return action(event); | |
}; | |
} | |
export default Ember.Helper.helper(disableBubbling); |
This file contains 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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
firstName: attr('string'), | |
lastName: attr('string'), | |
age: attr('number'), | |
city: attr('string'), | |
fullName: Ember.computed('firstName', 'lastName', function() { | |
return this.get('firstName') + ' ' + this.get('lastName'); | |
}), | |
quickActions: Ember.computed(function() { | |
return [ | |
Ember.Object.extend({ | |
label: 'edit', | |
link: Ember.computed('city', function() { | |
return 'http://example.com/' + this.get('city'); | |
}.bind(this)) | |
}).create(), | |
{ | |
label: 'view', | |
action: "simulate" | |
}, | |
{ | |
label: 'duplicate', | |
action: "duplicate" | |
}, | |
{ | |
label: 'rename', | |
action: "toggleEditingName" | |
}, | |
{ | |
label: 'delete', | |
action: "delete" | |
} | |
]; | |
}) | |
}); |
This file contains 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.12.1", | |
"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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1", | |
"ember-data-factory-guy": "*", | |
"ember-truth-helpers": "*", | |
"ember-collection": "*" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment