-
-
Save KoKuToru/8e5eb0abb3029e287d7ef15814652c66 to your computer and use it in GitHub Desktop.
New Twiddle
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'; | |
var cache = Ember.A(); | |
var waitForNext = false; | |
function scheduleNextComponent(comp) { | |
if (comp) { | |
cache.addObject(comp); | |
} | |
if (!waitForNext) { | |
waitForNext = true; | |
Ember.run.next(displayNextComponent); | |
} | |
} | |
function displayNextComponent() { | |
Ember.run.schedule('afterRender', function() { | |
var comp = cache[0]; | |
if (comp) { | |
cache.removeAt(0); | |
comp.set('displayBlock', true); | |
} | |
waitForNext = false; | |
if (cache.length > 0) { | |
scheduleNextComponent(); | |
} | |
}); | |
} | |
export default Ember.Component.extend({ | |
tagName: '', | |
displayBlock: false, | |
didInsertElement() { | |
scheduleNextComponent(this); | |
}, | |
willDestroyElement() { | |
if (!this.get('displayBlock')) { | |
cache.removeObject(this); | |
} | |
} | |
}); |
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.Controller.extend({ | |
appName: 'Ember Twiddle', | |
test: Ember.computed('w', 'h',function() { | |
var r = []; | |
let {w, h} = this.getProperties('w','h'); | |
for (var x = 0; x < h; ++x) { | |
var t = []; | |
for (var y = 0; y < w; ++y) { | |
t.push(x+'_'+y); | |
} | |
r.push(t); | |
} | |
return r; | |
}), | |
actions: { | |
update() { | |
this.setProperties({ | |
w: 30, | |
h: 100 | |
}); | |
} | |
} | |
}); |
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.10.4", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "canary", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "canary" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment