Knockout Application
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Knockout Application

Knockout Application aims to be the glue linking all the features of a modern web application, like routing URLs, session management, template rendering, and off course, data bindings.

It should avail existing libraries as much as possible and provide an easy and familiar API to its users.

It's currently in very early stages of development, but already works, and should become a great tool to build killer apps.



In your HTML:

<!doctype html>
  <meta charset="utf-8">
  <title> example</title>

<div data-bind="app"></div>

<script src="knockout.js"></script>
<script src="jquery.js"></script>
<script src="way.js"></script>

<script src="../"></script>

<script> {'#/hello/:name', function(context) { = ko.observable(;

    this.root = '#/hello/world';;


In your template /templates/hello.html:

<p>Hello, <span data-bind="text: name"></span></p>

Now open index.html in your browser. Try changing world to your name, it works!

You can see a working version of this example in the example/ directory.

Also I've included another example to demo the usage of requirejs, as suggested by @adimkov.


Note that inside your application's constructor you can access app by this.

map(pattern, action[, action[, ...]])

Register new route. Actions may return true to keep chaining the next action. Also within the action this refers to the application.

session(name[, value])

Retrieve session variable when value is omitted, or update it with given value. Also value may be null to delete session variable.


Redirect user to given location, aware of hash or external redirections.


Render given template and bind current context to it. Template files must be in templates/ directory and must use .html extension.


Match and dispatch an action based on current location.


Listen to hash changes with fallback to polling.


Setup and initialize your application.


  • Session management
  • Custom settings (like template directory)