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

Callback for output method #27

Closed
kolomiec opened this issue May 12, 2014 · 8 comments
Closed

Callback for output method #27

kolomiec opened this issue May 12, 2014 · 8 comments

Comments

@kolomiec
Copy link

Could you please add callback for output method because fs.writeFile is async.

output = function(download, name, callback) {
                        var result;
                        if (download == null) {
                            download = true;
                        }
                        if (name == null) {
                            name = "output.docx";
                        }

                        this.calcZip();
                        result = this.zip.generate();
                        if (download) {
                            if (env === 'node') {
                                fs.writeFile(process.cwd() + '/' + name, result, 'base64', function(err) {
                                    if (err) {
                                        throw err;
                                    }
                                    if (callback) {
                                        callback();
                                    }
                                    return console.log('file Saved');
                                });
                            } else {
                                document.location.href = "data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64," + result;
                            }
                        }
                        return result;
                    };
@edi9999
Copy link
Member

edi9999 commented May 12, 2014

Done.

You would have to pull it from the git repository, npm has not been updated.

See the docs in the readme for more information

@edi9999 edi9999 closed this as completed May 12, 2014
@kolomiec
Copy link
Author

Thanks, great job!

2014-05-12 12:07 GMT+03:00 edi9999 notifications@github.com:

Closed #27 #27.


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#event-120026495
.

Best regards, Sergey Kolomiec

Java for Web and Java for Android developer

Cherkassy, Ukraine

skype user: kolomiec_sergey_karpovich

Mobile: +380 (96) 84-73-594

@kolomiec
Copy link
Author

Hey, you use
if (options.callback != null) {
return callback();
}

but you should use

        if (options.callback != null) {
          return options.callback();
        }

Please update.

2014-05-12 12:48 GMT+03:00 Sergey Kolomiec kolomiecsergeyk@gmail.com:

Thanks, great job!

2014-05-12 12:07 GMT+03:00 edi9999 notifications@github.com:

Closed #27 #27.


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#event-120026495
.

Best regards, Sergey Kolomiec

Java for Web and Java for Android developer

Cherkassy, Ukraine

skype user: kolomiec_sergey_karpovich

Mobile: +380 (96) 84-73-594

Best regards, Sergey Kolomiec

Java for Web and Java for Android developer

Cherkassy, Ukraine

skype user: kolomiec_sergey_karpovich

Mobile: +380 (96) 84-73-594

@edi9999
Copy link
Member

edi9999 commented May 12, 2014

solved

@kolomiec
Copy link
Author

Thanks!

2014-05-12 17:02 GMT+03:00 edi9999 notifications@github.com:

solved


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-42835380
.

Best regards, Sergey Kolomiec

Java for Web and Java for Android developer

Cherkassy, Ukraine

skype user: kolomiec_sergey_karpovich

Mobile: +380 (96) 84-73-594

@kolomiec
Copy link
Author

Hey, I have sent you pull request. Please apply it

@kolomiec
Copy link
Author

Hey, should I write some coffe script?

Best regards, Sergey Kolomiec

Java for Web and Java for Android developer

Cherkassy, Ukraine

skype user: kolomiec_sergey_karpovich

Mobile: +380 (96) 84-73-594

@edi9999
Copy link
Member

edi9999 commented May 22, 2014

Hi @kolomiec,

yes, I have answered you there: #32

Please use that link #32 and not this issue to talk about the pull request

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