API Docs for: 0.4.7
Show:

Y.mojito.lib.MojitoRouter Class

The Routing component of Mojito.

Constructor

Y.mojito.lib.MojitoRouter

(
  • store
)
private

Parameters:

  • store Object

    The resource store for the router to use.

Methods

_matchToInternal

(
  • uri
  • verb.
)
private

Returns a matching route for the given URI

Parameters:

  • uri String

    The uri to find a route for.

  • verb. String

    The HTTP verb for the route.

find

(
  • url
  • verb
)

Finds a route for a given method+URL

Parameters:

  • url String

    the URL to find a route for.

  • verb String

    the HTTP method.

getComputedRoutes

() Object

For optimization. Call this to get the computed routes that can be passed to the constructor to avoid recomputing the routes.

Returns:

Object: computed routes.

getInlineCssMojits

(
  • store
  • env
  • context
)
Array

Returns details on how to make inline CSS for mojits.

This example comes from (a modified) GSG5. [ { mojitName: 'FlickrDetail', yuiModuleName: 'inlinecss/FlickrDetail', dest: '/blah/mojits/FlickrDetail/autoload/compiled' + '/css.iphone.client.js', srcs: { '/static/FlickrDetail/assets/index.css': true, '/static/FlickrDetail/assets/message.css': true } ]

Parameters:

  • store String

    resource store

  • env String

    "client" or "server"

  • context Object

    runtime context

Returns:

Array: object describing where to put the inline CSS file and what it should contain

getRoute

(
  • method
  • url
  • routeMaker
)
Object

Finds a route for a given method+URL

Parameters:

  • method String

    The HTTP method.

  • url String

    The URL to find a route for.

  • routeMaker RouteMaker

    The route maker.

Returns:

Object: The route.

MakeStore

(
  • cfg
)
ResourceStore private

Creates the Resource Store object.

Parameters:

  • cfg Object

    Configuration for the resource store.

Returns:

ResourceStore: the new resource store object

mergeRecursive

(
  • dest
  • src
  • typeMatch
)

Recursively merge properties of two objects

Parameters:

  • dest Object

    The destination object.

  • src Object

    The source object.

  • typeMatch Boolean

    Only replace if src and dest types are the same type if true.

metaMerge

(
  • to
  • from
  • clobber
)
private

Used to merge meta objects into each other. Special consideration for certain headers values like 'content-type'.

Parameters:

  • to Object

    The target object.

  • from Object

    The source object.

  • clobber Boolean

    True to overwrite existing properties.