scratch – Diff between revs 58 and 125
?pathlinks?
Rev 58 | Rev 125 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | define( function() { |
1 | define(function() { |
|
Line 2... | Line -... | |||
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() ) { |
- | ||
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; |