-
-
Save feanor07/8d07323f73592ab2cfc8d2ee78718f81 to your computer and use it in GitHub Desktop.
ember run loop trial
This file contains hidden or 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({ | |
didReceiveAttrs(){ | |
console.log('didReceiveAttrs'); | |
}, | |
willRender(){ | |
console.log('willRender'); | |
}, | |
didRender(){ | |
console.log('didRender'); | |
alert(this.get('x')); | |
} | |
}); |
This file contains hidden or 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({ | |
x:0, | |
init(){ | |
Ember.run.later(this, this.test, 500); | |
}, | |
test(){ | |
let that = this; | |
Ember.run.next(this, function(){ | |
console.log('in next 1', that.incrementProperty('x')); | |
/* dom'u gerçekten güncelledikten sonra run.next çalışıyor. */ | |
}); | |
Ember.run(function(){ | |
console.log('run 1:', that.incrementProperty('x')); | |
Ember.run.schedule('render', function(){ | |
console.log('in render 1:', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('afterRender', function(){ | |
console.log('in afterRender 1', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('afterRender', function(){ | |
console.log('in afterRender 2', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('routerTransitions', function(){ | |
console.log('in routerTransitions 1', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('sync', function(){ | |
console.log('in sync 1:', that.incrementProperty('x')); | |
Ember.run(function(){ | |
console.log('run 1.2:', that.incrementProperty('x')); | |
Ember.run.schedule('sync', function(){ | |
console.log('in sync 1.2:', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('actions', function(){ | |
console.log('in actions 1.2:', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('render', function(){ | |
console.log('in render 1.2:', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('afterRender', function(){ | |
console.log('in afterRender 1.2:', that.incrementProperty('x')); | |
}); | |
}); | |
}); | |
}); | |
Ember.run(function(){ | |
console.log('run 2', that.incrementProperty('x')); | |
Ember.run.schedule('sync', function(){ | |
console.log('in sync 2.2:', that.incrementProperty('x')); | |
}); | |
Ember.run.schedule('render', function(){ | |
console.log('in render 2.2:', that.incrementProperty('x')); | |
}); | |
}); | |
} | |
}); |
This file contains hidden or 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 function destroyApp(application) { | |
Ember.run(application, 'destroy'); | |
} |
This file contains hidden or 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 Resolver from '../../resolver'; | |
import config from '../../config/environment'; | |
const resolver = Resolver.create(); | |
resolver.namespace = { | |
modulePrefix: config.modulePrefix, | |
podModulePrefix: config.podModulePrefix | |
}; | |
export default resolver; |
This file contains hidden or 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 Application from '../../app'; | |
import config from '../../config/environment'; | |
const { run } = Ember; | |
const assign = Ember.assign || Ember.merge; | |
export default function startApp(attrs) { | |
let application; | |
let attributes = assign({rootElement: "#test-root"}, config.APP); | |
attributes = assign(attributes, attrs); // use defaults, but you can override; | |
run(() => { | |
application = Application.create(attributes); | |
application.setupForTesting(); | |
application.injectTestHelpers(); | |
}); | |
return application; | |
} |
This file contains hidden or 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 resolver from './helpers/resolver'; | |
import { | |
setResolver | |
} from 'ember-qunit'; | |
setResolver(resolver); |
This file contains hidden or 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.13.0", | |
"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.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment