A List.js plugin is basically a function/class which returns a object on initialization.
list.awesomething.js
function ListAwesomething() {
options = options || {};
return {
init: function(list) {
// This method is called on initialization
},
name: options.name || "awesomething",
customMethod: function() {
return "cowabunga";
}
};
};
<script src="list.js"></script>
<script src="list.awesomething.js"></script>
<script>
var myList = new List('my-list', {
plugins: ListAwesomething()
});
myList.awesomething.customMethod(); // cowabunga
</script>
list.awesomething.js
(no dash, camelcase or anything)
and the function/class have to be namned ListAwesomeThing
(camelcase but no dash anything else).
init
method.name
attribute that defaults to the plugin name.