Tag: js amd

jQuery插件+ AMD =如何访问函数?

我正在AMD环境中包装我的jQuery插件。 这是我的样板, !function(root, factory) { if (typeof define === ‘function’ && define.amd) { define([‘jquery’], factory); } else { factory(root.jQuery); } }(this, function($) { var defaults = { target: ” }; var myPlugin = function(options) { options = $.extend(true, {}, defaults, options); return options; }; myPlugin.prototype = { init: function(options) { return options; } }; $.fn.myPlugin […]