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.12.2 to 5.12.3

test/webpack.js

10

changelog.md

@@ -0,1 +1,5 @@

# [5.12.3](https://github.com/TehShrike/abstract-state-router/releases/tag/v5.12.3)
- bug fix: `makePath(stateName, params, { inherit: true })` now properly inherits route parameters during the render/activate phases https://github.com/TehShrike/abstract-state-router/commit/7617d74be416d57ac2726cd0d45744627963ec2e
# [5.12.2](https://github.com/TehShrike/abstract-state-router/releases/tag/v5.12.2)

@@ -7,3 +11,3 @@

- bug fix: states that had child states without routes weren't necessarily loading the correct child state when you browsed to them
- bug fix: states that had child states without routes weren't necessarily loading the correct child state when you browsed to them https://github.com/TehShrike/abstract-state-router/commit/85112c7965c1bcdea1576b9d8c4f7585b65380e4

@@ -14,7 +18,7 @@ # [5.12.0](https://github.com/TehShrike/abstract-state-router/releases/tag/v5.12.0)

- documentation: documented the `stateError` event
- functional: added the `routeNotFound` event when a route is visited that doesn't have any states associated with it
- functional: added the `routeNotFound` event when a route is visited that doesn't have any states associated with it https://github.com/TehShrike/abstract-state-router/commit/f3e2fbda5fa85068df3aa9f9539d61bb95667caf
# [5.11.0](https://github.com/TehShrike/abstract-state-router/releases/tag/v5.11.0)
- functional: added a `parameters` property to the context objects emitted with the `beforeCreateState`, `afterCreateState`, `beforeResetState`, and `afterResetState` events.
- functional: added a `parameters` property to the context objects emitted with the `beforeCreateState`, `afterCreateState`, `beforeResetState`, and `afterResetState` events. https://github.com/TehShrike/abstract-state-router/commit/c81228b49d0808fe722cda718598816e3c8ac5b3

@@ -21,0 +25,0 @@ # [5.10.0](https://github.com/TehShrike/abstract-state-router/releases/tag/v5.10.0)

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

var prototypalStateHolder = StateState()
var current = CurrentState()
var lastCompletelyLoadedState = CurrentState()
var lastStateStartedActivating = CurrentState()
var stateProviderEmitter = new EventEmitter()

@@ -41,4 +42,2 @@ StateTransitionManager(stateProviderEmitter)

current.set('', {})
var destroyDom = null

@@ -241,5 +240,5 @@ var getDomChild = null

stateProviderEmitter.emit('stateChangeStart', state, parameters)
lastStateStartedActivating.set(state.name, parameters)
})).then(function getStateChanges() {
var stateComparisonResults = StateComparison(prototypalStateHolder)(current.get().name, current.get().parameters, newStateName, parameters)
var stateComparisonResults = StateComparison(prototypalStateHolder)(lastCompletelyLoadedState.get().name, lastCompletelyLoadedState.get().parameters, newStateName, parameters)
return stateChangeLogic(stateComparisonResults) // { destroy, change, create }

@@ -288,3 +287,3 @@ }).then(ifNotCancelled(function resolveDestroyAndActivateStates(stateChanges) {

})).then(function stateChangeComplete() {
current.set(newStateName, parameters)
lastCompletelyLoadedState.set(newStateName, parameters)
try {

@@ -313,3 +312,3 @@ stateProviderEmitter.emit('stateChangeEnd', prototypalStateHolder.get(newStateName), parameters)

if (options && options.inherit) {
parameters = extend(current.get().parameters, parameters)
parameters = extend(lastStateStartedActivating.get().parameters, parameters)
}

@@ -344,3 +343,3 @@

stateProviderEmitter.stateIsActive = function stateIsActive(stateName, opts) {
var currentState = current.get()
var currentState = lastCompletelyLoadedState.get()
return currentState.name.indexOf(stateName) === 0 && (typeof opts === 'undefined' || Object.keys(opts).every(function matches(key) {

@@ -347,0 +346,0 @@ return opts[key] === currentState.parameters[key]

module.exports = function CurrentState() {
var current = null
var current = {
name: '',
parameters: {}
}

@@ -4,0 +7,0 @@ return {

{
"name": "abstract-state-router",
"version": "5.12.2",
"version": "5.12.3",
"description": "The basics of a client-side state router ala the AngularJS ui-router, but without any DOM interactions",

@@ -46,4 +46,5 @@ "main": "index.js",

"tape-catch": "1.0.4",
"watchify": "3.4.0"
"watchify": "3.4.0",
"webpack": "^1.12.14"
}
}

@@ -22,2 +22,16 @@ [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.

# Install
Using npm + your favorite CommonJS bundler is easiest.
```sh
npm install abstract-state-router
```
You can also [download the stand-alone build from wzrd.in](https://wzrd.in/standalone/abstract-state-router@latest). If you include it in a `<script>` tag, a `abstractStateRouter` function will be included on the global scope.
Want to use the abstract-state-router without messing with bundlers or package managers? Check out the minimum-viable-project code (in a single HTML file!) over at the [simplest-abstract-state-router-usage](https://github.com/TehShrike/simplest-abstract-state-router-usage).
# API

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

@@ -81,1 +81,36 @@ var test = require('tape-catch')

})
test('makePath inheriting parameters from the route by the time the activate function is called', function(t) {
var stateRouter = getTestState(t, null, {
pathPrefix: ''
}).stateRouter
stateRouter.addState({
name: 'parent',
template: '',
route: '/parent/:someParam/yarp'
})
stateRouter.addState({
name: 'parent.child1',
template: '',
route: '/child1',
activate: function(context) {
t.equal(context.parameters.someParam, 'totally')
var path = stateRouter.makePath('parent.child2', {}, {
inherit: true
})
t.equal(path, '/parent/totally/yarp/child2', 'Output path contains the route parameter')
t.end()
}
})
stateRouter.addState({
name: 'parent.child2',
template: '',
route: '/child2'
})
stateRouter.go('parent.child1', { someParam: 'totally' })
})

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

t.plan(3)
t.timeoutAfter(1000)

@@ -91,0 +92,0 @@ var parentActivated = false

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