HSLayers.InitBus (class)

class HSLayers.InitBus()

InitBus is array of functions, which will be executed one-after-another If the function needs XmlHttpRequest call, it will be running in a assynchronous way.

Purpose of the bus is to initialize the map components in organized way

How it works:

  1. use register for creating _fncs list of functions
  2. use run for calling each function
  3. first function will be called

4. if the function is simple (no object && event is given), call it directly. When the function is done, ‘function_done’ event is triggered - _runFromEvent is called 5. _runFromEvent is looking after index of next function in the bus and calling next function (run(idx)) 6. In case, the configuration of the function is object with event, the given event will be registered, so that after it is triggered, _runFromEvent will be called

Example usage:

var bus = new HSLayers.InitBus();

     // register funciton, which is part of object, which will return DONE event
     bus.register(some_function, {
             object: object
             event: "DONE",
             scope: object // scope, the used for the function
     });

     // register simple function
     bus.register(simple_function,{
             scope: some_object
     });

     // run the bus
     bus.run();

Methods

to be used only, if the function will be called in asynchronous way (using ajax).

to be used only, if the function will be called in asynchronous way (using ajax).

HSLayers.InitBus.register(fnc, config, {String})
register new function. obj and evt parameters are optional and are

to be used only, if the function will be called in asynchronous way (using ajax).

param Function fnc:
 

function to be executed

param Object config:
 

configuration object

param Object config.object:
 

which will call event, that will indicated, that the function is done

param String config.evt:
 

event name, that will indicate, that the function is done

param {String}:
 

config.args list of arguments

Optional

param Object config.scope:
 

scope of the call

HSLayers.InitBus.registerAt(fnc, position, config, {String})
register new function at specified position. obj and evt parameters are optional and are

to be used only, if the function will be called in asynchronous way (using ajax).

param Function fnc:
 

function to be executed

param Integer position:
 

default -1 (last one)

param Object config:
 

configuration object

param Object config.object:
 

object which will call event, that will indicated, that the function is done

param String config.evt:
 

event name, that will indicate, that the function is done

param {String}:
 

config.args list of arguments

Optional

param Object config.scope:
 

of the call

HSLayers.InitBus.unregister(fnc, config, {Mixed})

unregister registered function

Arguments:
  • fnc (Function) – function to be executed
  • config (Object) –
  • config.object (Object) – object which will call event, that will indicated, that the function is done
  • config.evt (String) – event name, that will indicate, that the function is done
  • {Mixed}

    config.args list of arguments

    Optional

  • config.scope (Object) – of the call
HSLayers.InitBus.run(idx)

run the list of registered functions

Arguments:
  • idx (Integer) – index of the function to call. 0 is default

Events

<static>

HSLayers.InitBus.

done
All functions were called and are finished

<static>

HSLayers.InitBus.

function_done
Function is done, go to another

<static>

HSLayers.InitBus.

run
The InitBus was lounched to run

<static>

HSLayers.InitBus.

running
One particular function is to be lounched now

Main Menu


Table Of Contents

Previous topic

HSLayers.InfoPanel (class)

Next topic

HSLayers.InitBus.initialize (class)

This Page