Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created May 12, 2010 18:59
Show Gist options
  • Save ryanflorence/398999 to your computer and use it in GitHub Desktop.
Save ryanflorence/398999 to your computer and use it in GitHub Desktop.
// assuming #jack is an element
// and our samurai class takes
// a jQuery selector for the first
// argument in the initialize method
// instantiate a class instance
$('#jack').samurai(); // new Samurai('#jack')
// call a method
$('#jack').samurai('eat') // jack.eat()
// get a property
$('#jack').samurai('isAlive'); // jack.isAlive
// set a property
$('#jack').samurai('kills', 2); // jack.kills = 2
// chain stuff
$('#jack').samurai('attack', bob).animate().css();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment