easemob-websdk 4.2.0 → 4.2.1-beta

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.
@@ -4,10 +4,14 @@ import { Presence } from '../presence/presence';
4
4
  import { Silent } from '../silent/silent';
5
5
  import { Thread } from '../thread/thread';
6
6
  import { Translation } from '../translation/translation';
7
+ import { LocalCache } from '../localCache/localCache';
7
8
  import { Message } from '../message/index';
8
9
  import { Contact } from '../contact/contact';
9
10
  import { AsyncResult } from '../types/common';
10
11
  import { MessagesType } from '../types/message';
12
+ import { EventHandlerType } from '../types/eventHandler';
13
+ import { MessageBody } from '../types/message';
14
+ import { SendMsgResult } from '../types/indexApi';
11
15
  interface MiniCoreOptions {
12
16
  appKey: string;
13
17
  isHttpDNS?: boolean;
@@ -17,7 +21,7 @@ interface MiniCoreOptions {
17
21
  deviceId?: string;
18
22
  }
19
23
 
20
- interface OpenParams {
24
+ export interface OpenParams {
21
25
  /** The user ID. */
22
26
  username: string;
23
27
  /** The user ID. */
@@ -125,6 +129,7 @@ declare class MiniCore {
125
129
  usePlugin(this: MiniCore, plugin: any, name?: string): any;
126
130
  isOpened(): boolean;
127
131
  open(params: OpenParams): Promise<void>;
132
+ send(params: MessageBody): Promise<SendMsgResult>;
128
133
  /** Closes the connection. */
129
134
  close(): void;
130
135
  registerUser(params: {
@@ -139,6 +144,18 @@ declare class MiniCore {
139
144
  downloadAndParseCombineMessage(
140
145
  options: DownloadCombineMessagesParams
141
146
  ): Promise<MessagesType[]>;
147
+ /**
148
+ * Adds listening events.
149
+ *
150
+ * ```typescript
151
+ * connection.addEventHandler('customId', {
152
+ * onTextMessage: (message) => {
153
+ * console.log(message)
154
+ * }
155
+ * })
156
+ * ```
157
+ */
158
+ addEventHandler(id: string, handler: EventHandlerType): void;
142
159
 
143
160
  private clearTokenTimeout;
144
161
  private tokenExpireTimeCountDown;
@@ -158,6 +175,8 @@ declare class MiniCore {
158
175
  silent: Silent;
159
176
  thread: Thread;
160
177
  translation: Translation;
178
+ localCache: LocalCache;
161
179
  }
162
180
  declare const miniCore: typeof MiniCore;
181
+ export type { MiniCore };
163
182
  export default miniCore;