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

cannot initialize using node #199

Closed
danidev opened this issue Sep 25, 2017 · 3 comments
Closed

cannot initialize using node #199

danidev opened this issue Sep 25, 2017 · 3 comments

Comments

@danidev
Copy link

danidev commented Sep 25, 2017

hello,
I'm using PptxGenJS on a node/express application.
If I use
var pptx = require('pptxgenjs');
in several requests, the ppt is not initialized and adds slides on the same instance.
I saw that in client is possible using new keyword on every instance.
I cannot use the constructor, this doesn't work:
var pptxInstance = new pptx();
How can I create a new instance on every request?
Thanks,
Daniele

@gitbrent
Copy link
Owner

Hi @danidev ,

There's a section in the README that points to Issue #83. Check there to see what the current status of this is.

@danidev
Copy link
Author

danidev commented Sep 26, 2017

thanks @gitbrent
I've found the work-around and I did what suggested by the thread:

var pptxgenjs = require('pptxgenjs');
var pptx = new pptxgenjs.constructor();

Anyway I think it will be better having an initialization function.
if it is a singleton as I read somewhere, it could be an initialize() function without calling the constructor that breaks the pattern usage.
If it is a "static" class, could be a getNewInstance() that return a new object without calling explicitly the constructor.

@gitbrent
Copy link
Owner

Thanks for the feedback @danidev !

Version 2.0 will expose the library in the standard Node fashion and won't require and work-arounds.

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