2017-06-18 13:25:27 +03:00
|
|
|
/* eslint-env serviceworker */
|
|
|
|
/* global toolbox */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
importScripts("lib/sw-toolbox.js");
|
|
|
|
|
|
|
|
toolbox.precache([
|
|
|
|
// Scripts
|
|
|
|
"lib/index.js",
|
|
|
|
"lib/parser-babylon.js",
|
|
|
|
"lib/parser-typescript.js",
|
2017-07-02 03:14:24 +03:00
|
|
|
"lib/parser-postcss.js",
|
2017-06-18 13:25:27 +03:00
|
|
|
"lib/parser-flow.js",
|
2017-12-29 20:14:31 +03:00
|
|
|
"lib/parser-glimmer.js",
|
2017-06-27 20:09:59 +03:00
|
|
|
"lib/parser-graphql.js",
|
2017-11-07 09:11:31 +03:00
|
|
|
"lib/parser-markdown.js",
|
2017-06-18 13:25:27 +03:00
|
|
|
"playground.js",
|
|
|
|
"lib/sw-toolbox.js",
|
|
|
|
|
|
|
|
// CodeMirror
|
2018-04-04 22:54:05 +03:00
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/codemirror.css",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/codemirror.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/mode/javascript/javascript.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/mode/xml/xml.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/mode/jsx/jsx.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/mode/css/css.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/mode/markdown/markdown.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/display/placeholder.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/display/rulers.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/search/searchcursor.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/edit/matchbrackets.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/edit/closebrackets.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/comment/comment.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/addon/wrap/hardwrap.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.36.0/keymap/sublime.js",
|
2018-04-17 20:13:23 +03:00
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",
|
2017-10-22 12:10:15 +03:00
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/lz-string/1.4.4/lz-string.min.js",
|
2018-04-17 20:13:23 +03:00
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/react/16.3.1/umd/react.production.min.js",
|
|
|
|
"https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.3.1/umd/react-dom.production.min.js",
|
2017-06-18 13:25:27 +03:00
|
|
|
|
|
|
|
// Images
|
2017-07-02 03:14:24 +03:00
|
|
|
"/prettier.png"
|
2017-06-18 13:25:27 +03:00
|
|
|
]);
|
|
|
|
|
2017-07-02 03:14:24 +03:00
|
|
|
// Default to hit the cache only if there's a network error
|
|
|
|
toolbox.router.default = toolbox.networkFirst;
|
|
|
|
|
|
|
|
// For scripts, stylesheets and images, we can use the "fastest" strategy
|
|
|
|
// This means you need to reload twice to get new changes
|
|
|
|
toolbox.router.get(/\.(js|css|png|svg)$/, toolbox.fastest);
|