react-crossroads
Version:
Client side router for web applications built with React and utilizing the Flux architecture. The backing routing engine is CrossroadsJs.
19 lines (14 loc) • 575 B
text/coffeescript
NamedLocations =
locations:
hash: require './HashLocation'
history: require './HistoryLocation'
refresh: require './RefreshLocation'
memory: require './MemoryLocation' # Primarily for Testing
locationFor: (name) =>
throw new Error 'Location type is not supported' unless name in Object.keys(NamedLocations.locations)
location = NamedLocations.locations[name]
isSupported = location.isSupportedOrFallback()
unless isSupported == true
location = NamedLocations.locations[isSupported]
location
module.exports = NamedLocations