javascript - Node sequelize callback promises expect a function, is there a method for removing declared function with a function call -
i'm having issue node sequelize library. when using success promise shown below:
for (index = 0; index < models.length; index++) { model = models[index]; model.drop().success(function() { droptablecompletecheck(); }); }
jshint complains , rightly highlights code issue "don't make functions within loop". overcome issue i've tried replacing above code following:
for (index = 0; index < models.length; index++) { model = models[index]; model.drop().success(droptablecompletecheck()); }
this removes jshint issue, node sequelize throwing following uncaught exception:
error: uncaught application error: typeerror: listener must function
i'm trying call function on success promise callback, , remove jshint issue @ same time. there way of doing both, i'd happy pointers.
thanks time.
omit parentheses:
for (index = 0; index < models.length; index++) { model = models[index]; //don't _invoke_ droptablecompletecheck, _reference_ model.drop().success(droptablecompletecheck); }
Comments
Post a Comment