{"action":"created","issue":{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/844","repository_url":"https://api.github.com/repos/slightlyoff/ServiceWorker","labels_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/844/labels{/name}","comments_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/844/comments","events_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/844/events","html_url":"https://github.com/slightlyoff/ServiceWorker/issues/844","id":140111228,"number":844,"title":"Fetch API respondWith's implicit RETURN","user":{"login":"RichardMaher","id":8264706,"avatar_url":"https://avatars.githubusercontent.com/u/8264706?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardMaher","html_url":"https://github.com/RichardMaher","followers_url":"https://api.github.com/users/RichardMaher/followers","following_url":"https://api.github.com/users/RichardMaher/following{/other_user}","gists_url":"https://api.github.com/users/RichardMaher/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardMaher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardMaher/subscriptions","organizations_url":"https://api.github.com/users/RichardMaher/orgs","repos_url":"https://api.github.com/users/RichardMaher/repos","events_url":"https://api.github.com/users/RichardMaher/events{/privacy}","received_events_url":"https://api.github.com/users/RichardMaher/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2016-03-11T07:38:34Z","updated_at":"2016-03-11T20:43:47Z","closed_at":"2016-03-11T13:26:02Z","body":"I have looked at https://www.w3.org/TR/service-workers/#respond-with-method trying to establish the architected  behaviour of respondWith() and I cannot find anything regarding an implicit RETURN.\r\n\r\nCan anyone here please clarify this and the behaviour of the respondWith-entered and wait-to-respond flags?"},"comment":{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/comments/195543842","html_url":"https://github.com/slightlyoff/ServiceWorker/issues/844#issuecomment-195543842","issue_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/844","id":195543842,"user":{"login":"RichardMaher","id":8264706,"avatar_url":"https://avatars.githubusercontent.com/u/8264706?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardMaher","html_url":"https://github.com/RichardMaher","followers_url":"https://api.github.com/users/RichardMaher/followers","following_url":"https://api.github.com/users/RichardMaher/following{/other_user}","gists_url":"https://api.github.com/users/RichardMaher/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardMaher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardMaher/subscriptions","organizations_url":"https://api.github.com/users/RichardMaher/orgs","repos_url":"https://api.github.com/users/RichardMaher/repos","events_url":"https://api.github.com/users/RichardMaher/events{/privacy}","received_events_url":"https://api.github.com/users/RichardMaher/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T20:43:47Z","updated_at":"2016-03-11T20:43:47Z","body":"Sorry, I've one child throwing up all night and another going to rowing in 25 mins so not 100% on the latest, but back on the \"before the callback returns\" (Jake's example http://jsbin.com/wowevi/edit?js,console )\r\n\r\nIf I can use a promise like this: -\r\n\r\nfunction wait(ms) {\r\n  return new Promise(resolve => {\r\n    setTimeout(resolve, ms);\r\n  });\r\n}\r\n\r\nThen surely: - wait(22).then(console.log(***'this is not called within the callback'***) ?\r\n\r\nYou bypassed promises with their logical in-lining and went to back to straight Events so I just want to clear up if your \"within the callback\" context is effected?\r\n\r\n> This flag is set after dispatch (18.5), so if it isn't called by then, it's ignored.\r\n\r\nWow, thanks for the reference and I stand corrected. (.20 seemed to be definitive)\r\n\r\nSo later today I'll : -\r\n\r\n1) New-up a new promise immediately in the FetchEvent\r\n2) Call fetchEvent.respondWith(myNewPromise)\r\n3) In my reply function, instead of calling respondWith I'll call myPromise.resolve()\r\n\r\nWould that be kosher now? Is my use of the waitUntil appropriate or is the repondWithEntered flag now achieving the same thing for me?\r\n\r\n"}}