Skip to content

MessageEvent within the SW global should have waitUntil() #669

@jakearchibald

Description

@jakearchibald

Not sure how to easily mix this in, but the SW should be able to signal it's doing work after a postMessage

self.onmessage = function(event) {
  event.waitUntil(
    doAsyncStuff.then(response => event.source.postMessage(response))
  )
};

Or we could revisit a global waitUntil #400. We'd need to call it something different though, I'm worried devs may use waitUntil() instead of event.waitUntil() and get different behaviour because success/failure doesn't reach the event dispatcher.

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