JSFiddle - React, Tailwind, and code Playground
JavaScript
Obj.prototype.checkDuration = function(arg) {
var next = this.test;
arg.getDuration(function(err, days) {
if (err) throw new Error("Error " + err);
if (days == 0) this.test();
}.bind(this));
}
Obj.prototype.test = function() {
console.log("Done!");
}