@flatfile/listener 0.3.4 → 0.3.5
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/dist/index.js +26 -1
- package/dist/index.mjs +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113,6 +113,7 @@ var CrossEnvConfig = class {
|
|
|
113
113
|
if (typeof process === "object" && typeof process.env === "object") {
|
|
114
114
|
values.push(process.env[prop]);
|
|
115
115
|
}
|
|
116
|
+
values.push(...this.checkForBrowserVariables(prop));
|
|
116
117
|
const foundValue = values.find((v) => v !== void 0);
|
|
117
118
|
if (foundValue !== void 0) {
|
|
118
119
|
return foundValue;
|
|
@@ -123,6 +124,28 @@ var CrossEnvConfig = class {
|
|
|
123
124
|
}
|
|
124
125
|
return void 0;
|
|
125
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Internal function for checking for stored variables in a browser-like environment
|
|
129
|
+
*
|
|
130
|
+
* @param prop
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
static checkForBrowserVariables(prop) {
|
|
134
|
+
let values = [];
|
|
135
|
+
if (typeof window === "object") {
|
|
136
|
+
const windowValue = window[`CROSSENV_${prop}`];
|
|
137
|
+
if (windowValue !== void 0) {
|
|
138
|
+
values.push(windowValue);
|
|
139
|
+
}
|
|
140
|
+
if (typeof sessionStorage === "object") {
|
|
141
|
+
const storedValue = sessionStorage.getItem(`CROSSENV_${prop}`);
|
|
142
|
+
if (storedValue !== null) {
|
|
143
|
+
values.push(storedValue);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return values;
|
|
148
|
+
}
|
|
126
149
|
};
|
|
127
150
|
CrossEnvConfig._overrides = /* @__PURE__ */ new Map();
|
|
128
151
|
CrossEnvConfig._aliases = /* @__PURE__ */ new Map();
|
|
@@ -484,7 +507,9 @@ var EventHandler = class extends AuthenticatedClient {
|
|
|
484
507
|
}
|
|
485
508
|
}
|
|
486
509
|
await this.trigger(event, true);
|
|
487
|
-
|
|
510
|
+
for (const [_key, cb] of event.afterAllCallbacks) {
|
|
511
|
+
await cb(event);
|
|
512
|
+
}
|
|
488
513
|
event.cache.delete();
|
|
489
514
|
}
|
|
490
515
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -70,6 +70,7 @@ var CrossEnvConfig = class {
|
|
|
70
70
|
if (typeof process === "object" && typeof process.env === "object") {
|
|
71
71
|
values.push(process.env[prop]);
|
|
72
72
|
}
|
|
73
|
+
values.push(...this.checkForBrowserVariables(prop));
|
|
73
74
|
const foundValue = values.find((v) => v !== void 0);
|
|
74
75
|
if (foundValue !== void 0) {
|
|
75
76
|
return foundValue;
|
|
@@ -80,6 +81,28 @@ var CrossEnvConfig = class {
|
|
|
80
81
|
}
|
|
81
82
|
return void 0;
|
|
82
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Internal function for checking for stored variables in a browser-like environment
|
|
86
|
+
*
|
|
87
|
+
* @param prop
|
|
88
|
+
* @private
|
|
89
|
+
*/
|
|
90
|
+
static checkForBrowserVariables(prop) {
|
|
91
|
+
let values = [];
|
|
92
|
+
if (typeof window === "object") {
|
|
93
|
+
const windowValue = window[`CROSSENV_${prop}`];
|
|
94
|
+
if (windowValue !== void 0) {
|
|
95
|
+
values.push(windowValue);
|
|
96
|
+
}
|
|
97
|
+
if (typeof sessionStorage === "object") {
|
|
98
|
+
const storedValue = sessionStorage.getItem(`CROSSENV_${prop}`);
|
|
99
|
+
if (storedValue !== null) {
|
|
100
|
+
values.push(storedValue);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return values;
|
|
105
|
+
}
|
|
83
106
|
};
|
|
84
107
|
CrossEnvConfig._overrides = /* @__PURE__ */ new Map();
|
|
85
108
|
CrossEnvConfig._aliases = /* @__PURE__ */ new Map();
|
|
@@ -441,7 +464,9 @@ var EventHandler = class extends AuthenticatedClient {
|
|
|
441
464
|
}
|
|
442
465
|
}
|
|
443
466
|
await this.trigger(event, true);
|
|
444
|
-
|
|
467
|
+
for (const [_key, cb] of event.afterAllCallbacks) {
|
|
468
|
+
await cb(event);
|
|
469
|
+
}
|
|
445
470
|
event.cache.delete();
|
|
446
471
|
}
|
|
447
472
|
/**
|