Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

50 Part I — Basics


Table 3-9(continued)

Method Description

trigger(source, Triggers the given event on the given source with the given list
eventName, args...) of arguments.
bind(source, Binds the given method of the given object to the given source
eventName, object, event. When the given event is triggered, the given method is
method) called for the specified object.

GEventmethods are static, so you should always create the object before calling the method
(for example, new GEvent(); GEvent.bind()) rather than creating and calling the
method in one line (for example, new GEvent().bind()).

GXmlHttp


This class creates a browser-independent instance of XmlHttpRequestthat enables you to
access remote content (XML, HTML, or XML-RPC). In short, the object provides a method
for dynamically loading information that can then be used to build components and items on
your map.

The precise operation of this function is covered in more detail in Chapter 5.

GXml


This class creates a new XML object that can be used to parse and access information con-
tained within an XML string. You must create the GXmlobject first, and then supply a string
to be parsed. For example:
var xmlparser = new GXml();

Once you create the object, you can parse XML by calling the parsemethod:
parser(xmlstring)

Or you can access a value from the parsed XML using value:
value(xmlnode)

Because you parse and then access data after you create the object, you can reuse the object to
parse other XML documents without re-creating a new object each time.
Free download pdf