var pluginsAsExternals = {
'jquery': 'jQuery',
'./foundation.core': '{Foundation: window.Foundation}',
- './foundation.util.core' : '{rtl: window.Foundation.rtl, GetYoDigits: window.Foundation.GetYoDigits, transitionend: window.Foundation.transitionend, RegExpEscape: window.Foundation.RegExpEscape}',
+ './foundation.util.core' : '{rtl: window.Foundation.rtl, GetYoDigits: window.Foundation.GetYoDigits, transitionend: window.Foundation.transitionend, RegExpEscape: window.Foundation.RegExpEscape, onLoad: window.Foundation.onLoad}',
'./foundation.util.imageLoader' : '{onImagesLoaded: window.Foundation.onImagesLoaded}',
'./foundation.util.keyboard' : '{Keyboard: window.Foundation.Keyboard}',
'./foundation.util.mediaQuery' : '{MediaQuery: window.Foundation.MediaQuery}',
Foundation.GetYoDigits = CoreUtils.GetYoDigits;
Foundation.transitionend = CoreUtils.transitionend;
Foundation.RegExpEscape = CoreUtils.RegExpEscape;
+Foundation.onLoad = CoreUtils.onLoad;
Foundation.Box = Box;
Foundation.onImagesLoaded = onImagesLoaded;
// These are now separated out, but historically were a part of this module,
// and since this is here for backwards compatibility we include them in
// this entry.
-import {rtl, GetYoDigits, transitionend, RegExpEscape} from '../../foundation.util.core';
+import {rtl, GetYoDigits, transitionend, RegExpEscape, onLoad} from '../../foundation.util.core';
Foundation.rtl = rtl;
Foundation.GetYoDigits = GetYoDigits;
Foundation.transitionend = transitionend;
Foundation.RegExpEscape = RegExpEscape;
+Foundation.onLoad = onLoad;
// Every plugin depends on plugin now, we can include that on the core for the
// script inclusion path.
}
}
-export {rtl, GetYoDigits, RegExpEscape, transitionend};
+/**
+ * Call the given function once the window is loaded,
+ * or immediately if the window is already loaded.
+ * @function
+ *
+ * @param {Function} fn - function to call on window load.
+ */
+function onLoad(fn) {
+ if (document.readyState === 'complete')
+ setTimeout(() => fn(), 0);
+ else
+ $(window).one('load', () => fn());
+}
+
+export {rtl, GetYoDigits, RegExpEscape, transitionend, onLoad};
name.should.be.a('string');
name.should.be.equal('');
});
-
+
it('should handle a named function expression', function() {
var D = function foo(){};
var name = Foundation.getFnName(D);
name.should.be.equal('foo');
});
});
-
+
describe('transitionEnd()', function() {
});
+ describe('onLoad()', function (done) {
+ });
+
describe('throttle()', function() {
});
});