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.8.0 to 5.8.1

readme.md.orig

8

index.js

@@ -18,2 +18,4 @@ var StateState = require('./lib/state-state')

var expectedPropertiesOfAddState = ['name', 'route', 'defaultChild', 'data', 'template', 'resolve', 'activate', 'querystringParameters', 'defaultQuerystringParameters']
module.exports = function StateProvider(makeRenderer, rootElement, stateRouterOptions) {

@@ -138,2 +140,8 @@ var prototypalStateHolder = StateState()

}
Object.keys(state).filter(function(key) {
return expectedPropertiesOfAddState.indexOf(key) === -1
}).forEach(function(key) {
console.warn('Unexpected property passed to addState:', key)
})
prototypalStateHolder.add(state.name, state)

@@ -140,0 +148,0 @@

2

package.json
{
"name": "abstract-state-router",
"version": "5.8.0",
"version": "5.8.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",

@@ -42,3 +42,3 @@ [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.

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

@@ -63,9 +63,11 @@ 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))
`defaultQuerystringParameters` is an object whose properties should correspond to parameters defined in the `querystringParameters` option. Whatever values you supply here will be used as the defaults in case the url does not contain any value for that parameter.
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.
### resolve(data, parameters, callback(err, content).redirect(stateName, [stateParameters]))
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 and the query string.
If you call `callback(err, content)` with a truthy err value, the state change will be cancelled and the previous state will remain active.
If you call `callback.redirect(stateName, params)`, the state router will begin transitioning to that state instead. The current destination will never become active, and will not show up in the browser history.
If you call `callback.redirect(stateName, [stateParameters])`, the state router will begin transitioning to that state instead. The current destination will never become active, and will not show up in the browser history.

@@ -138,3 +140,3 @@ ### activate(context)

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

@@ -152,5 +154,5 @@ Browses to the given state, with the current parameters. Changes the url to match.

## stateRouter.evaluateCurrentRoute(fallbackRoute, [fallbackParameters])
## stateRouter.evaluateCurrentRoute(fallbackStateName, [fallbackStateParameters])
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.
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 state provided.

@@ -157,0 +159,0 @@ ```js

@@ -21,3 +21,3 @@ var hashRouterFactory = require('hash-brown-router')

template: null,
render: t.fail.bind(t, 'dummy route was called')
activate: t.fail.bind(t, 'dummy route was called')
})

@@ -24,0 +24,0 @@

@@ -11,3 +11,3 @@ var test = require('tape-catch')

route: '/parent',
parameters: [ 'thingy', 'thinger' ]
querystringParameters: [ 'thingy', 'thinger' ]
})

@@ -14,0 +14,0 @@

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