Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Helper.extend({
init() {
this._super(...arguments);
this.set('i', 0);
this.tick();
},
tick() {
this.incrementProperty('i');
this.recompute();
Ember.run.later(() => this.tick(), 1000);
},
compute() {
let { i } = this;
let fragment = document.createDocumentFragment();
let div1 = document.createElement('div');
let text1 = document.createTextNode(`div1.${i}!`);
div1.appendChild(text1);
fragment.appendChild(div1);
let div2 = document.createElement('div');
let text2 = document.createTextNode(`div2.${i}!`);
div2.appendChild(text2);
fragment.appendChild(div2);
return fragment;
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{fragment}}
<br>
<br>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.