Class: ViewSwitcher maps.nyc.gov

nyc.carto.ViewSwitcher

new ViewSwitcher(views)

Class for managing named instances of nyc.carto.View
Parameters:
Name Type Description
views Array.<nyc.carto.View> An array of views with names unique to this instance
Source:
Fires:
  • nyc.carto.ViewSwitcher#event:updated

Extends

Methods

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:

switchView(viewName, filterValues, descriptionValues)

Switch to and modify a named view
Parameters:
Name Type Description
viewName string The name of the view to switch to
filterValues Object.<string, Object.<string, string>> The values object used along with the views filters and sqlTemlate to modify the query for this view
descriptionValues Object.<string, string> The values objects for replacing tokens in the descriptionTemplate
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: