Created
September 29, 2011 14:31
-
-
Save outbounder/1250846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var allCount = items.length; | |
var handleSave = function(err) { | |
if(err) { | |
allCount = 0; // this will prevent sending success: true if invoked again... | |
res.send({ success: false, msg: err}, 400); | |
return; | |
} | |
allCount -= 1; | |
if(allCount == 0) { | |
res.send({ success: true }); | |
} | |
} | |
for(var item=0;item<items.length;item++) | |
{ | |
var bundleTextItem = new global.BundleTextItem(); | |
bundleTextItem.key = items[item].key; | |
bundleTextItem.value = ""; | |
bundleTextItem.language = langForAdding; | |
bundleTextItem.bundlename = req.param("bundlename"); | |
bundleTextItem.save(function(err, bundleTextItem){ | |
handleSave(err); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment