gfranko / jq-boilerplate Goto Github PK
View Code? Open in Web Editor NEWBoilerplate code to help build stateful jQuery widgets.
Home Page: http://www.jqboilerplate.com
Boilerplate code to help build stateful jQuery widgets.
Home Page: http://www.jqboilerplate.com
The _callbackSupport() realization requires the plugin obj to be stored in the element's data.
callback.call(self.$element.data(dataName), self.$element);
but according tho this
// Instantiates a new `Plugin` object and creates the plugin
plugin = new Plugin(this, options, dataName).create();
/*
Stores the new `Plugin` object in the calling element's
jQuery `data` method
*/
$.data(element[0], dataName, plugin);
when create is called, data is still not filled.
Therefore all callbacks originating from "create" will get empty context.
Found your plugin boilerplate searching wildly for how to provide an API so other programmers can add custom callbacks.
I'm still green regarding custom/namespaced events. You provide a private space for it, but i'm not sure what to do with it. A brief explanation:
My plugin builds on top of jQueryUI's Menu widget. It adds an activator button, hides the menu, and when the button is clicked it toggles visibility of the menu. Seems simple enough. But i wanted to use it in an environment with tables where each menu acts specifically on the data in a given table row. And jQueryUI doesn't provide a lot of sample info on how to give menu items custom callbacks. Also, when one menu is opened, others on the page should hide, etc...
So i have a working plugin, but i decided to see if i could clean it up with your boilerplate & want to know more about utilizing _events()
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.