dsh-unlag 1.9.126 → 1.9.127

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.
Files changed (3) hide show
  1. package/client.js +12 -1
  2. package/index.js +5 -3
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -152,9 +152,20 @@ window.__ModuleLoader__.load({
152
152
  } catch {
153
153
  born = '';
154
154
  }
155
+ // How this document was reached is not something this plugin decides: a reload, a fresh
156
+ // navigation and a history walk look identical from inside the page afterwards, so the only
157
+ // way to say which happened is to write down how it arrived.
158
+ let nav = '';
159
+ try {
160
+ const entry = performance?.getEntriesByType?.('navigation')?.[0];
161
+ nav = String(entry?.type ?? '').replace(/[^a-z_]/gu, '').slice(0, 16);
162
+ } catch {
163
+ nav = '';
164
+ }
155
165
  const named = gate === undefined ? `event=${event}` : `event=${event}&gate=${encodeURIComponent(gate)}`;
156
166
  const withPage = page === '' ? named : `${named}&rev=${page}`;
157
- const query = born === '' ? withPage : `${withPage}&born=${born}`;
167
+ const withBorn = born === '' ? withPage : `${withPage}&born=${born}`;
168
+ const query = nav === '' ? withBorn : `${withBorn}&nav=${nav}`;
158
169
  /**
159
170
  * The route belongs to the instance this press is replacing. Its answer can land while the old
160
171
  * one is gone and the new one is not listening yet, and a lost line is a press nobody can
package/index.js CHANGED
@@ -2035,9 +2035,11 @@ function serveButton(ctx, controller, config) {
2035
2035
  // from two documents coming up. Without it a double reload and a doubled report read
2036
2036
  // the same.
2037
2037
  const born = (params.get('born') ?? '').replace(/[^0-9]/gu, '').slice(0, 16)
2038
- const from = pageRev === '' && born === ''
2039
- ? ''
2040
- : ` (page ${pageRev === '' ? '?' : pageRev}${born === '' ? '' : `, born ${born}`})`
2038
+ const navType = (params.get('nav') ?? '').replace(/[^a-z_]/gu, '').slice(0, 16)
2039
+ const first = [pageRev === '' ? '' : `page ${pageRev}`, born === '' ? '' : `born ${born}`, navType === '' ? '' : `nav ${navType}`]
2040
+ .filter((part) => part !== '')
2041
+ .join(', ')
2042
+ const from = first === '' ? '' : ` (${first})`
2041
2043
  /**
2042
2044
  * Every outcome the page reports is written down. A press whose line was missing left the
2043
2045
  * log unable to say what happened; an outcome with no line of its own (a failed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.126",
3
+ "version": "1.9.127",
4
4
  "type": "module",
5
5
  "description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
6
6
  "license": "MIT",