Skip to content

Commit

Permalink
Improved $.callback(), it accepts another instance of $.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Jul 7, 2024
1 parent 2da3ebd commit 6fe1fe6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion builders.js
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,16 @@ ActionCaller.prototype.finish = function(value) {
var self = this;
self.finish = null;
if (self.options.callback) {
self.options.callback(self.error.length ? self.error : null, value === undefined ? self.$.response : value);

if (self.options.callback instanceof Options) {
let $ = self.options.callback;
if (self.error.length)
$.invalid(self.error);
else
$.callback(value === undefined ? self.$.response : value);
} else
self.options.callback(self.error.length ? self.error : null, value === undefined ? self.$.response : value);

self.options.callback = null;
}
};
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- added `FILESTORAGE().copy(id, path, [callback(err, meta)])`
- fixed formatting `0` number in the `Tangular.format` helper
- improved `$.invalid()` method, now it returns `ErrorBuilder`
- improved `$.callback()`, it accepts another instance of `$`

========================
0.0.3
Expand Down

0 comments on commit 6fe1fe6

Please sign in to comment.