JSFiddle - React, Tailwind, and code Playground
JavaScript
//jQuery is load by js fiddle already .
window.$b = $.sub(); //define $b in the begining .
//Note: I don't want to create two script file , using code snippets instead. ;)
//----------pluginA.js-------------------------
(function($,undefined){
$.fn.mask = function (){
$(document.body).append("pluginA mask <br />");
}
})(jQuery);
//----------pluginA.js-------------------------
//----------pluginB.js-------------------------
(function($,undefined){
$.fn.mask = function (){ //jQuery.fn.mask is overwrited again,but it will only apply to sub() one .
$(document.body).append("pluginB mask <br />");
}
})($b); //use the new one to replace the pluging jQuery
//----------pluginB.js-------------------------
$(document.body).mask(); //we don't change the $ reference , so it's origJQuery with mask in pluginA .
$b(document.body).mask(); //it's sub() one, will call the mask in plugingB .