Code Monkey home page Code Monkey logo

Comments (11)

ccpandhare avatar ccpandhare commented on July 20, 2024 1

I think it would be better to have a syntax like

sequencer.run(function(out){
    //do something with "out"
});

Where out is the output of final module.
There won't be any issue of order in this way.

Giving run a return value may not work, as run is more of an asynchronous function.
Also, it will render run unchainable thereafter (run is usually the last method, but still)

from image-sequencer.

ccpandhare avatar ccpandhare commented on July 20, 2024

from image-sequencer.

jywarren avatar jywarren commented on July 20, 2024

from image-sequencer.

ccpandhare avatar ccpandhare commented on July 20, 2024

run() already accepts a callback function. I think an onComplete type syntax could actually work wonders.

sequencer.run().onComplete(funnction(out){
    //do something with "out"
});

from image-sequencer.

jywarren avatar jywarren commented on July 20, 2024

from image-sequencer.

ccpandhare avatar ccpandhare commented on July 20, 2024

Thanks a lot for pointing that out!
I don't know how I missed that there.
Looks like I need to make quite a few changes to the Readme. Will open a PR for that tomorrow.

As for the return issue, I will look into the applications, benefits and shortcomings of each of the methods discussed here and will come up with a solution by tomorrow.

from image-sequencer.

jywarren avatar jywarren commented on July 20, 2024

from image-sequencer.

jywarren avatar jywarren commented on July 20, 2024

yes re: unchainable, but that's OK!

from image-sequencer.

ccpandhare avatar ccpandhare commented on July 20, 2024

No, I'd like to clear myself here.
This will work and allow chaining, and this is what we should do:

sequencer.run(function(out){
    // do something
});

This will neither work nor allow chaining:

function run() {
...
return this; // this refers to the sequencer here
}

So I will start working on the first one right away.

from image-sequencer.

jywarren avatar jywarren commented on July 20, 2024

oh huh, great!

from image-sequencer.

ccpandhare avatar ccpandhare commented on July 20, 2024

Fixed in #47

from image-sequencer.

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.