Methods


loadFeed( callback )

Description

Load the MTA Transit Feed

Parameters
Name Type Description
callback function

Callback function

Name Type Attributes Description
error Error

Transit Feed Error. The Error's message will be a pipe (|) separated string in the format of: Error Code|Error Type|Error Message that will be parsed out by the Right Track API Server into a more specific error Response.

feed TransitFeed <optional>

The built Transit Feed for the MTA

Details

_findRoutes( agency_ids, route_id_matches, entities ) → {Array.<String>}

Description

Find matching MTA Route IDs given the specified Agency IDs and Route ID RegExps

Parameters
Name Type Description
agency_ids Array.<String>

MTA Agency IDs

route_id_matches Array.<String>

Regular Expressions for matching MTA Route IDs

entities Array.<Object>

Parsed entities (from the MTA API)

Returns

Array of matching MTA Route IDs

Details

_buildEvents( agency_ids, route_id, entities ) → {Array.<TransitEvent>}

Description

Build the Transit Events for the specified Route ID

Parameters
Name Type Description
agency_ids Array.<String>

MTA Agency IDs

route_id String

MTA Route ID

entities Array.<Object>

Parsed entities (from the MTA API)

Returns

Array of build Transit Events

Details

_parseEntity( e ) → {Object|Boolean}

Description

Parse the MTA Alert Entity and retrieve the routes and event details for an entity that should be displayed in the Feed

Parameters
Name Type Description
e Object

Alert Entity

Returns

false if the entity should not be displayed For active alerts, return an object with the following keys:

  • routes: agency_id, route_id, and sort_order of impacted routes
  • event: id, status, and details of event
Details

_clean( html ) → {String}

Description

Clean the specified HTML

  • set hidden sections as visible
  • replace leading and trailing breaks
  • replace empty links
Parameters
Name Type Description
html String

HTML to clean

Returns

cleaned HTML

Details

_parseTokens( details ) → {String}

Description

Find and replace icon tokens in the event details

Parameters
Name Type Description
details String

The details to parse

Returns

parsed details

Details