scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 58 Rev 125
1 define( function() { 1 define(function() {
2   -  
3 "use strict"; -  
4   2  
5 function addGetHookIf( conditionFn, hookFn ) { -  
6   3 function addGetHookIf( conditionFn, hookFn ) {
7 // Define the hook, we'll check on the first run if it's really needed. 4 // Define the hook, we'll check on the first run if it's really needed.
8 return { 5 return {
9 get: function() { 6 get: function() {
10 if ( conditionFn() ) { 7 if ( conditionFn() ) {
11   -  
12 // Hook not needed (or it's not possible to use it due 8 // Hook not needed (or it's not possible to use it due
13 // to missing dependency), remove it. 9 // to missing dependency), remove it.
14 delete this.get; 10 delete this.get;
15 return; 11 return;
16 } 12 }
17   13  
18 // Hook needed; redefine it so that the support test is not executed again. 14 // Hook needed; redefine it so that the support test is not executed again.
19 return ( this.get = hookFn ).apply( this, arguments ); 15 return (this.get = hookFn).apply( this, arguments );
20 } 16 }
21 }; 17 };
22 } 18 }
23   19  
24 return addGetHookIf; 20 return addGetHookIf;
25   21  
26 } ); 22 });
27   23