proposal-cancelable-promises | Former home of the now-withdrawn cancelable | Storage library

 by   tc39 Shell Version: Current License: Non-SPDX

kandi X-RAY | proposal-cancelable-promises Summary

kandi X-RAY | proposal-cancelable-promises Summary

proposal-cancelable-promises is a Shell library typically used in Storage applications. proposal-cancelable-promises has no bugs, it has no vulnerabilities and it has low support. However proposal-cancelable-promises has a Non-SPDX License. You can download it from GitHub.

Former home of the now-withdrawn cancelable promises proposal for JavaScript
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              proposal-cancelable-promises has a low active ecosystem.
              It has 359 star(s) with 31 fork(s). There are 52 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 64 have been closed. On average issues are closed in 23 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of proposal-cancelable-promises is current.

            kandi-Quality Quality

              proposal-cancelable-promises has no bugs reported.

            kandi-Security Security

              proposal-cancelable-promises has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              proposal-cancelable-promises has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              proposal-cancelable-promises releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of proposal-cancelable-promises
            Get all kandi verified functions for this library.

            proposal-cancelable-promises Key Features

            No Key Features are available at this moment for proposal-cancelable-promises.

            proposal-cancelable-promises Examples and Code Snippets

            No Code Snippets are available at this moment for proposal-cancelable-promises.

            Community Discussions

            QUESTION

            What is a practical / elegant way to manage complex event sequences with cancellation in JavaScript?
            Asked 2017-Jan-13 at 05:25

            I have a JavaScript (EmberJS + Electron) application that needs to execute sequences of asynchronous tasks. Here is a simplified example:

            1. Send a message to a remote device
            2. Receive response less than t1 seconds later
            3. Send another message
            4. Receive second response less than t2 seconds later
            5. Display success message

            For simple cases this seems reasonably easy to implement with Promises: 1 then 2 then 3 ... It gets a little trickier when timeouts are incorporated, but Promise.race and Promise.all seem like reasonable solutions for that.

            However, I need to allow users to be able to cancel a sequence gracefully, and I am struggling to think of sensible ways to do this. The first thing that came to mind was to do some kind of polling during each step to see if a variable someplace has been set to indicate that the sequence should be canceled. Of course, that has some serious problems with it:

            • Inefficient: most of the polling time is wasted
            • Unresponsive: an extra delay is introduced by having to poll
            • Smelly: I think it goes without saying that this would be inelegant. A cancel event is completely unrelated to time so shouldn't require using a timer. The isCanceled variable may need to be outside of the promise' scope. etc.

            Another thought I had was to perhaps race everything so far against another promise that only resolves when the user sends a cancel signal. A major problem here is that the individual tasks running (that the user wants to cancel) don't know that they need to stop, roll-back, etc. so even though the code that gets the promise resolution from the race works fine, the code in the other promises does not get notified.

            Once upon a time there was talk about cancel-able promises, but it looks to me like the proposal was withdrawn so won't be incorporated into ECMAScript any time soon though I think the BlueBird promise library supports this idea. The application I'm making already includes the RSVP promise library, so I didn't really want to bring in another one but I guess that's a potential option.

            How else can this problem be solved? Should I be using promises at all? Would this be better served by a pub/sub event system or some such thing?

            Ideally, I'd like to separate the concern of being canceled from each task (just like how the Promise object is taking care of the concern of asynchronicity). It'd also be nice if the cancellation signal could be something passed-in/injected.

            Despite not being graphically skilled, I've attempted to illustrate what I'm trying to do by making the two drawings below. If you find them confusing then feel free to ignore them.


            ...

            ANSWER

            Answered 2017-Jan-13 at 05:25

            If I understand your problem correctly, the following may be a solution.

            Simple timeout

            Assume your mainline code looks like this:

            Source https://stackoverflow.com/questions/41625444

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install proposal-cancelable-promises

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/tc39/proposal-cancelable-promises.git

          • CLI

            gh repo clone tc39/proposal-cancelable-promises

          • sshUrl

            git@github.com:tc39/proposal-cancelable-promises.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Storage Libraries

            localForage

            by localForage

            seaweedfs

            by chrislusf

            Cloudreve

            by cloudreve

            store.js

            by marcuswestin

            go-ipfs

            by ipfs

            Try Top Libraries by tc39

            ecma262

            by tc39HTML

            proposal-type-annotations

            by tc39JavaScript