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.1.1 to 5.2.0

13

index.js

@@ -100,8 +100,11 @@ var StateState = require('./state-state')

function onRouteChange(state, parameters) {
function stateGo(transition) {
var fullStateName = prototypalStateHolder.applyDefaultChildStates(state.name)
attemptStateChange(fullStateName, parameters, transition)
var fullStateName = prototypalStateHolder.applyDefaultChildStates(state.name)
if (fullStateName !== state.name) {
stateProviderEmitter.go(fullStateName, parameters, { replace: true })
} else {
stateProviderEmitter.emit('stateChangeAttempt', function stateGo(transition) {
attemptStateChange(fullStateName, parameters, transition)
})
}
stateProviderEmitter.emit('stateChangeAttempt', stateGo)
}

@@ -108,0 +111,0 @@

{
"name": "abstract-state-router",
"version": "5.1.1",
"version": "5.2.0",
"description": "The basics of a client-side state router ala the AngularJS ui-router, but without any DOM interactions",
"main": "index.js",
"scripts": {
"test": "zuul -- test/*.js",
"localtest": "tape test/*.js | faucet"
"zuul": "zuul -- test/*.js",
"test": "tape test/*.js | faucet"
},

@@ -29,3 +29,3 @@ "repository": {

"extend": "^2.0.1",
"hash-brown-router": "^1.3.3",
"hash-brown-router": "^1.4.0",
"page-path-builder": "^1.0.2",

@@ -32,0 +32,0 @@ "path-to-regexp-with-reversible-keys": "^1.0.3",

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

`defaultChild` is a string (or a function that returns a string) of the default child's name. If you attempt to go directly to a state that has a default child, you will be directed to the default child. (E.g. if 'contacts' has the defaultChild 'list', then doing `state.go('contacts')` will actually do `state.go('contacts.list')`.)
`defaultChild` is a string (or a function that returns a string) of the default child's name. If you attempt to go directly to a state that has a default child, you will be directed to the default child. (For example, you could set 'list' to be the default child of 'contacts'. Then doing `state.go('contacts')` will actually do `state.go('contacts.list')`. Likewise, browsing to '/tehshrike/contacts' would bring you to '/tehshrike/contacts/list'.)

@@ -47,0 +47,0 @@ `data` is an object that can hold whatever you want - it will be passed in to the resolve and activate functions.

@@ -9,11 +9,15 @@ var test = require('tape')

function RememberActivation() {
function RememberActivation(location) {
var last = ''
var lastLocation = ''
function set(str) {
return function s() { last = str }
return function s() {
last = str
lastLocation = location.get()
}
}
function get(tt, str) {
function get(tt, str, url) {
return function g() {
var msg = 'last activated state should be "' + str + '"'
tt.equal(str, last, msg)
tt.equal(last, str, 'last activated state should be "' + str + '"')
tt.equal(lastLocation, url, 'last observed url should be "' + lastLocation + '"')
tt.end()

@@ -30,4 +34,5 @@ }

test('default grandchild', function (t) {
var stateRouter = getTestState(t).stateRouter
var remember = RememberActivation()
var testState = getTestState(t)
var stateRouter = testState.stateRouter
var remember = RememberActivation(testState.location)

@@ -70,3 +75,3 @@ stateRouter.addState({

t.test('hey -> hey.rofl.copter', function (tt) {
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'copter'))
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'copter', '/hay/routeButt/lolcopter'))
stateRouter.go('hey')

@@ -76,3 +81,3 @@ })

t.test('hey.rofl -> hey.rofl.copter', function (tt) {
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'copter'))
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'copter', '/hay/routeButt/lolcopter'))
stateRouter.go('hey.rofl')

@@ -82,3 +87,3 @@ })

t.test('hey.rofl.cat -> hey.rofl.cat', function (tt) {
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'cat'))
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'cat', '/hay/routeButt/lolcat'))
stateRouter.go('hey.rofl.cat')

@@ -118,4 +123,5 @@ })

test('functions as parameters', function (t) {
var stateRouter = getTestState(t).stateRouter
var remember = RememberActivation()
var testState = getTestState(t)
var stateRouter = testState.stateRouter
var remember = RememberActivation(testState.location)

@@ -141,5 +147,5 @@ stateRouter.addState({

t.test('hey -> hey', function (tt) {
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'rofl'))
stateRouter.once('stateChangeEnd', remember.onEnd(tt, 'rofl', '/hay/routeButt'))
stateRouter.go('hey')
})
})

Sorry, the diff of this file is not supported yet

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