@kokimoki/app 1.4.2 → 1.4.4
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/kokimoki-client.d.ts +1 -0
- package/dist/kokimoki-client.js +25 -5
- package/dist/kokimoki.min.d.ts +1 -0
- package/dist/kokimoki.min.js +26 -6
- package/dist/kokimoki.min.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -34,6 +34,7 @@ export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient
|
|
|
34
34
|
private _autoReconnect;
|
|
35
35
|
private _reconnectTimeout;
|
|
36
36
|
private _pingInterval;
|
|
37
|
+
private _devMode;
|
|
37
38
|
private _clientTokenKey;
|
|
38
39
|
constructor(host: string, appId: string, code?: string);
|
|
39
40
|
get id(): string;
|
package/dist/kokimoki-client.js
CHANGED
|
@@ -34,6 +34,7 @@ export class KokimokiClient extends EventEmitter {
|
|
|
34
34
|
_autoReconnect = true;
|
|
35
35
|
_reconnectTimeout = 0;
|
|
36
36
|
_pingInterval;
|
|
37
|
+
_devMode = false;
|
|
37
38
|
_clientTokenKey = "KM_TOKEN";
|
|
38
39
|
constructor(host, appId, code = "") {
|
|
39
40
|
super();
|
|
@@ -53,12 +54,10 @@ export class KokimokiClient extends EventEmitter {
|
|
|
53
54
|
this.ws.send(pingBuffer);
|
|
54
55
|
}
|
|
55
56
|
}, 5000);
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
if (window.top && frameElement) {
|
|
59
|
-
this._clientTokenKey = `KM_TOKEN/${frameElement.id}`;
|
|
57
|
+
// Listen for devtools messages
|
|
58
|
+
if (window.top && window.self !== window.top) {
|
|
60
59
|
window.addEventListener("message", (e) => {
|
|
61
|
-
console.log(`[KM
|
|
60
|
+
console.log(`[KM TOOLS] ${e.data}`);
|
|
62
61
|
if (e.data === "km:clearStorage") {
|
|
63
62
|
localStorage.removeItem(this._clientTokenKey);
|
|
64
63
|
window.location.reload();
|
|
@@ -118,6 +117,27 @@ export class KokimokiClient extends EventEmitter {
|
|
|
118
117
|
if (this._connectPromise) {
|
|
119
118
|
return await this._connectPromise;
|
|
120
119
|
}
|
|
120
|
+
// Detect devtools
|
|
121
|
+
if (window.top && window.self !== window.top) {
|
|
122
|
+
await new Promise((resolve) => {
|
|
123
|
+
/* // Wait up to 500ms for parent to respond
|
|
124
|
+
const timeout = setTimeout(() => {
|
|
125
|
+
window.removeEventListener("message", onMessage);
|
|
126
|
+
resolve();
|
|
127
|
+
}, 500); */
|
|
128
|
+
// Listen for parent response
|
|
129
|
+
const onMessage = (e) => {
|
|
130
|
+
// clearTimeout(timeout);
|
|
131
|
+
window.removeEventListener("message", onMessage);
|
|
132
|
+
if (e.data.clientKey) {
|
|
133
|
+
this._clientTokenKey = `KM_TOKEN/${e.data.clientKey}`;
|
|
134
|
+
}
|
|
135
|
+
resolve();
|
|
136
|
+
};
|
|
137
|
+
window.addEventListener("message", onMessage);
|
|
138
|
+
window.top.postMessage({ appId: this.appId }, "*");
|
|
139
|
+
});
|
|
140
|
+
}
|
|
121
141
|
// Set up the WebSocket connection
|
|
122
142
|
this._ws = new WebSocket(`${this._wsUrl}/apps/${this.appId}?clientVersion=${KOKIMOKI_APP_VERSION}`);
|
|
123
143
|
this._ws.binaryType = "arraybuffer";
|
package/dist/kokimoki.min.d.ts
CHANGED
|
@@ -343,6 +343,7 @@ declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
|
|
|
343
343
|
private _autoReconnect;
|
|
344
344
|
private _reconnectTimeout;
|
|
345
345
|
private _pingInterval;
|
|
346
|
+
private _devMode;
|
|
346
347
|
private _clientTokenKey;
|
|
347
348
|
constructor(host: string, appId: string, code?: string);
|
|
348
349
|
get id(): string;
|
package/dist/kokimoki.min.js
CHANGED
|
@@ -634,7 +634,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
|
634
634
|
var eventsExports = events.exports;
|
|
635
635
|
var EventEmitter$1 = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);
|
|
636
636
|
|
|
637
|
-
const KOKIMOKI_APP_VERSION = "1.4.
|
|
637
|
+
const KOKIMOKI_APP_VERSION = "1.4.4";
|
|
638
638
|
|
|
639
639
|
/**
|
|
640
640
|
* Utility module to work with key-value stores.
|
|
@@ -12247,6 +12247,7 @@ class KokimokiClient extends EventEmitter$1 {
|
|
|
12247
12247
|
_autoReconnect = true;
|
|
12248
12248
|
_reconnectTimeout = 0;
|
|
12249
12249
|
_pingInterval;
|
|
12250
|
+
_devMode = false;
|
|
12250
12251
|
_clientTokenKey = "KM_TOKEN";
|
|
12251
12252
|
constructor(host, appId, code = "") {
|
|
12252
12253
|
super();
|
|
@@ -12266,12 +12267,10 @@ class KokimokiClient extends EventEmitter$1 {
|
|
|
12266
12267
|
this.ws.send(pingBuffer);
|
|
12267
12268
|
}
|
|
12268
12269
|
}, 5000);
|
|
12269
|
-
//
|
|
12270
|
-
|
|
12271
|
-
if (window.top && frameElement) {
|
|
12272
|
-
this._clientTokenKey = `KM_TOKEN/${frameElement.id}`;
|
|
12270
|
+
// Listen for devtools messages
|
|
12271
|
+
if (window.top && window.self !== window.top) {
|
|
12273
12272
|
window.addEventListener("message", (e) => {
|
|
12274
|
-
console.log(`[KM
|
|
12273
|
+
console.log(`[KM TOOLS] ${e.data}`);
|
|
12275
12274
|
if (e.data === "km:clearStorage") {
|
|
12276
12275
|
localStorage.removeItem(this._clientTokenKey);
|
|
12277
12276
|
window.location.reload();
|
|
@@ -12331,6 +12330,27 @@ class KokimokiClient extends EventEmitter$1 {
|
|
|
12331
12330
|
if (this._connectPromise) {
|
|
12332
12331
|
return await this._connectPromise;
|
|
12333
12332
|
}
|
|
12333
|
+
// Detect devtools
|
|
12334
|
+
if (window.top && window.self !== window.top) {
|
|
12335
|
+
await new Promise((resolve) => {
|
|
12336
|
+
/* // Wait up to 500ms for parent to respond
|
|
12337
|
+
const timeout = setTimeout(() => {
|
|
12338
|
+
window.removeEventListener("message", onMessage);
|
|
12339
|
+
resolve();
|
|
12340
|
+
}, 500); */
|
|
12341
|
+
// Listen for parent response
|
|
12342
|
+
const onMessage = (e) => {
|
|
12343
|
+
// clearTimeout(timeout);
|
|
12344
|
+
window.removeEventListener("message", onMessage);
|
|
12345
|
+
if (e.data.clientKey) {
|
|
12346
|
+
this._clientTokenKey = `KM_TOKEN/${e.data.clientKey}`;
|
|
12347
|
+
}
|
|
12348
|
+
resolve();
|
|
12349
|
+
};
|
|
12350
|
+
window.addEventListener("message", onMessage);
|
|
12351
|
+
window.top.postMessage({ appId: this.appId }, "*");
|
|
12352
|
+
});
|
|
12353
|
+
}
|
|
12334
12354
|
// Set up the WebSocket connection
|
|
12335
12355
|
this._ws = new WebSocket(`${this._wsUrl}/apps/${this.appId}?clientVersion=${KOKIMOKI_APP_VERSION}`);
|
|
12336
12356
|
this._ws.binaryType = "arraybuffer";
|