The VMLaunch Method

What does VMLaunch method aim for ?

VMLaunch method is the starting point of the Api and generates all the functionnalities.
For each functionality, we provide you a specific component which must be loaded with the function VMLaunch.

How to call the VMLaunch function?

VMLaunch method contains 3 arguments : name of the component, configuration and callbacks.
Only the component’s name is required to launch the function.
VMLaunch("ViaMichelin.Api.Geocoding", conf, callbacks);               

Configuration du composant

The variable called "conf", on the second position of the parameters, configures datas according to your needs. It is an object which properties are parameters of the component. Each component has its own properties which are listed in its reference section.

Example :

var conf = {
  prop1 : "value1",
  bool1 : true

Declaration of callbacks

Callbacks functions are methods which will be linked with events and  triggered by the component.

All components loaded with VMLaunch will trigger one event after their initialization.

  • onInit if the loading has been successful
  • onInitError if the loading failed
var callbacks = {
  onInit : function (component) {
    console.log("the component has been initialized correctly!"));
    console.log("Reference of the component : ", component);
  onInitError : function (component, error) {

The method linked with onInit event will be called with one parameter which corresponds to the instantiation of the component. The "onInitError" method  must be called with two parameters, the first one corresponding to the instantiation, and the second one to the error returned by the method.