Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abstract-state-router

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-state-router - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

2

package.json
{
"name": "abstract-state-router",
"version": "5.0.0",
"version": "5.0.1",
"description": "The basics of a client-side state router ala the AngularJS ui-router, but without any DOM interactions",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,7 +0,13 @@

To manage webapp states so that you don't have to deal with url paths or anything.
[ui-router](https://github.com/angular-ui/ui-router/wiki) is fantastic, and I would use it in all of my projects if it wasn't tied to AngularJS.
[ui-router](https://github.com/angular-ui/ui-router/wiki) is fantastic, and I would use it in all of my projects if it wasn't tied to AngularJS. Thus, this library! Written to work with [browserify](https://github.com/substack/node-browserify).
But I don't want to use AngularJS - I want to use *[my favorite templating/dom manipulation libraries here]*.
# Construction
Thus, this library! Written to work with [browserify](https://github.com/substack/node-browserify), it lets you create nested "states" that correspond to different parts of the url path.
For example: if your "user profile" state contains "contact settings" and "profile image" sub-states, browsing from /profile/contact to /profile/image will change the content to display the "profile image" state without touching any of the DOM elements in the user profile page template.
To see an example app implemented with a couple of different browser rendering libraries, [click here to visit the state-router-example on Github Pages](http://tehshrike.github.io/state-router-example).
# API
```js

@@ -19,3 +25,3 @@ var createStateRouter = require('abstract-state-router')

# stateRouter.addState({name, route, defaultChild, data, template, resolve, activate, querystringParameters})
## stateRouter.addState({name, route, defaultChild, data, template, resolve, activate, querystringParameters})

@@ -40,3 +46,3 @@ The addState function takes a single object of options. All of them are optional, unless stated otherwise.

## resolve(data, parameters, callback(err, content).redirect(stateName, params))
### resolve(data, parameters, callback(err, content).redirect(stateName, params))

@@ -49,3 +55,3 @@ The first argument is the data object you passed to the addState call. The second argument is an object containing the parameters that were parsed out of the route params and the query string.

## activate(context)
### activate(context)

@@ -59,3 +65,3 @@ The activate function is called when the state becomes active. It is passed an event emitter named `context` with four properties:

### events
#### context events

@@ -109,3 +115,3 @@ - 'destroy': emitted when the state is destroyed

# stateRouter.go(stateName, [parameters, [options]])
## stateRouter.go(stateName, [parameters, [options]])

@@ -123,3 +129,3 @@ Browses to the given state, with the current parameters. Changes the url to match.

# stateRouter.evaluateCurrentRoute(fallbackRoute, [fallbackParameters])
## stateRouter.evaluateCurrentRoute(fallbackRoute, [fallbackParameters])

@@ -154,8 +160,13 @@ You'll want to call this once you've added all your initial states. It causes the current path to be evaluated, and will activate the current state. If the current path doesn't match the route of any available states, the browser gets sent to the fallback route provided.

- the ability to set an "error" state to go to on errors
- help somebody else set up the state router with their favorite rendering image
License
======
# Maintainers
- [TehShrike](https://github.com/TehShrike)
- [ArtskydJ](https://github.com/ArtskydJ)
# License
[WTFPL](http://wtfpl2.com)
[![Build Status](https://travis-ci.org/TehShrike/abstract-state-router.svg?branch=master)](https://travis-ci.org/TehShrike/abstract-state-router)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc