- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello i have a noob question if someone could help im sure its a quick answer. Im used to languages like VB and im trying to learn JS
If i want a script or a variable to run when a page/app loads/launches where would i put it?
thanks for the help i was having a hard time googling it specificly for intel xdk
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Zack,
To check if the app is loaded and ready - if you really want to understand when the best time is to make something happen.
For understanding what happens in what sequence, take a look at the Hello Cordova app. It has a function onDeviceReady that ensures that both the DOM and the webview is ready.
Go to the PROJECTS tab -> Start a new Project (bottom left) -> Samples and Demos -> Hello Cordova
Take a look at the comments in www/xdk/init-dev.js starting at line 147 to get an understanding of the order of event firing. Then if you have the index.html file open, there is a series of tabs to the left of the name "www/index.html". Click "Find" -> "Find in Files" -> type deviceReady . . . look at lines 32-34 for example . . . you will see that the compass info is not logged until the device is ready.
Of course you can put scripts inline in index.html, but that is not recommended for cordova apps. It makes debugging harder.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Zack,
To check if the app is loaded and ready - if you really want to understand when the best time is to make something happen.
For understanding what happens in what sequence, take a look at the Hello Cordova app. It has a function onDeviceReady that ensures that both the DOM and the webview is ready.
Go to the PROJECTS tab -> Start a new Project (bottom left) -> Samples and Demos -> Hello Cordova
Take a look at the comments in www/xdk/init-dev.js starting at line 147 to get an understanding of the order of event firing. Then if you have the index.html file open, there is a series of tabs to the left of the name "www/index.html". Click "Find" -> "Find in Files" -> type deviceReady . . . look at lines 32-34 for example . . . you will see that the compass info is not logged until the device is ready.
Of course you can put scripts inline in index.html, but that is not recommended for cordova apps. It makes debugging harder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks you for the info i will do this

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page