-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update README.md #274
Open
Mshale254
wants to merge
1
commit into
quirkey:master
Choose a base branch
from
Mshale254:patch-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update README.md #274
Commits on Jul 27, 2024
-
# mshale [http://sammyjs.org](http://sammyjs.org) ## Description Sammy is a tiny javascript framework built on top of jQuery inspired by Ruby's [Sinatra](http://sinatrarb.com). ## 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. In its coolness, Sammy can handle multiple chained asynchronous callbacks on a route. this.get('#/', function(context,next) { $('#main').text('Welcome!'); $.get('/some/url',function(){ // save the data somewhere next(); }); }, function(context,next) { $.get('/some/other/url',function(){ // save this data too next(); }); }); Once you've defined an application the only thing left to do is run it. The best-practice behavior is to encapsulate `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.4.1 Get it from: [http://jquery.com](http://jquery.com) ## More! ### Learn! * [Intro](http://code.quirkey.com/sammy) * [Docs](http://code.quirkey.com/sammy/docs/) * [Examples](http://github.com/quirkey/sammy/tree/master/examples/) * [More Resources on the Sammy Wiki](http://github.com/quirkey/sammy/wiki/) ### Keep informed! * [Follow @sammy_js](http://twitter.com/sammy_js) * [Join the mailing list](http://groups.google.com/group/sammyjs) * [Chat with us in #sammy](irc://irc.freenode.net/#sammy) ## Authors Sammy.js was created and is maintained by Aaron Quint <aaron at quirkey.com> with additional features and fixes contributed by these talented individuals: * Frank Prößdorf / endor * Alexander Lang / langalex * Scott McMillin / scottymac * ZhangJinzhu / jinzhu * Jesse Hallett / hallettj * Jonathan Vaught / gravelpup * Jason Davies / jasondavies * Russell Jones / CodeOfficer * Geoff Longman * Jens Bissinger / dpree * Tim Caswell / creationix * Mark Needham * SamDeLaGarza * Mickael Bailly / dready92 * Rich Manalang / manalang * Brian Mitchell / binary42 * Assaf Arkin / assaf * James Rosen / jamesrosen * Chris Mytton * kbuckler * dvv * Ben Vinegar / benvinegar * Avi Deitcher / deitch ## Donate! If you're using Sammy.js in production or just for fun, instead of gifting me a beer - please consider donating to the [Code for Other People Fund](http://pledgie.com/campaigns/15239). - you can probably spare a dollar or ten and it will be greatly appreciated. ## License Sammy is covered by the MIT License. See LICENSE for more information. # mshale [http://sammyjs.org](http://sammyjs.org) ## Description Sammy is a tiny javascript framework built on top of jQuery inspired by Ruby's [Sinatra](http://sinatrarb.com). ## 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. In its coolness, Sammy can handle multiple chained asynchronous callbacks on a route. this.get('#/', function(context,next) { $('#main').text('Welcome!'); $.get('/some/url',function(){ // save the data somewhere next(); }); }, function(context,next) { $.get('/some/other/url',function(){ // save this data too next(); }); }); Once you've defined an application the only thing left to do is run it. The best-practice behavior is to encapsulate `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.4.1 Get it from: [http://jquery.com](http://jquery.com) ## More! ### Learn! * [Intro](http://code.quirkey.com/sammy) * [Docs](http://code.quirkey.com/sammy/docs/) * [Examples](http://github.com/quirkey/sammy/tree/master/examples/) * [More Resources on the Sammy Wiki](http://github.com/quirkey/sammy/wiki/) ### Keep informed! * [Follow @sammy_js](http://twitter.com/sammy_js) * [Join the mailing list](http://groups.google.com/group/sammyjs) * [Chat with us in #sammy](irc://irc.freenode.net/#sammy) ## Authors Sammy.js was created and is maintained by Aaron Quint <aaron at quirkey.com> with additional features and fixes contributed by these talented individuals: * Frank Prößdorf / endor * Alexander Lang / langalex * Scott McMillin / scottymac * ZhangJinzhu / jinzhu * Jesse Hallett / hallettj * Jonathan Vaught / gravelpup * Jason Davies / jasondavies * Russell Jones / CodeOfficer * Geoff Longman * Jens Bissinger / dpree * Tim Caswell / creationix * Mark Needham * SamDeLaGarza * Mickael Bailly / dready92 * Rich Manalang / manalang * Brian Mitchell / binary42 * Assaf Arkin / assaf * James Rosen / jamesrosen * Chris Mytton * kbuckler * dvv * Ben Vinegar / benvinegar * Avi Deitcher / deitch ## Donate! If you're using Sammy.js in production or just for fun, instead of gifting me a beer - please consider donating to the [Code for Other People Fund](http://pledgie.com/campaigns/15239). - you can probably spare a dollar or ten and it will be greatly appreciated. ## License Sammy is covered by the MIT License. See LICENSE for more information.
Configuration menu - View commit details
-
Copy full SHA for 2db3b52 - Browse repository at this point
Copy the full SHA 2db3b52View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.