(function(enyo, scope){
/**
* _enyo.Once_ returns a function that will only be executed one time no matter
* how many times it was called.
*
* borrowed from underscore
*
* @class enyo.Once
* @public
*/
//shortcuts
var ArrayProto = Array.prototype;
var slice = ArrayProto.slice;
/**
* returns a function that will be executed before N times.
*
* @method
* @type {Function}
* @private
*/
var before = function(times, func) {
var memo;
return function() {
if (--times > 0) {
memo = func.apply(this, arguments);
}
else func = null;
return memo;
};
};
/**
* returns a partially applied function, without changing it's 'this' context
*
* @method
* @type {Function}
* @private
*/
var partial = function(func) {
var boundArgs = slice.call(arguments, 1);
return function() {
var position = 0;
var args = boundArgs.slice();
for (var i = 0, length = args.length; i < length; i++) {
if (args[i] === enyo) args[i] = arguments[position++];
}
while (position < arguments.length) args.push(arguments[position++]);
return func.apply(this, args);
};
};
/**
* Returns a function that will only be executed once reguardless of how many times it is called.
*
* @method
* @type {Function}
* @public
*/
enyo.Once = enyo.Once || partial(before, 2);
}(enyo, this));
(function(enyo, scope){
//load share this on the page
var loadShareThis = enyo.Once(function(callback) {
enyo.load('//w.sharethis.com/button/buttons.js',
callback
);
});
var checkShareThis = function(callback) {
//poll to see if sharethis was loaded on the page
loadShareThis(callback);
var pollShareThisId =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.