Skip to content

Should we separate abort/cancel and ignore? #14

@otakustay

Description

@otakustay

In some common cases, we expect a special state of promise, in which:

No handler is executed when the promise is fulfilled

Such case could be a not-wanted fetch process, like:

var fetching = fetch(url);
fetching.then(displayData);

// Since user navigates to another page, this fetch is not wanted anymore,
// however it could be continue and results in a local cache with the Expired header,
// so we do not abort it, and we do not want our reject handlers execute
page.on('exit', fetching.ignore);

For similar case, we may:

  1. Add a ignore() method to put a promise in a ignored state
  2. Reuse the cancellation spec but allow consumer to specify wether to reject the promise
  3. Add a detach(handler) method to detach a handler so that each consumer can only manage handlers from its own

or I may put the issue in wrong place?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions