MCPcopy Create free account
hub / github.com/frank-lam/fullstack-tutorial / addGetHookIf

Function addGetHookIf

notes/docsify/unpkg/gotop/jquery-2.1.0.js:5524–5541  ·  view source on GitHub ↗
( conditionFn, hookFn )

Source from the content-addressed store, hash-verified

5522
5523
5524function addGetHookIf( conditionFn, hookFn ) {
5525 // Define the hook, we'll check on the first run if it's really needed.
5526 return {
5527 get: function() {
5528 if ( conditionFn() ) {
5529 // Hook not needed (or it's not possible to use it due to missing dependency),
5530 // remove it.
5531 // Since there are no other hooks for marginRight, remove the whole object.
5532 delete this.get;
5533 return;
5534 }
5535
5536 // Hook needed; redefine it so that the support test is not executed again.
5537
5538 return (this.get = hookFn).apply( this, arguments );
5539 }
5540 };
5541}
5542
5543
5544(function() {

Callers 1

jquery-2.1.0.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected