Every repository with this icon (
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu Sep 03 20:51:56 -0700 2009 | |
| |
.gitmodules | Sat Sep 26 14:56:34 -0700 2009 | |
| |
HISTORY | Wed Dec 09 16:04:23 -0800 2009 | |
| |
LICENSE | Mon May 11 07:56:20 -0700 2009 | |
| |
README.md | Thu Dec 10 06:55:46 -0800 2009 | |
| |
Rakefile | Wed Dec 09 15:54:23 -0800 2009 | |
| |
examples/ | Sat Sep 26 13:11:09 -0700 2009 | |
| |
lib/ | Wed Dec 09 15:54:23 -0800 2009 | |
| |
site - c753df3 | Wed Dec 09 15:54:23 -0800 2009 | |
| |
test/ | Wed Dec 09 14:10:02 -0800 2009 | |
| |
vendor/ | Wed Dec 09 15:41:27 -0800 2009 |
Sammy
Description
Sammy is a tiny javascript framework built on top of jQuery inspired by Ruby's Sinatra.
Installation
Download sammy.js and install it in your public javascripts directory. Include it in your document AFTER jquery.
Usage
Like Sinatra, a Sammy application revolves around 'routes'. Routes in Sammy are a little different, though. Not only can you define 'get' and 'post' routes, but you can also bind routes to custom events triggered by your application.
You set up a Sammy Application by passing a Function to the $.sammy (which is a shortcut for the Sammy.Application constructor).
$.sammy(function() {
this.get('#/', function() {
$('#main').text('Welcome!');
});
});
Inside the 'app' function() this is the Application. This is where you can configure the application and add routes.
Above, we defined a get() route. When the browser is pointed to #/ the function passed to that route will be run. Inside the route function, this is a Sammy.EventContext. EventContext has a bunch of special methods and properties including a params hash, the ability to redirect, render partials, and more.
Once you've defined an application the only thing left to do is run it. The best-practice behavior is to encapulate run() in a document.ready block:
var app = $.sammy(...)
$(function() {
app.run();
});
This will guarantee that the DOM is loaded before we try to apply functionality to it.
Dependencies
Sammy requires jQuery >= 1.3.2 Get it from: http://jquery.com
More!
Learn!
Keep informed!
Authors
Sammy.js was created and is maintained by Aaron Quint with additional features and fixes contributed by these talented individuals:
- Frank Prößdorf (endor)
- Scott McMillin
- ZhangJinzhu
- Jesse Hallett
- Jonathan Vaught <jonathan.vaught at gmail.com>
- Jesse Hallett <jesse.hallett at jivesoftware.com>
- Jason Davies
- Russell Jones
- Geoff Longman
License
Sammy is covered by the MIT License. See LICENSE for more information.
Sammy includes code originally created by John Resig (Class implementation) and Greg Borenstien (srender).







