-
Notifications
You must be signed in to change notification settings - Fork 27
LocalStorage cache
Mikhail Davydov edited this page Oct 10, 2013
·
3 revisions
- Flags:
cache
,cache_async
, Property:version
You can store all your in-package modules and lmd itself in localStorage. (Disabled by default)
- Set config flag
cache: true
and addversion: your_current_build_version
property to your config file then build your LMD package - it will be created in cache mode. If no version - LMD package will run in default mode - without dumping modules - Set config flag
cache_async: true
to cacherequire.async()
requests in localStorage too - Remove script tag
<script src="out/index.production.lmd.js" id="source"></script>
with LMD initializer:
<script id="lmd-initializer"
src="../src/lmd_initializer.min.js"
data-src="out/index.production.lmd.js"
data-version="1.6.0"
data-key="lmd"></script>
-
id
- always lmd-initializer (do not change it) -
src
- path tolmd_initializer.js
-
data-key
- localStorage key where all lmd code stored (do not change it) -
data-version
- content in localStorage must match this version -
data-src
- fallback if version do not match or no localStorage or error or no content
Note: version
property from config and from data-version
attribute must match to use code from localStorage!
Yep! Each time you have to change config file and your html file!