Giter VIP home page Giter VIP logo

Comments (4)

Ziv-Barber avatar Ziv-Barber commented on July 20, 2024

Sorry about the late response....
You can also pass a callback:

var officegen = require('officegen');

var pptx = officegen ({
'type': 'pptx', // or 'xlsx', etc
'onend': function ( written ) {
console.log ( 'Finish to create a PowerPoint file.\nTotal bytes
created: ' + written + '\n' );
},
'onerr': function ( err ) {
console.log ( err );
}
});

On Wed, Oct 23, 2013 at 7:59 PM, Seth Pollack [email protected]:

Right now i have to listen on the finalize event to know when a pptx has
been written out. it would be great to be able to pass a callback instead
to generate. The reason is that i'm writing using streamline (
https://github.com/Sage/streamlinejs) and it doesn't mesh well with event
emitters. I wrote a wrapper for now that listens for the events, and maps
it into a callback.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7
.

from officegen.

spollack avatar spollack commented on July 20, 2024

Thanks, i did see that. The issue is that the lifecycle is a bit atypical here. I call var pptx = officegen (...), which returns synchronously, then i do arbitrary work to build all my slides, then only when i call pptx.generate(...) does the onend callback from that first call fire (asynchronously). typically this callback would be associated with the generate call, since that is where the async work happens, not the officegen call. If it was set up that way, it would be a smoother integration for me.

That said, i've already written a wrapper, so this is low priority, you can fix or close as you see fit ;-) Thanks!

from officegen.

Ziv-Barber avatar Ziv-Barber commented on July 20, 2024

Please use the last commit, you can now pass the finalize callback to generate()

from officegen.

spollack avatar spollack commented on July 20, 2024

great, thanks!

from officegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.