UNPKG

@peter.naydenov/route-emitter

Version:

Changes in URL are converted in events according routes definition list

19 lines (12 loc) 641 B
function _historyActions ( dependencies, state ) { return function _historyActions ( task, {addressName, data, url}) { const { eBus, API } = dependencies , lastLocation = state.lastLocation ; API.navigate ( addressName, data, true ) // last argument is 'historyEvent' flag. if ( lastLocation === url ) eBus.emit ( '_RELOAD', addressName, data, url ) else eBus.emit ( '_CHANGE' , addressName, data, url ) task.done ( addressName, data ) }} // _historyActions func. export default _historyActions