Comparing version 1.1.3 to 1.1.4
@@ -56,9 +56,9 @@ | ||
if (!window.Router.listeners) { | ||
window.Router.listeners = []; | ||
if (!Router.listeners) { | ||
Router.listeners = []; | ||
} | ||
function onchange(onChangeEvent) { | ||
for (var i = 0, l = window.Router.listeners.length; i < l; i++) { | ||
window.Router.listeners[i](onChangeEvent); | ||
for (var i = 0, l = Router.listeners.length; i < l; i++) { | ||
Router.listeners[i](onChangeEvent); | ||
} | ||
@@ -110,3 +110,3 @@ } | ||
window.Router.listeners.push(fn); | ||
Router.listeners.push(fn); | ||
@@ -117,7 +117,7 @@ return this.mode; | ||
destroy: function (fn) { | ||
if (!window.Router || !window.Router.listeners) { | ||
if (!Router || !Router.listeners) { | ||
return; | ||
} | ||
var listeners = window.Router.listeners; | ||
var listeners = Router.listeners; | ||
@@ -189,3 +189,4 @@ for (var i = listeners.length - 1; i >= 0; i--) { | ||
this.handler = function(onChangeEvent) { | ||
var url = self.history === true ? self.getPath() : onChangeEvent.newURL.replace(/.*#/, ''); | ||
var newURL = onChangeEvent && onChangeEvent.newURL || window.location.hash; | ||
var url = self.history === true ? self.getPath() : newURL.replace(/.*#/, ''); | ||
self.dispatch('on', url); | ||
@@ -192,0 +193,0 @@ }; |
@@ -369,6 +369,6 @@ /* | ||
else if (typeof fn === 'function') { | ||
return fn.apply(thisArg, fns.captures || null); | ||
return fn.apply(thisArg, fns.captures || []); | ||
} | ||
else if (typeof fn === 'string' && self.resource) { | ||
self.resource[fn].apply(thisArg, fns.captures || null); | ||
self.resource[fn].apply(thisArg, fns.captures || []); | ||
} | ||
@@ -375,0 +375,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"author": "Nodejitsu Inc. <info@nodejitsu.com>", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"maintainers": [ | ||
@@ -25,3 +25,3 @@ "hij1nx <paolo@nodejitsu.com>", | ||
"devDependencies": { | ||
"codesurgeon": "0.2.x", | ||
"codesurgeon": "0.3.x", | ||
"colors": "0.5.x", | ||
@@ -31,5 +31,7 @@ "api-easy": "0.3.x", | ||
"request": "2.9.x", | ||
"qunitjs": "1.9.x", | ||
"vows": "0.6.x" | ||
}, | ||
"ender": "./build/ender.js", | ||
"browserify": "./build/director-1.1.4", | ||
"main": "./lib/director", | ||
@@ -36,0 +38,0 @@ "engines": { |
@@ -17,2 +17,3 @@ <img src="https://github.com/flatiron/director/raw/master/img/director.png" /> | ||
# Usage | ||
@@ -189,2 +190,8 @@ * [API Documentation](#api-documentation) | ||
### See Also: | ||
- Auto-generated Node.js API Clients for routers using [Director-Reflector](http://github.com/flatiron/director-reflector) | ||
- RESTful Resource routing using [restful](http://github.com/flatiron/restful) | ||
- HTML / Plain Text views of routers using [Director-Explorer](http://github.com/flatiron/director-explorer) | ||
<a name="cli-routing"></a> | ||
@@ -191,0 +198,0 @@ ## CLI Routing |
@@ -22,13 +22,8 @@ var http = require('http'), | ||
function fileServer(folder, file) { | ||
var filepath = folder; | ||
if (file) { | ||
filepath += "/" + file; | ||
var root = path.resolve(__dirname, '..'); | ||
if (folder === 'build' || folder === 'node_modules') { | ||
root = path.resolve(root, '..', '..'); | ||
} | ||
// Special case | ||
if (folder == "build") { | ||
filepath = "../../../" + filepath; | ||
} else { | ||
filepath = "../" + filepath; | ||
} | ||
var filepath = path.resolve(root, folder, file); | ||
@@ -58,3 +53,3 @@ var res = this.res; | ||
'/:folder': { | ||
'/:file': { | ||
'/(.+)': { | ||
get: fileServer | ||
@@ -61,0 +56,0 @@ }, |
@@ -22,2 +22,6 @@ module("Director.js", { | ||
function createTest(name, config, use, test, initialRoute) { | ||
// We rename to `RouterAlias` for the browserify tests, since we want to be | ||
// sure that no code is depending on `window.Router` being available. | ||
var Router = window.Router || window.RouterAlias; | ||
if (typeof use === 'function') { | ||
@@ -24,0 +28,0 @@ test = use; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
823
182302
7
42
4118