X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fgeedmo%2Fyamm3%2Fdemo%2Fcomponents%2Fjquery%2Fsrc%2Fcss%2FaddGetHookIf.js;fp=vendor%2Fgeedmo%2Fyamm3%2Fdemo%2Fcomponents%2Fjquery%2Fsrc%2Fcss%2FaddGetHookIf.js;h=e12f3598d366e7d2f5d95f553adb0db329f9eac4;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/geedmo/yamm3/demo/components/jquery/src/css/addGetHookIf.js b/vendor/geedmo/yamm3/demo/components/jquery/src/css/addGetHookIf.js new file mode 100644 index 000000000..e12f3598d --- /dev/null +++ b/vendor/geedmo/yamm3/demo/components/jquery/src/css/addGetHookIf.js @@ -0,0 +1,22 @@ +define(function() { + +function addGetHookIf( conditionFn, hookFn ) { + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return (this.get = hookFn).apply( this, arguments ); + } + }; +} + +return addGetHookIf; + +});