cf-util-route-handler
Advanced tools
Comparing version 1.0.0 to 2.0.0
'use strict'; | ||
exports.__esModule = true; | ||
exports.handleRoutes = handleRoutes; | ||
exports.routeTo = routeTo; | ||
var handler = undefined; | ||
function handleRoutes(callback) { | ||
if (handler) { | ||
throw new Error('Only one handler is allowed at a time'); | ||
} | ||
handler = callback; | ||
} | ||
function routeTo(url) { | ||
if (!handler) { | ||
throw new Error('A handler needs to be setup before you can route'); | ||
} | ||
handler(url); | ||
} | ||
module.exports = require('./routeHandler'); |
{ | ||
"name": "cf-util-route-handler", | ||
"description": "CloudFlare Route Handler Util", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"build": "babel src -d lib", | ||
"example": "browserify example/script.js -o example/bundle.js -t babelify --debug", | ||
"format": "jsfmt -w *.js src/ test/", | ||
"lint": "eslint *.js src/ test/", | ||
"prepublish": "npm run build", | ||
"test": "karma start" | ||
}, | ||
"author": "James Kyle <me@thejameskyle.com>", | ||
@@ -18,27 +10,5 @@ "license": "BSD-3-Clause", | ||
"devDependencies": { | ||
"babel-cli": "^6.1.1", | ||
"babel-core": "^6.0.20", | ||
"babel-preset-cf": "^1.2.0", | ||
"babelify": "^7.2.0", | ||
"backbone": "^1.2.3", | ||
"browserify-istanbul": "^0.2.1", | ||
"chai": "^3.4.1", | ||
"defined": "^1.0.0", | ||
"eslint": "^1.8.0", | ||
"jquery": "^2.1.4", | ||
"jsfmt": "^0.5.2", | ||
"karma": "^0.13.15", | ||
"karma-beep-reporter": "^0.1.4", | ||
"karma-browserify": "^4.4.0", | ||
"karma-chrome-launcher": "^0.2.1", | ||
"karma-coverage": "^0.5.3", | ||
"karma-firefox-launcher": "^0.1.6", | ||
"karma-mocha": "^0.2.0", | ||
"karma-mocha-reporter": "^1.1.1", | ||
"karma-safari-launcher": "^0.1.1", | ||
"karma-sauce-launcher": "^0.3.0", | ||
"karma-tape-reporter": "^1.0.3", | ||
"minimist": "^1.2.0", | ||
"mocha": "^2.3.3" | ||
"jquery": "^2.1.4" | ||
} | ||
} |
@@ -14,7 +14,9 @@ # cf-util-route-handler | ||
```js | ||
import {handleRoutes, routeTo} from 'cf-util-route-handler'; | ||
import backboneAdapter from 'cf-util-route-handler/lib/backbone-adapter'; | ||
const {handleRoutes, routeTo} = require('cf-util-route-handler'); | ||
const Backbone = require('backbone'); | ||
// setup the router | ||
handleRoutes(backboneAdapter); | ||
handleRoutes(function(url) { | ||
Backbone.history.navigate(url, true); | ||
}); | ||
@@ -21,0 +23,0 @@ // do all the world to make the router work normally |
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
2
50
1803
5
18