MCPcopy Create free account
hub / github.com/JsAaron/jQuery / addGetHookIf

Function addGetHookIf

2.1.1/test/other.js:2976–2993  ·  view source on GitHub ↗
( conditionFn, hookFn )

Source from the content-addressed store, hash-verified

2974
2975
2976function addGetHookIf( conditionFn, hookFn ) {
2977 // Define the hook, we'll check on the first run if it's really needed.
2978 return {
2979 get: function() {
2980 if ( conditionFn() ) {
2981 // Hook not needed (or it's not possible to use it due to missing dependency),
2982 // remove it.
2983 // Since there are no other hooks for marginRight, remove the whole object.
2984 delete this.get;
2985 return;
2986 }
2987
2988 // Hook needed; redefine it so that the support test is not executed again.
2989
2990 return (this.get = hookFn).apply( this, arguments );
2991 }
2992 };
2993}
2994
2995
2996(function() {

Callers 1

other.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected