Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6854] iOS "load" event when the engine ends parsing the JavaScript code

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2016-08-22T20:45:26.000+0000
Affected Version/sRelease 1.7.5, Release 1.8.0.1
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterKarol Pomaski
AssigneeIngo Muschenetz
Created2011-12-22T15:35:21.000+0000
Updated2017-03-22T21:39:02.000+0000

Description

Feature Request

Feature request for the "load" event which will tell us when the JavaScript parser has finished. This is available in other JavaScript engines, example: http://www.w3schools.com/js/js_events.asp . It should be the equivalent to the "load" event on webpage.

Comments

  1. Ivan Skugor 2011-12-23

    That event is meaningful in browser environment, but in my opinion has no sense in Titanium environment, since "app.js" is entrance point so application is loaded when "app.js" starts to execute. On the other hand, "Ti.include" and "require" are blocking operations. That means that JS code execution is blocked until included file is loaded and parsed and therefore there is no need to wait for "load" event.
  2. Stephen Tramer 2011-12-27

    There is a use case where 3rd party modules or other scripts may need to hook into a "load" event for other JS files.
  3. Chris Barber 2016-08-22

    I'm not sure if this ticket refers to exposing an event from the Titanium JavaScript environment or from the native Titanium module API. Since it references the "load" event in the context of web pages, I assume it means having a "load" event from the Titanium JavaScript environment. As Ivan suggested, there is no point in having a "load" event since the app.js is executed right away. There is no DOM like a web page that takes time to load external scripts. Ti.include() has been deprecated, no need for a "load" event for that. require() is blocking and when it returns, that's when you know the module has been loaded. If you need an event to be emitted, then you will have to wrap require() and emit your own event. Perhaps in a future Titanium release we will have a module loader similar to Node.js where you can register/change module extension handlers and such. If this ticket was meant to be about exposing a native API, then I ask we open another ticket specifically for that and include a valid use case.
  4. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source