dcp-client 5.8.1 → 5.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dcp-client.js CHANGED
@@ -9,7 +9,9 @@
9
9
  * - onready: same as onload, but dcp is also defined.
10
10
  * - scheduler: set the URL for the scheduler, also used to locate dcpConfig
11
11
  * - bundle: set the URL for the bundle to load, default is the one in this directory
12
- * @author Wes Garland, wes@kingsds.network
12
+ * - identity: API key to use for setting dcp identity
13
+ *
14
+ * @author Wes Garland, wes@distributive.network
13
15
  * @date Aug 2019
14
16
  */
15
17
  'use strict';
@@ -348,7 +350,10 @@ https://distributive.network/`, "font-weight: bold; font-size: 1.2em; color: #00
348
350
  var bundleSrc = thisScript.getAttribute("bundle") || (thisScript.src.replace('/dcp-client.js', '/dist/dcp-client-bundle.js'));
349
351
 
350
352
  bundleScript.setAttribute('type', 'text/javascript');
351
- bundleScript.setAttribute('src', bundleSrc);
353
+ if (thisScriptURL.searchParams.has('cache-key'))
354
+ bundleScript.setAttribute('src', bundleSrc + '?cache-key=' + thisScriptURL.searchParams.get('cache-key'));
355
+ else
356
+ bundleScript.setAttribute('src', bundleSrc);
352
357
  bundleScript.setAttribute('id', '_dcp_client_bundle');
353
358
  bundleScript.setAttribute('dcp-env', 'vanilla-web');
354
359
  bundleScript.setAttribute('onerror', `alert('Error DCP-1002: Could not load dcp-client bundle from URL ("${bundleSrc}")')`);
@@ -376,6 +381,9 @@ https://distributive.network/`, "font-weight: bold; font-size: 1.2em; color: #00
376
381
  return;
377
382
  href = thisScriptURL.origin + thisScriptURL.pathname
378
383
  .replace(/\/dcp-client\/dcp-client.js$/, '/dcp-client/assets/dcp-client.css');
384
+ if (thisScriptURL.searchParams.has('cache-key'))
385
+ href += '?cache-key=' + thisScriptURL.searchParams.get('cache-key');
386
+
379
387
  const head = document.getElementsByTagName('head')[0];
380
388
  let styleLink = document.createElement('link');
381
389
  styleLink.rel = 'stylesheet';