The act of converting content from its original format into a format capable of being displayed on the web
Manage Multiple WordPress Sites

Simple JavaScript routing with HTML5′s PushState – Davis.js

Davis.js is a JavaScript library that allows using Sinatra-style routing for web apps.

It uses HTML5′s new History/State API – PushState extensively, allowing vast amounts of code reuse.

Davis.js Simple JavaScript routing with HTML5s PushState   Davis.jsYou can define your app like this:

 var app = Davis(function () {
          this.get('/welcome/:name', function (req) {
            alert("Hello " + req.params['name'])
          })
        })
        app.start()

And set the routing links like this:

<a href="/welcome/oliver">greet oliver</a>
        <a href="/welcome/bob">greet bob</a>

Pretty neat, huh?

If HTML5.PushState isn’t supported, davis.js falls back to normal form behavior so that the server can still work with the forms.

Davis even has some plugins, for example, you can track all davis.js requests with Google Analytics.

Manage WordPress Blogs

Comments: