| 6817 | |
| 6818 | |
| 6819 | function addGetHookIf( conditionFn, hookFn ) { |
| 6820 | |
| 6821 | // Define the hook, we'll check on the first run if it's really needed. |
| 6822 | return { |
| 6823 | get: function() { |
| 6824 | if ( conditionFn() ) { |
| 6825 | |
| 6826 | // Hook not needed (or it's not possible to use it due |
| 6827 | // to missing dependency), remove it. |
| 6828 | delete this.get; |
| 6829 | return; |
| 6830 | } |
| 6831 | |
| 6832 | // Hook needed; redefine it so that the support test is not executed again. |
| 6833 | return ( this.get = hookFn ).apply( this, arguments ); |
| 6834 | } |
| 6835 | }; |
| 6836 | } |
| 6837 | |
| 6838 | |
| 6839 | var |