Skip to content

Instantly share code, notes, and snippets.

@tilleps
Created July 11, 2013 09:51
Show Gist options
  • Save tilleps/5974119 to your computer and use it in GitHub Desktop.
Save tilleps/5974119 to your computer and use it in GitHub Desktop.
CanJS jQuery.fn.control
//
// CanJS jQuery.fn.control
//
// http://canjs.com/docs/jQuery.fn.control.html
//
// The jQuery.fn.control method do not appear to work with string parameter
//
//
// Define Plugin
//
var MyPlugin = can.Control.extend({
pluginName: 'MyPlugin'
}, {});
// init plugin
$('body').MyPlugin();
//
// Attempt to get defined plugin
//
$('body').control(); // returns MyPlugin
$('body').control(); // returns MyPlugin
$('body').control(MyPlugin); // returns MyPlugin
$('body').control('MyPlugin'); // returns undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment