react-crossroads
Version:
Client side router for web applications built with React and utilizing the Flux architecture. The backing routing engine is CrossroadsJs.
22 lines (15 loc) • 498 B
text/coffeescript
ActiveHandler = require './ActiveHandler'
_ = require 'lodash'
class ActiveEndpoint
constructor: (@path, @endpoint, @params) ->
render: =>
rootHandler = new ActiveHandler @endpoint.chain, @params
rootHandler.activeRouteHandler()
isActive: (to, params) ->
match = _.chain @endpoint.chain
.filter (endpoint) -> endpoint.name == to
.first()
.value()
return false unless match?
@path.indexOf(match.makePath params) == 0
module.exports = ActiveEndpoint