d4f / backbone-highway

Routing Backbone with style \o/
MIT License
19 stars 5 forks source link

Remove existing routes #44

Closed ghost closed 6 years ago

ghost commented 6 years ago

Remove existing routes by name or by path

import assert from 'assert'
import highway from 'backbone-highway'

// Create a route
highway.route({
  name: 'home',
  path: '/'
  action () {}
})

// Retrieve route instance object and unregister it from highway
const deletedRoute = highway.remove({ name: 'home' })

assert.equal(deletedRoute.get('name'), 'home') // true

Fixes #43