0

Is this plugin pattern a good one ?

http://jsbin.com/isobar/12/edit

My goal was to have a global variable for each instance of the plugin, base, and the ability to call the same extern and intern method.

$('.my-plugin').myPlugin('myMethod', 'argument1', 'argument2');
or
base.myMethod('argument1', 'argument2');

Is there any specific compatibility problem or javascript errors?

4

1 回答 1

1

使用jQuery Boilerplate并阅读这个jQuery 插件模板 - 最佳实践、约定、性能和内存影响。

然后从这个精彩的视频开始:jQuery 插件开发。

于 2013-03-26T09:21:37.433 回答