comparison default/node_modules/jquery/src/css/addGetHookIf.js @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 define( function() {
2
3 "use strict";
4
5 function addGetHookIf( conditionFn, hookFn ) {
6
7 // Define the hook, we'll check on the first run if it's really needed.
8 return {
9 get: function() {
10 if ( conditionFn() ) {
11
12 // Hook not needed (or it's not possible to use it due
13 // to missing dependency), remove it.
14 delete this.get;
15 return;
16 }
17
18 // Hook needed; redefine it so that the support test is not executed again.
19 return ( this.get = hookFn ).apply( this, arguments );
20 }
21 };
22 }
23
24 return addGetHookIf;
25
26 } );