Blame view

app/bower_components/jquery/src/css/addGetHookIf.js 530 Bytes
87c93a029   Dang YoungWorld   add modal
1
2
3
  define( function() {
  
  "use strict";
f986e111b   TRUONG   add libs
4
5
  
  function addGetHookIf( conditionFn, hookFn ) {
87c93a029   Dang YoungWorld   add modal
6

f986e111b   TRUONG   add libs
7
8
9
  	// Define the hook, we'll check on the first run if it's really needed.
  	return {
  		get: function() {
87c93a029   Dang YoungWorld   add modal
10
  			if ( conditionFn() ) {
f986e111b   TRUONG   add libs
11

87c93a029   Dang YoungWorld   add modal
12
13
  				// Hook not needed (or it's not possible to use it due
  				// to missing dependency), remove it.
f986e111b   TRUONG   add libs
14
15
16
17
18
  				delete this.get;
  				return;
  			}
  
  			// Hook needed; redefine it so that the support test is not executed again.
87c93a029   Dang YoungWorld   add modal
19
  			return ( this.get = hookFn ).apply( this, arguments );
f986e111b   TRUONG   add libs
20
21
22
23
24
  		}
  	};
  }
  
  return addGetHookIf;
87c93a029   Dang YoungWorld   add modal
25
  } );