Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async.autoInject callback doesn't work for minified code format #1216

Closed
thatisuday opened this issue Jul 4, 2016 · 4 comments
Closed

async.autoInject callback doesn't work for minified code format #1216

thatisuday opened this issue Jul 4, 2016 · 4 comments

Comments

@thatisuday
Copy link

I am using v2.2.0 on client side.

async.autoInject({
    get_data: function(callback) {
        // async code to get some data
        callback(null, 'data', 'converted to array');
    },
    make_folder: function(callback) {
        // async code to create a directory to store a file in
        // this is run at the same time as getting the data
        callback(null, 'folder');
    },
    write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
        callback(null, 'filename');
    }],
    email_link: ['write_file', function(write_file, callback) {
        callback(null, {'file':write_file, 'email':'user@example.com'});
    }]
    //...
}, ['email_link', function(err, email_link) {
    console.log('err = ', err);
    console.log('email_link = ', email_link);
}]);

This doesn't fire callback but removing last callback with following normal format will do it.

function(err, email_link) {
    console.log('err = ', err);
    console.log('email_link = ', email_link);
}

I guess there is something off there

@thatisuday
Copy link
Author

Also, final callback doesn't provide result of a particular task but final result of the last task that were performed. Below will output same data like email_link.

...
function(err, get_data) {
    console.log(get_data);
}

@aearly
Copy link
Collaborator

aearly commented Jul 4, 2016

Which version are you using exactly? 2.2.0 doesn't exist.

We don't support the array-form for the final callback. The final callback is always of the form function (err, results) {...}, where results is an object of all the results, similar to auto.

@aearly aearly added the question label Jul 4, 2016
@thatisuday
Copy link
Author

thatisuday commented Jul 5, 2016

Sorry, I am using v2.0.0-rc.6. Btw, as from documentation, it says that later parameter in main callback after err are task names whose results you are interested in. But that is not working for me.

@aearly
Copy link
Collaborator

aearly commented Jul 5, 2016

The docs are inaccurate then.

@aearly aearly closed this as completed in f9c3f06 Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants