@akc42/app-utils 3.6.1 → 3.6.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.
Files changed (3) hide show
  1. package/debug.js +1 -5
  2. package/package.json +1 -1
  3. package/post-api.js +1 -0
package/debug.js CHANGED
@@ -127,7 +127,7 @@ function Debug(t) {
127
127
  topic: tl,
128
128
  timestamp: new Date().getTime(),
129
129
  defined: false, //has the config been defined yet
130
- debug: async function (...args) {
130
+ debug: function (...args) {
131
131
  //do time calc before potential delay to see if we are enabled
132
132
  const now = new Date().getTime();
133
133
  const gap = now - this.timestamp;
@@ -136,10 +136,6 @@ function Debug(t) {
136
136
  return `${cum} ${arg}`.trim();
137
137
  }, '');
138
138
  if (initialised) performance.mark(this.topic, { detail: message }); //save our message locally regardless of if enabled
139
- if (!this.defined) {
140
- await config();
141
- this.defined = true;
142
- }
143
139
  let enabled = false;
144
140
  const debugConf = sessionStorage.getItem('debug');
145
141
  if (debugConf) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akc42/app-utils",
3
- "version": "3.6.1",
3
+ "version": "3.6.3",
4
4
  "description": "General Utilities for SPAs",
5
5
  "exports": {
6
6
  ".": "./*.js"
package/post-api.js CHANGED
@@ -52,6 +52,7 @@ export default async function api(url, params, blob, signal) {
52
52
  }
53
53
  } catch (err) {
54
54
  if (!options.signal || !options.signal.aborted) {
55
+ if (err instanceof TypeError) throw new CustomEvent('api-network', { bubbles:true, composed:true, detail: address})
55
56
  if (err.type === 'api-error') throw err; //just throw whatever error we had
56
57
  //we failed to parse the json - the actual code should be in the text near the end;
57
58
  throw new CustomEvent('api-error', { composed: true, bubbles: true, detail: {status:parseInt((text?? '---502---').slice(-6, -3), 10), url:address }});