Created
July 11, 2013 09:51
-
-
Save tilleps/5974119 to your computer and use it in GitHub Desktop.
CanJS jQuery.fn.control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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