c5b2717ea840ce1ccc295f5e4358adfc3386901323cc9e26e73ee27865c18603ae2a56bc031b2f725c022bbc7427a0d4ead4b3e9ca3bb0fa25a8756e2fd4b8 530 B

1234567891011121314151617181920212223242526
  1. define( function() {
  2. "use strict";
  3. function addGetHookIf( conditionFn, hookFn ) {
  4. // Define the hook, we'll check on the first run if it's really needed.
  5. return {
  6. get: function() {
  7. if ( conditionFn() ) {
  8. // Hook not needed (or it's not possible to use it due
  9. // to missing dependency), remove it.
  10. delete this.get;
  11. return;
  12. }
  13. // Hook needed; redefine it so that the support test is not executed again.
  14. return ( this.get = hookFn ).apply( this, arguments );
  15. }
  16. };
  17. }
  18. return addGetHookIf;
  19. } );