Skip to content

Instantly share code, notes, and snippets.

@ScalableJS
Last active September 20, 2017 10:32
Show Gist options
  • Save ScalableJS/00a5c3a8632021f04355306dc6ed9395 to your computer and use it in GitHub Desktop.
Save ScalableJS/00a5c3a8632021f04355306dc6ed9395 to your computer and use it in GitHub Desktop.
var whenReady = function (name, context) {
context = context || window;
var def = Deferred(), _value;
Object.defineProperty(context, name, {
configurable: true,
get: function () {
return _value;
},
set: function (value) {
_value = value;
def.resolve();
}
});
return def;
};
//Dom is ready
whenReady('$')
.done(function () {
$(document).ajaxComplete(function (event, xhr, settings) {
var runtime = $.parseJSON(arguments[1].responseText).runtime;
genCampaign();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment