@kokimoki/app 1.4.6 → 1.4.7

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.
@@ -35,6 +35,7 @@ export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient
35
35
  private _reconnectTimeout;
36
36
  private _pingInterval;
37
37
  private _clientTokenKey;
38
+ private _editorContext;
38
39
  constructor(host: string, appId: string, code?: string);
39
40
  get id(): string;
40
41
  get connectionId(): string;
@@ -44,6 +45,7 @@ export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient
44
45
  get clientContext(): ClientContextT & ({} | null);
45
46
  get connected(): boolean;
46
47
  get ws(): WebSocket;
48
+ get isEditor(): boolean;
47
49
  connect(): Promise<void>;
48
50
  private handleInitMessage;
49
51
  private handleBinaryMessage;
@@ -35,6 +35,7 @@ export class KokimokiClient extends EventEmitter {
35
35
  _reconnectTimeout = 0;
36
36
  _pingInterval;
37
37
  _clientTokenKey = "KM_TOKEN";
38
+ _editorContext;
38
39
  constructor(host, appId, code = "") {
39
40
  super();
40
41
  this.host = host;
@@ -57,6 +58,7 @@ export class KokimokiClient extends EventEmitter {
57
58
  if (window.parent && window.self !== window.parent) {
58
59
  window.addEventListener("message", (e) => {
59
60
  console.log(`[KM TOOLS] ${e.data}`);
61
+ this._editorContext = e.data;
60
62
  if (e.data === "km:clearStorage") {
61
63
  localStorage.removeItem(this._clientTokenKey);
62
64
  window.location.reload();
@@ -112,6 +114,9 @@ export class KokimokiClient extends EventEmitter {
112
114
  }
113
115
  return this._ws;
114
116
  }
117
+ get isEditor() {
118
+ return !!this._editorContext;
119
+ }
115
120
  async connect() {
116
121
  if (this._connectPromise) {
117
122
  return await this._connectPromise;
@@ -344,6 +344,7 @@ declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
344
344
  private _reconnectTimeout;
345
345
  private _pingInterval;
346
346
  private _clientTokenKey;
347
+ private _editorContext;
347
348
  constructor(host: string, appId: string, code?: string);
348
349
  get id(): string;
349
350
  get connectionId(): string;
@@ -353,6 +354,7 @@ declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
353
354
  get clientContext(): ClientContextT & ({} | null);
354
355
  get connected(): boolean;
355
356
  get ws(): WebSocket;
357
+ get isEditor(): boolean;
356
358
  connect(): Promise<void>;
357
359
  private handleInitMessage;
358
360
  private handleBinaryMessage;
@@ -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.6";
637
+ const KOKIMOKI_APP_VERSION = "1.4.7";
638
638
 
639
639
  /**
640
640
  * Utility module to work with key-value stores.
@@ -12248,6 +12248,7 @@ class KokimokiClient extends EventEmitter$1 {
12248
12248
  _reconnectTimeout = 0;
12249
12249
  _pingInterval;
12250
12250
  _clientTokenKey = "KM_TOKEN";
12251
+ _editorContext;
12251
12252
  constructor(host, appId, code = "") {
12252
12253
  super();
12253
12254
  this.host = host;
@@ -12270,6 +12271,7 @@ class KokimokiClient extends EventEmitter$1 {
12270
12271
  if (window.parent && window.self !== window.parent) {
12271
12272
  window.addEventListener("message", (e) => {
12272
12273
  console.log(`[KM TOOLS] ${e.data}`);
12274
+ this._editorContext = e.data;
12273
12275
  if (e.data === "km:clearStorage") {
12274
12276
  localStorage.removeItem(this._clientTokenKey);
12275
12277
  window.location.reload();
@@ -12325,6 +12327,9 @@ class KokimokiClient extends EventEmitter$1 {
12325
12327
  }
12326
12328
  return this._ws;
12327
12329
  }
12330
+ get isEditor() {
12331
+ return !!this._editorContext;
12332
+ }
12328
12333
  async connect() {
12329
12334
  if (this._connectPromise) {
12330
12335
  return await this._connectPromise;