1

I'm loading my whole application in parts, so somewhere at the beginning during this init process I create my app

window.Sp = Em.Application.create( {
    VERSION: '1.0.0',
    autoinit: false
}) ;

Then I start loading other things, like router settings. And when this is ready I called initialize

Sp.initialize() ;

This worked fine, until I donwloaded the most recent ember.js from https://github.com/emberjs/ember.js

It turned out that 'autoinit' as a configuration option is removed. Why? But more importantly what do I have to do if I want to call 'initialize' manually ?

I already found one way to hack around this, is to set isDestroyed to true, and just before calling initialize() set it to false :)

sly7_7
  • 11,961
  • 3
  • 40
  • 54
Jeanluca Scaljeri
  • 26,343
  • 56
  • 205
  • 333
  • 2
    I think the answer is here: https://github.com/emberjs/ember.js/blob/master/packages/ember-application/lib/system/application.js#L32, here for an example: https://github.com/emberjs/ember.js/blob/master/packages/ember-application/lib/system/application.js#L364 – sly7_7 Jan 07 '13 at 20:14
  • I just tried your solution, but calling Sp.deferReadiness() and later Sp.advanceReadiness() only seem to influence when Sp.ready is called, not the initialize, which is still immediately called :( Unfortunately there is no such thing as a deferInitialize function – Jeanluca Scaljeri Jan 08 '13 at 08:23
  • 2
    I think you don't have to call initialize() anymore. What I've seen by quicly reading the code, is that you call defereReadiness() after creating the app, do what you need before application initialize, and when you are ready, call advanceReadiness(). If it's not working, could you provide a little more context in your question, to see what you want to do before application is initialized ? – sly7_7 Jan 08 '13 at 09:13
  • just found a doable solution. First I create a fake application like: Sp = { Router: Ember.Router.extend() }. Then Everything initializes and finally I do: Sp = Ember.Application.create(Sp) ; Give me some time then I'll upload it to github! – Jeanluca Scaljeri Jan 09 '13 at 19:49
  • your solution is very weird from what I've seen since few month using ember. But yes, I will be pleased to take a look at your project :) – sly7_7 Jan 09 '13 at 19:55
  • I've just committed everything. The index.html file is located here: http://bit.ly/VRV4t1 – Jeanluca Scaljeri Jan 10 '13 at 19:48
  • Probably there is something going wrong with curl.js AMD loading... but here, I'm so sorry, I can't help you more :s, I don't know how all this is supposed to work :( – sly7_7 Jan 11 '13 at 00:02
  • the reason I use curl is I could easily load the template files, instead of defining them in the . – Jeanluca Scaljeri Jan 11 '13 at 07:32
  • I am not sure if something changed with the pre3 and pre4 releases, but I am using deferReadiness and advanceReadiness in my application and it is not calling initialize until I advance. I am also using AMD, require.js specifically. My application is designed quite a bit differently however. I load all my resources in bundles with AMD and then run advanceReadiness. – Sean Smith Jan 22 '13 at 01:35
  • Hey Jeanluca, I can't help much with ember, but I noticed your use of curl.js is pretty inefficient. You should consider taking each of the module lists and placing them into one or more "run" modules (aka "main" modules by RequireJS) and bundling them with cram.js. Also, if you can load these run modules in parallel (rather than use curl().then() or curl().next()), that would be even better. You can get more help with curl.js and cram.js over at https://groups.google.com/d/forum/cujojs :) – unscriptable Mar 06 '13 at 20:24

0 Answers0