UNPKG

@btfuse/core

Version:

A native-first framework for building hybdrid web-native applications

39 lines (38 loc) 1.33 kB
import { FuseAPIResponse } from './FuseAPIResponse'; import { TSerializable } from './TSerializable'; import { FuseSerializer } from './FuseSerializer'; import { TFuseAPICallbackHandler } from './FuseCallbackManager'; /** * Generic API response data type */ export interface TFuseAPIResponseData { keep: boolean; data?: Blob; } export interface IFuseAPICallPacket { route: string; callbackID: string; body: Blob; contentType: string; } /** * Base class for the Fuse API bridge for exchanging data with the native platform */ export declare abstract class FuseAPI { private $serializer; constructor(); protected _createSerializer(): FuseSerializer; getSerializer(): FuseSerializer; /** * Override to implement execute native bridge logic * * @param pluginID - The plugin ID * @param method - API method * @param args - API arguments */ protected abstract _execute(pluginID: string, method: string, contentType: string, args: Blob): Promise<FuseAPIResponse>; protected _createRoute(pluginID: string, method: string): string; execute(pluginID: string, method: string, contentType: string, args: TSerializable): Promise<FuseAPIResponse>; createCallbackContext(cb: TFuseAPICallbackHandler): string; releaseCallback(id: string): void; }