shuttle.js
starts with a function declaration, the function named to be shuttle
accepts an object named config
as an argument. I was wondering where does the config
object come from to be passed into the function?
1 Answer
In service.js, exactly in the function named initCB
, when you create a new shuttle, you create it like that
// instantiate shuttle
shuttle = new Shuttle({
heading: HEADING,
height: HEIGHT,
latitude: LATITUDE,
longitude: LONGITUDE,
planet: earth,
seats: SEATS,
velocity: VELOCITY
});
-
and where doe the argument
instance
passed toinitCB
comes from? Sep 21, 2014 at 4:01 -
@segmentationfaulter
initCB
is called when the Google Earth Plugin is created and initialized successfully. Apparently an instance of it is passed toinitCB
so that you can have access to it. For more information, you may read the Creating initialization functions section from the API!– kzidane ♦Sep 21, 2014 at 5:01