- From: Jake Archibald <notifications@github.com>
- Date: Tue, 24 Mar 2015 05:21:33 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Tuesday, 24 March 2015 12:22:02 UTC
Yep! Messaging from page to ServiceWorker: ```js // in the page: navigator.serviceWorker.controller.postMessage("Hi!"); // in the ServiceWorker: self.onmessage = function(event) { event.source; // instance of Client event.data; // "Hi!" // reply event.source.postMessage("Hey!"); }; // back in the page: navigator.serviceWorker.onmessage = function(event) { event.source; // instance of ServiceWorker event.data; // "Hey!" }; ``` I think Chrome currently sends postmessages from ServiceWorker to Window to window.onmessage, based on an earlier spec. --- Reply to this email directly or view it on GitHub: https://github.com/slightlyoff/ServiceWorker/issues/662#issuecomment-85475732
Received on Tuesday, 24 March 2015 12:22:02 UTC