Skip to content
Branch: master
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time

#Paper Boy Routes!

This is a simple routing system for non-shitty browsers. That is browsers that support addEventListener and window.location.hash. It doesn't use fancy push-state yet, but it does use hash tags.

It's not very good, but you can check it out. The defining feature is the ability to have enter and exit routes defined. You should probably use


jam install paper-boy
// Assuming RequireJS
// It doesn't have to be used with require
    PaperBoy = require('paper-boy')
  , router   = new PaperBoy({
      // Paper Boy has enter and exit routes
      "": {
        enter: function(){
          console.log("Welcome to the home page!");
      , exit: function(){
          console.log("Hope to see you back at the home page soon!");
      // Or if you just want an enter route, don't pass in an obj
    , "some/thing/else": function(){
        // Access the instantiated router object via:
        this._router.navigate("weeeee"); // Redirect to weeeee
      // Standard variables
    , "users/:userId/profiles/:profileType": function(userId, profileType){
        console.log("User:", userId, "Profile:", profileType);
      // Paper Boy enter and exit routes share their 'this' objects
    , "weeeee": {
        enter: function(){
          this.hello = "Hello World!!!";
      , exit: function(){
          console.log(this.hello); // "Hello World!!!"

##Hey, this doesn't work in Internet Explorer!

I don't give a damn.


Simple routing system for capable browsers


You can’t perform that action at this time.