scratch – Diff between revs 58 and 125

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 58 Rev 125
Line 1... Line 1...
1 define( function() { 1 define(function() {
2   -  
3 "use strict"; -  
Line 4... Line 2...
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() ) { -  
11   7 if ( conditionFn() ) {
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;
Line 16... Line 12...
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 }
Line 21... Line 17...
21 }; 17 };
Line 22... Line 18...
22 } 18 }