Skip to content

Instantly share code, notes, and snippets.

@ianbale
Last active October 22, 2015 01:38
Show Gist options
  • Save ianbale/c9c3e6c5a9908bd2c438 to your computer and use it in GitHub Desktop.
Save ianbale/c9c3e6c5a9908bd2c438 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
data : [],
scrollTimer : null,
init : function()
{
var data = this.get("data");
for (var x=0;x<1000;x++)
{
var obj = {id:x,label:"o".repeat(10) + "_" + x,vis:false};
data.push(obj);
obj = null;
}
Ember.run.later(this,this.make_visible,0,5000);
},
make_visible : function(idx)
{
var data = this.get("data");
Ember.set(data[idx++],"vis",true);
if (idx < data.length)
{
Ember.run.later(this,this.make_visible,idx,50);
}
},
});
{{#each data as |item index|}}
{{data-item item=item}}
{{/each}}
import Ember from 'ember';
export default Ember.Component.extend({
itemComponent : function()
{
var item = this.get("item");
return item.vis ? "item-visible" : "item-hidden";
}.property("item.vis"),
});
{{component itemComponent item=item}}
{
"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