| CARVIEW |
Every repository with this icon (
Every repository with this icon (
| Description: | Sammy is a tiny javascript framework built on top of jQuery inspired by Ruby's Sinatra. |
| Homepage: | https://code.quirkey.com/sammy |
| Clone URL: |
git://github.com/quirkey/sammy.git
Give this clone URL to anyone.
git clone git://github.com/quirkey/sammy.git
|
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon May 11 12:14:23 -0700 2009 | Ignore _site [quirkey] |
| |
.gitmodules | Mon Mar 23 20:38:32 -0700 2009 | Extracted test style into jqunit-spec, vendored [quirkey] |
| |
LICENSE | Mon May 11 07:56:20 -0700 2009 | Added MIT License. Also first draft of README [quirkey] |
| |
README.md | Sun May 17 15:40:38 -0700 2009 | Updated Readme to include links to mailing list... [quirkey] |
| |
Rakefile | Sun May 17 21:09:53 -0700 2009 | Added Rakefile for easy minify-ing. Re minified [quirkey] |
| |
examples/ | Fri May 15 22:22:44 -0700 2009 | Added note about todos stored in memory [quirkey] |
| |
lib/ | Sun May 17 21:09:53 -0700 2009 | Added Rakefile for easy minify-ing. Re minified [quirkey] |
| |
test/ | Sun May 17 20:46:27 -0700 2009 | Fixed test runner in Safari. More whitespace cl... [quirkey] |
| |
vendor/ | Mon May 04 08:37:01 -0700 2009 | Updated jqunit-spec [quirkey] |
Sammy
https://code.quirkey.com/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() { with(this) {
get('#/', function() { with(this) {
$('#main').text('Welcome!');
}});
}});
Inside of 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 of 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 guaruntee that the DOM is loaded before we try to apply functionality to it.
Dependencies
Sammy requires jQuery > 1.3.2 Get it from: https://jquery.com
More!
Learn!
Keep informed!
License
Sammy is covered by the MIT License. See LICENSE for more information.
Sammy includes code originaly created by John Resig (Class implementation) and Greg Borenstien (srender).







