atomic-routes
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -23,17 +23,17 @@ (typeof module !== "undefined" && module !== null ? function(moduleBody) { | ||
NavigationState.prototype._update = function(subPath) { | ||
var changeListener, _i, _len, _ref, _results; | ||
var changeListener, j, len, ref, results; | ||
if (!this.isActive) { | ||
throw new Error('already destroyed'); | ||
} | ||
_ref = this._listenerList; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
changeListener = _ref[_i]; | ||
_results.push(changeListener(subPath)); | ||
ref = this._listenerList; | ||
results = []; | ||
for (j = 0, len = ref.length; j < len; j++) { | ||
changeListener = ref[j]; | ||
results.push(changeListener(subPath)); | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
NavigationState.prototype._destroy = function() { | ||
var changeListener, _i, _len, _ref, _results; | ||
var changeListener, j, len, ref, results; | ||
if (!this.isActive) { | ||
@@ -44,9 +44,9 @@ throw new Error('already destroyed'); | ||
this._resolveWhenDestroyed(); | ||
_ref = this._listenerList; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
changeListener = _ref[_i]; | ||
_results.push(changeListener(null)); | ||
ref = this._listenerList; | ||
results = []; | ||
for (j = 0, len = ref.length; j < len; j++) { | ||
changeListener = ref[j]; | ||
results.push(changeListener(null)); | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -70,3 +70,5 @@ | ||
currentState = new NavigationState(_this, [], []); | ||
return cb.call(null, currentState); | ||
if (cb) { | ||
return cb.call(null, currentState); | ||
} | ||
} | ||
@@ -77,3 +79,7 @@ }; | ||
processPath(this._currentPath); | ||
return this; | ||
return { | ||
getIsActive: function() { | ||
return currentState !== null; | ||
} | ||
}; | ||
}; | ||
@@ -93,3 +99,3 @@ | ||
matchPath = function(subPath) { | ||
var args, i, segment, _i, _len; | ||
var args, i, j, len, segment; | ||
if (subPath.length < suffixPath.length) { | ||
@@ -99,3 +105,3 @@ return null; | ||
args = []; | ||
for (i = _i = 0, _len = suffixPath.length; _i < _len; i = ++_i) { | ||
for (i = j = 0, len = suffixPath.length; j < len; i = ++j) { | ||
segment = suffixPath[i]; | ||
@@ -111,4 +117,4 @@ if (segment[0] === ':') { | ||
matchCurrentArgs = function(args) { | ||
var i, x, _i, _len; | ||
for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) { | ||
var i, j, len, x; | ||
for (i = j = 0, len = args.length; j < len; i = ++j) { | ||
x = args[i]; | ||
@@ -136,3 +142,5 @@ if (x !== currentArgs[i]) { | ||
currentArgs = match[0]; | ||
return cb.apply(null, currentArgs.concat([currentState])); | ||
if (cb) { | ||
return cb.apply(null, currentArgs.concat([currentState])); | ||
} | ||
} else { | ||
@@ -146,3 +154,7 @@ return currentState._update(match[1]); | ||
processPath(this._currentPath); | ||
return this; | ||
return { | ||
getIsActive: function() { | ||
return currentState !== null; | ||
} | ||
}; | ||
}; | ||
@@ -149,0 +161,0 @@ |
{ | ||
"name": "atomic-routes", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"main": "dist/atomic-routes.js", | ||
@@ -5,0 +5,0 @@ "description": "Decentralized nested client-side routing with Promises. Framework-agnostic, composable, simple: designed to work with component-based application UIs.", |
Sorry, the diff of this file is not supported yet
18265
222
0