Repository navigation
api.js options and response headers, storage.js survives blocked storage
Based on feedback from using api.js and storage.js on a static landing page.
- api.js -
getJSON/postJSON/putJSON/deleteJSONsendContent-Type: application/jsononly when there is a body, so a plaingetJSONno longer triggers a CORS preflight and works against static hosts. The argument afterresponseFunctionmay be an options object{ headers, timeout, cache }(thetokenkey, tokenvaluepair still works). Results also carryheaders(the responseHeaders),error("timeout","offline"or"network"whenstatusis 0) andcached.cache: { key, ttl }ongetJSONkeeps successful results in localStorage forttlseconds, then revalidates withIf-None-Match; a304returns the stored data with its stored status (200) andcached: true. Failures in everyapi.jsfunction are logged withconsole.warninstead ofconsole.log. - storage.js - blocked or full storage (private mode, strict privacy settings) no longer throws: getters return
null, setters returnfalse(truewhen saved), with one console warning. - mapmodel.js - the model's origin now lands exactly on its map point; the canvas offset ignored perspective and placed the base up to 5 px too high.
- mapoffline.js - the HTTP Range fallback warning names the URL when it has no host (
blob:). - tests/ - 55 tests: request headers, timeout, cache with ETag, and blocked localStorage.