1.0.4 • Published 6 years ago

jquery-pluginify v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

jQuery Pluginify

Convert plugin class into a jQuery plugin

Installation

npm i jquery-pluginify --save

Requires

ES6 Support

Options

NameTypeDescription
namestringPlugin name reference
classnameobjectClass reference
iterateboolDefaults to true.
True - Defines a class for every instance of the elements found.
False - Defines the class just once, and passes all element instances through to the class.
shorthandboolDefaults to false. Generate a shorthand as $.name
ignoreWarningboolDefaults to false. Set to true if you want to ignore the fact the jQuery isn't found at the time of calling this function.

Example

class myClass {
  constructor(elements, ...settings) {
    // console.log(elements, settings);
  }
}

Define default settings to apply to all instances of the class

myClass.settings = {};

Define settings like this:

pluginify('myPlugin', myClass, false, true);

Or like this (in any order):

pluginify({
  name      : 'myPlugin',
  classname : myClass,
  shorthand : false,
  iterate   : true,
});

How it might be used

$('nav ul li').myPlugin({...})

Credit

monkeymonk benjasHu

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1-1

6 years ago

1.0.1

6 years ago

1.0.0-1

6 years ago

1.0.0

6 years ago