- feature: the
canLeaveState
function now gets passed a second argument with the name+parameters of the state that the user is trying to navigate to - technically a breaking change: the previously undocumented
stateChangePrevented
function now gets passed a name+parameters object as its first argument, instead of just the name of the current state. Also, it gets passed a second argument with the name+parameters of the state that the user attempted to visit.
Fix: only call canLeaveState
on states that are going to be destroyed, not the ones that are going to get created.
Fix a bug that could cause canLeaveState
to be called twice. #155
Add canLeaveState
to addState
, so you can implement route guards to prevent people from navigating away from a state if they e.g. have unsaved state. #154
Support passing in a null
state name to stateIsActive
.
Fixes an issue where when a state was destroyed and resolved during the same state change, the result of its resolve
function would get tossed out.
Removes the concept of resetting states.
The concept of resetting breaks down if your component library doesn't support
- slots
- resetting the state of a component without resetting the contents of slots
For renderers that "reset" states by destroying the existing component and re-constructing it, stuff would break in any case where a parent and child state were both told to reset at once. Whenever the parent would reset and destroy its part of the DOM, the child would get wiped out.
Existing renderers don't need to change to work with this version of ASR, it's just that their reset
function won't get called any more.
The beforeResetState
and afterResetState
should not be fired any more.
- Coerce parameter values to strings for comparison in
stateIsActive
#151
- Give an explicit/useful error message if you forget to add a
ui-view
element to a parent template #148
- maintenance: update a bunch of dependencies #141
- maintenance: autoformat the scripts to make myself feel better and reduce commit noise in the future #145
- breaking: dropped ES5 support. If you're targeting ES5 you'll need to compile it in your own app's build.
- feature: allow dynamic parameter defaults via functions #144
- feature: added
getActiveState
method #121
- maintenance: added a bunch of files to the
.npmignore
to reduce the package download size
- bug fix: update the hash-brown-router dependency to fix an issue where calling
evaluateCurrent('somestate')
wouldn't do anything whensomestate
's route was/
and the current url was also/
. Issue #116 in abstract-state-router, commit #56c207f0 in hash-brown-router. If you're passing in your own hash-brown-router instance, make sure to update it to 3.3.1 to avoid the bug.
- bug fix: point package.main at the ES5 bundle instead of the ES2015 code :-x 34ea0baa
- bug fix: fixed a crash that would happen if you didn't pass an options object in 3b60669b
- dependency update: changed hash-brown-router dependency from ~3.2.0 to ^3.3.0 a593408b
Promise
andObject.assign
polyfills are now required for older browsers- refactor: updated all the source code to ES2015 (though the published version is still compiled down to ES5)
- functional:
stateChangeStart
andstateChangeEnd
events now also emit the full array of states being transitioned to. #113
- documentation: added a table of contents to the API section of the readme #111
- drop dependencies on the
process
andevents
polyfills and bump hash-brown-router dependency, saving about 25KB
- documentation: fixed a requre/require typo #103
- documentation: added "inherit" to the documented
go()
options #104 - documentation: in the rendered docs, fixed the link to the ractive example source code 8511b651
- updated hash-brown-router to 3.1.0, making the
/
route equivalent to an empty route string #102
- updated hash-brown-router #93
- compatibility: switched from
require('events').EventEmitter
torequire('events')
for better Rollup compatibility. c861f5ab
- functional: renderers may now return a new DOM API from the reset function. c07a45fb
- bug fix: empty strings in default parameters would cause the state router to stop cold without any error message #2abf9361
- functional: replaced the
defaultQuerystringParameters
property on states withdefaultParameters
, which applies to both querystring and route parameters. If you don't specifydefaultParameters
,defaultQuerystringParameters
will be checked too (though it will now apply to route parameters as well). #91
- functional: made
stateName
optional forgo
/replace
/makePath
#83
- dependency update: require page-path-builder 1.0.3, fixing a path-building bug #650af6af
- bug fix:
stateIsActive
was doing an extremely naive check #71
- bug fix:
makePath(stateName, params, { inherit: true })
now properly inherits route parameters during the render/activate phases #7617d74b
- bug fix: fixed Webpack build by changing a JSON file to CommonJS #65
- bug fix: states that had child states without routes weren't necessarily loading the correct child state when you browsed to them #85112c79
- documentation: documented the
stateChangeError
event - documentation: documented the
stateError
event - 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
- functional: added a
parameters
property to the context objects emitted with thebeforeCreateState
,afterCreateState
,beforeResetState
, andafterResetState
events. https://github.com/TehShrike/abstract-state-router/commit/c81228b49d0808fe722cda718598816e3c8ac5b3
- functional: changed
destroy
to be emitted to the active states afterbeforeDestroyState
/beforeResetState
is emitted on the state router https://github.com/TehShrike/abstract-state-router/commit/8522a300ad23ed45dce0c6be1398bfb3883dd98c - documentation: added the event list #58
- functional: added an "inherit" option when navigating to a new state #57
- added an "inherit" option to makePath
- functional: added emitting events before and after calling every dom rendering function #54
- functional: added console warnings if you call
stateRouter.addState
passing in an object with unexpected properties https://github.com/TehShrike/abstract-state-router/commit/67618b75e7a4e310cb8c3e15f31e3157e2921f6f - tests/documentation: fixed some discrepencies highlighted by the above warnings https://github.com/TehShrike/abstract-state-router/commit/438e0a14ad16181f16881f771d543ccdada8d690
- documentation: changed
params
/stateParameters
naming to be consistent by changing everything tostateParameters
- functional: changed parameters objects passed to the DOM rendering functions to be mutable copies instead of being frozen