tc39 / ecma262

Status, process, and documents for ECMA-262
https://tc39.es/ecma262/
Other
14.96k stars 1.28k forks source link

Offline capability for reading the specification #1656

Open jasonwilliams opened 5 years ago

jasonwilliams commented 5 years ago

It would be great to have an offline copy for reading the specification here: https://tc39.es/ecma262/

I tend to be in places where i have no connection and my tablet won't hold the page in the HTTP cache for long because it's too big. So I need a consistent connection to read the spec.

One option is adding service workers, we can then cache the page on devices and update as needs be. @ljharb mentioned this has slowed down performance in the past, I'm happy to try out a branch with a path using them to see if there's any perf degrade.

Another option is generating PDFs, but it seems like this is a manual process right now.

Below is an example of using service workers for a Github hosted page. https://gist.github.com/kosamari/7c5d1e8449b2fbc97d372675f16b566e

ljharb commented 5 years ago

Automating PDF generation seems like a much higher priority, but both that and offline web usage seem like good improvements.

domenic commented 5 years ago

FWIW all WHATWG specs have service workers. See https://github.com/whatwg/whatwg.org/blob/master/resources.whatwg.org/standard-service-worker.js + https://github.com/whatwg/whatwg.org/blob/86220b18cf23b984fdac4db52ac006ce0fe5d00e/resources.whatwg.org/build/deploy.sh#L147-L166 + https://github.com/tabatkins/bikeshed/blob/220086d88511a9c99d7a1f9b5447db7e7b99e053/bikeshed/boilerplate/whatwg/footer.include#L7-L12

jasonwilliams commented 5 years ago

I've investigated the service worker model some more. I used Rust's documentation (the book) as testing ground. The results work really well, its very fast and responsive on my tablet. Here is the link: https://github.com/rust-lang-nursery/mdBook/pull/1000

TLDR: Navigate to https://jason-williams.co.uk/book/ then go offline, the Rust Book should continue to work without net connection. I haven't experienced any slowness. Content is served from the browser cache first, then is revalidated in the background. If revalidation fails it will try again when next online.