Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/packages/@reactpy/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"name": "@reactpy/client",
"type": "module",
"version": "0.3.0",
"version": "0.3.1",
"dependencies": {
"event-to-object": "^0.1.2",
"json-pointer": "^0.6.2"
Expand Down
9 changes: 6 additions & 3 deletions src/client/packages/@reactpy/client/src/reactpy-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ export interface ReactPyClient {
*
* @param message The message to send. Messages must have a `type` property.
*/
sendMessage: (message: any) => void;
sendMessage(message: any): void;

/**
* Load a module from the server.
* @param moduleName The name of the module to load.
* @returns A promise that resolves to the module.
*/
loadModule: (moduleName: string) => Promise<ReactPyModule>;
loadModule(moduleName: string): Promise<ReactPyModule>;
}

export class BaseReactPyClient implements Partial<ReactPyClient> {
export abstract class BaseReactPyClient implements ReactPyClient {
private readonly handlers: { [key: string]: ((message: any) => void)[] } = {};
protected readonly ready: Promise<void>;
private resolveReady: (value: undefined) => void;
Expand All @@ -49,6 +49,9 @@ export class BaseReactPyClient implements Partial<ReactPyClient> {
};
}

abstract sendMessage(message: any): void;
abstract loadModule(moduleName: string): Promise<ReactPyModule>;

/**
* Handle an incoming message.
*
Expand Down
5 changes: 4 additions & 1 deletion src/client/tsconfig.package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "react",
"lib": ["DOM", "DOM.Iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"noUnusedLocals": true,
"resolveJsonModule": true,
"skipLibCheck": false,
"sourceMap": true,
"strict": true,
"target": "esnext"
}
Expand Down