Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
interval = setInterval(function() {
if (! ids.length) {
clearInterval(interval);
allRequestsSent.resolve(requests);
return;
}
var id = ids.shift();
var dfd = deferred();
najax.get(itemAPI.replace('{{itemId}}', id), function(resp) {
dfd.resolve(JSON.parse(resp));
});
requests.push(dfd.promise);
}, 500);
var getFrontPageStories = function(cb) {
najax.get(topStoriesAPI).then(function(resp, status) {
var top = status === "success" ? JSON.parse(resp) : [];
var top = top.slice(0, 30);
cb(top);
});
};
can.ajax = function(args){
if(typeof args === "string") {
args = { url: args };
}
args.url = base + args.url;
arguments[0] = args;
return najax.apply(this, arguments);
};
STK.util.post = function(opts) {
opts = STK.util.__prepareAjaxOpts(opts);
return najax.post(opts);
};
STK.util.param = require('jquery-param');