Tree Visitor Async
Visit nodes in the tree asynchronously and sequentially. Support promises.
Asynchronous version of Tree Visitor. Actions can return a promise and .visit()
returns a promise.
API
var fs = ;var Q = ;var VisitorAsync = ;var nodes = type: 'import' value: 'path/to/file1' type: 'import' value: 'path/to/file2' ; {}MyVisitorAsyncprototype = ; MyVisitorAsyncprototype { var deferred = Qdefer; fs; return deferredpromise;}; ;
Methods are passed to the returned promise as fulfill callbacks. So, for example, if a method throws an error or returns a rejected promise, subsequent nodes won't be visited.
this
keyword in the fulfill & reject callbacks refers the created visitor object (e.g., new MyVisitorAsync()
in the previous example).