mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
f75daab091
The `default` export is treated differently across tooling when transpiled to CommonJS - tools differ on whether `module.exports` represents the full module object or just its default export. Switch `src/` modules to named exports for tooling consistency. Fixes gh-5262 Closes gh-5292
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { jQuery } from "./core.js";
|
|
import { slice } from "./var/slice.js";
|
|
|
|
import "./deprecated/ajax-event-alias.js";
|
|
import "./deprecated/event.js";
|
|
|
|
// Bind a function to a context, optionally partially applying any
|
|
// arguments.
|
|
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
|
|
// However, it is not slated for removal any time soon
|
|
jQuery.proxy = function( fn, context ) {
|
|
var tmp, args, proxy;
|
|
|
|
if ( typeof context === "string" ) {
|
|
tmp = fn[ context ];
|
|
context = fn;
|
|
fn = tmp;
|
|
}
|
|
|
|
// Quick check to determine if target is callable, in the spec
|
|
// this throws a TypeError, but we will just return undefined.
|
|
if ( typeof fn !== "function" ) {
|
|
return undefined;
|
|
}
|
|
|
|
// Simulated bind
|
|
args = slice.call( arguments, 2 );
|
|
proxy = function() {
|
|
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
|
|
};
|
|
|
|
// Set the guid of unique handler to the same of original handler, so it can be removed
|
|
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
|
|
|
|
return proxy;
|
|
};
|
|
|
|
jQuery.holdReady = function( hold ) {
|
|
if ( hold ) {
|
|
jQuery.readyWait++;
|
|
} else {
|
|
jQuery.ready( true );
|
|
}
|
|
};
|
|
|
|
export { jQuery, jQuery as $ };
|