maps.nyc.gov

Class: Directions

nyc.Directions

new Directions(mapTarget, routeTarget, urlopt)

Provides directions using google maps
Parameters:
Name Type Attributes Default Description
mapTarget string | Element | JQuery The HTML DOM element on which to render the map for displaying the direction routes
routeTarget string | Element | JQuery The HTML DOM element in list route descriptions
url string <optional>
nyc.Directions.DEFAULT_GOOGLE_URL The Google Maps URL to use
Source:

Extends

Members

(static, constant) DEFAULT_GOOGLE_URL :string

The default URL for loading Google APIs
Type:
  • string
Source:

(static) EventType :string

Enumeration for directions event type
Type:
  • string
Properties:
Name Type Description
CHANGED string The change event type
NO_DIRECTIONS string
Source:

Methods

directions(args)

Get directions
Parameters:
Name Type Description
args nyc.Directions.Request The arguments describing the requested directions
Source:

init()

Initializes the class on callback from the Google Maps
Source:

off(eventName, evtHdlr, hdlrScopeopt)

Remove a previously connected event handler
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

on(eventName, evtHdlr, hdlrScopeopt)

Connect a function to an event
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

one(eventName, evtHdlr, hdlrScopeopt)

Connect a function to an event for a single invocation
Parameters:
Name Type Attributes Description
eventName string The name of the event to which the handler will be connected
evtHdlr function The event handler function
hdlrScope Object <optional>
The scope in which to invoke the event handler
Inherited From:
Source:

trigger(eventName, dataopt)

Trigger a named event with event data
Parameters:
Name Type Attributes Description
eventName string The name of the event to trigger
data Object <optional>
The event data
Inherited From:
Source:

Type Definitions

Request

Object type for getting directions
Type:
  • Object
Properties:
Name Type Attributes Description
from string <optional>
The origin location
to string The destination location
mode google.maps.DirectionsTravelMode The directions mode
facility string The name of the destination
Source:

Response

Object type for getting directions
Type:
  • Object
Properties:
Name Type Description
response Object The Google response
status google.maps.DirectionsStatus The status of the response
Source:

Events

changed

The class has completed initialization
Type:
Source: