Nokia Maps API Reference

Contents

Class nokia.Features

Class Summary

The API provides mechanisms to individually load specific features like "routing" or "search". Each of the features may exist in different implementations for different target environments. A feature implementation is a set of classes that enable certain functionality and which can be loaded to enrich the functionality.
By default the API loads all possible features in the optimal implementation for the environment in which it runs. However, the loading of certain features may also be deferred by explicitly disallowing certain or all features at page load time. This may reduce the initial page load time as not all of the API's code is transferred and executed during the page's start up.
The Features object provides the infrastructure to load individual features of the API manually in a deferred way. It automatically resolves dependencies between features and provides mechanisms to detect the best feature implementation for the current environment.
The Features object is a static object that is not to be instantiated. Instead use it

Method Summary
static add (featureName, featureImplName, loadPath, [detector, [dependencies, [onLoadCallback, [charset]]]]) Adds a new feature implementation definition to the feature registry.
static get (featureName, [featureImplName]) Retrieves a feature implementation definition object for a specified feature.
static getFeatureMap () Returns a map of registered feature implementation names per feature.
static getLoadedMap () Returns a map of the names of fully loaded feature implementations per feature.
static isLoaded (featureName, featureImplName) : Boolean Checks whether a certain feature implementation has been successfully loaded.
static load (requested, [onSuccess, [onError, [doc, [sync]]]]) Loads a set of specified features.
Constructor Detail

The API provides mechanisms to individually load specific features like "routing" or "search". Each of the features may exist in different implementations for different target environments. A feature implementation is a set of classes that enable certain functionality and which can be loaded to enrich the functionality.
By default the API loads all possible features in the optimal implementation for the environment in which it runs. However, the loading of certain features may also be deferred by explicitly disallowing certain or all features at page load time. This may reduce the initial page load time as not all of the API's code is transferred and executed during the page's start up.
The Features object provides the infrastructure to load individual features of the API manually in a deferred way. It automatically resolves dependencies between features and provides mechanisms to detect the best feature implementation for the current environment.
The Features object is a static object that is not to be instantiated. Instead use it

nokia.Features()
Method Detail
static add (featureName, featureImplName, loadPath, [detector, [dependencies, [onLoadCallback, [charset]]]])
Adds a new feature implementation definition to the feature registry. If the feature's name does not yet exist in the registry it will be created and the implementation will be added to it.
Parameters:
{string} featureName - a canonical name of the feature to which the implementation belongs
{string} featureImplName - a canonical the name of the implementation
{string} loadPath - the load path of the concrete implementation file
{function()} [detector]: - the detector function, determining whether this feature can be loaded in the current environment. (If none is passed, a default function, which always returns true, will be assumed.)
{Array} [dependencies]: null - an optional array of feature name this implementation depends on
{function()} [onLoadCallback]: null - an optional onLoadCallback for this specific implementation (will be called once when the implementation is loaded)
{string} [charset]: 'utf-8' - an optional charset for the script
static get (featureName, [featureImplName])
Retrieves a feature implementation definition object for a specified feature.
Parameters:
{string} featureName - the name of the feature to be retrieved
{string} [featureImplName]: 'auto' - either the name of the specific implementation, or 'auto' for automatically detecting the optimal implementation for the current environment.
Returns:
either a feature implementation object, or null (in case none of the features is supported by the current environment)
static getFeatureMap ()
Returns a map of registered feature implementation names per feature. The returned map will have the following structure:
{
	featureA: [featureImplNameA1, featureImplNameA2, ...],
	featureB: [featureImplNameB1, ...]
	...
}
static getLoadedMap ()
Returns a map of the names of fully loaded feature implementations per feature. The returned map will have the following structure:
{
	featureA: [featureImplNameA1, featureImplNameA2, ...],
	featureB: [featureImplNameB1, ...]
	...
}
static isLoaded (featureName, featureImplName) : Boolean
Checks whether a certain feature implementation has been successfully loaded. The method will only return 'true' if the queried implementation was completely loaded (i.e. transmitted AND evaluated). The method will throw an exception in case either the feature or the implementation are unknown.
Parameters:
{Object} featureName - the name of the feature to which the implementation belongs
{Object} featureImplName - the name of the implementation
Returns:
{Boolean} - true, if the feature was fully loaded, false otherwise
static load (requested, [onSuccess, [onError, [doc, [sync]]]])
Loads a set of specified features. An optional onSuccess and onError callback may be passed, as well as a target document, into which the respective script tags should be appended. The feature request is expected to be specified as an object where the keys represent the features and their values represent the implementation name, e.g.:
nokia.Features.load({
	"map": "auto",
	"search": "auto"
}); 
Parameters:
{Object} requested - the hash containing the required feature names (as keys) and feature implementation parameters (as values)
{function()} [onSuccess]: - an optional success callback
{function(e)} [onError]: - an optional error callback
{Document} [doc]: document - the host document
{Boolean} [sync]: - if set to true synchronous loading via document.write will be enforced
Documentation generated on Mon Oct 24 2011 14:24:29 GMT+0200 (CEST).