Maps JS API on-load detection?
Experts,
I need to find a way in my application code to detect that the nokia JS map API code has been loaded into the browser. With other maps API such as google maps, I can attach a callback function to the end of the Script URL like:
[url]http://maps.google.com/maps/api/js?sensor=false&callback=myApp.finishLoadGoogleJs[/url]
where the function myApp.finishLoadGoogleJs() is part of my application code, but is invoked as soon as the google JS api library finishes loading, so my app can do some initialization based on this notification.
I urgently need to figure out a way to do the same with the Nokia JS URL:
[url]http://api.maps.nokia.com/2.2.0/jsl.js?callback=myApp.finishLoadNokiaJS[/url]
If no such callback mechanism is currently in place, is there any known/public Nokia map object that I can detect its existence and use as an indication that the Nokia JS lib has been loaded into the page?
thanks
LJ
Re: Maps JS API on-load detection?
Hi
[URL="http://api.maps.nokia.com/en/apireference/2.2.1/symbols/nokia.Features.html#.load"]nokia.Features.load[/URL] allows you to load a feature and specify a function callback to be notified after the loading succeeds of fails. I think that is what you need
Re: Maps JS API on-load detection?
Thanks. It looks like we could use nokia.Feature.isLoaded() to check if the 'map' feature has been loaded into browser. It requires two parameters, the first I assume we can use 'map' in this case, but what should be the value for the second param (featureImplName) ?
Thanks
Re: Maps JS API on-load detection?
Hi
To start using Maps API you have [URL="http://api.maps.nokia.com/2.0.0/devguide/getting_started.html#LoadingtheAPI"]to load it with loader[/URL] . Maps API is modular and you [URL="http://api.maps.nokia.com/2.0.0/devguide/advanced_usage.html#PackagesandDetection"]can select feature set to load[/URL] . Mentioned before loader can accept a callback function to notify about the loader work. That is the scheme.
I don't think you can find somewhere in the documentation the feature list and use a feature use checking by name. I do not know if featureImplName is documented somewhere. Definitelly you can read already loaded feature list and obtain some value back -- but i do not see any use in it.
To check whether you components are loaded i suppose to use nokia.Features.load with event callback -- you do not need to know featureImplName in that case. I suppose feature listing is kind of the API extension support-
Please check the documentation update on [URL="http://api.maps.nokia.com/2.0.0/apireference/symbols/nokia.Features.html"]Features [/URL], apparently it gets more clear:
[CODE]
nokia.Features.load({
"map": "auto",
"search": "auto"
}, onSuccess, onError);
[/CODE]
Re: Maps JS API on-load detection?
I am also trying to load the Nokia Maps api in a non-blocking matter. Does anyone have a working example of this ?