MCPcopy Create free account
hub / github.com/tree-sitter/tree-sitter-javascript / addGetHookIf

Function addGetHookIf

examples/jquery.js:5570–5587  ·  view source on GitHub ↗
( conditionFn, hookFn )

Source from the content-addressed store, hash-verified

5568
5569
5570function addGetHookIf( conditionFn, hookFn ) {
5571 // Define the hook, we'll check on the first run if it's really needed.
5572 return {
5573 get: function() {
5574 if ( conditionFn() ) {
5575 // Hook not needed (or it's not possible to use it due to missing dependency),
5576 // remove it.
5577 // Since there are no other hooks for marginRight, remove the whole object.
5578 delete this.get;
5579 return;
5580 }
5581
5582 // Hook needed; redefine it so that the support test is not executed again.
5583
5584 return (this.get = hookFn).apply( this, arguments );
5585 }
5586 };
5587}
5588
5589
5590(function() {

Callers 1

jquery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…