cahnory

easyPlug old and new

May 21st, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.easyPlug({
  2.   construct: function (Plugin, element, settings, options) {
  3.     console.log('construct for ', element);
  4.  
  5.     this.methods.foo = function () {
  6.       element.on('foo', function () {
  7.         element.data('foo','bar');
  8.       });
  9.     };
  10.   }
  11. });
  12.  
  13. $.easyPlug({
  14.   construct: function () {
  15.     console.log('construct for ', this.element);
  16.   },
  17.   methods: {
  18.     foo: function () {
  19.       var p = this;
  20.       this.element.on('foo', function () {
  21.         p.element.data('foo','bar');
  22.       });
  23.     }
  24.   }
  25. });
Advertisement
Add Comment
Please, Sign In to add comment