import { Stream } from './models/stream'; import { JSONValue, RequestHandler, WappRequestHandler } from './util/types'; declare const openStream: Stream; declare let startBackgroundTimer: ReturnType | undefined; export declare function streamHelperReset(): void; /** * Sends a message to the foreground. * * @param msg - The message to be sent. * @return A promise that resolves with the response from the foreground. */ export declare function sendToForeground(msg: T): Promise; /** * Sends a message to the background. * * @param msg - The message to be sent. * @return A promise that resolves with the response from the background. */ export declare function sendToBackground(msg: T): Promise; /** * Signals the foreground with a message. * * @param msg - The message to be sent. * @return A promise that resolves when the signal is sent. */ export declare function signalForeground(msg: T): Promise; /** * Sends a signal to the background with a message. * * @param msg - The message to be sent. * @return A promise that resolves when the signal is sent. */ export declare function signalBackground(msg: T): Promise; /** * Register a callback function that handles requests from the foreground. * * @param callback - The callback function for handling the request. * @return A Promise that resolves to true if the request was handled successfully, and false otherwise. */ export declare function fromForeground(callback: WappRequestHandler): Promise; /** * Register a callback function that handles requests from the background. * * @param callback - The callback function for handling the request. * @return A Promise that resolves to true if the request was handled successfully, and false otherwise. */ export declare function fromBackground(callback: WappRequestHandler): Promise; /** * Register a callback function that handles requests from the web hook. * * @param handler - The request handler function. * @return A promise that resolves to a boolean value indicating the success of the operation. */ export declare function onWebHook(handler: RequestHandler): Promise; /** * Removed the callback function that handles requests from the web hook. * * @param handler - The handler for the request. * @return A Promise that resolves to true if the request was cancelled successfully, and false otherwise. */ export declare function cancelOnWebHook(handler: RequestHandler): Promise; /** * Removes the callback function that handles requests from the background. * * @return A Promise that resolves to true if the request was successfully cancelled, and false otherwise. */ export declare function cancelFromBackground(): Promise; /** * Removes the callback function that handles requests from the foreground. * * @return A promise that resolves to true if the request was cancelled successfully, and false otherwise. */ export declare function cancelFromForeground(): Promise; /** * Waits for the background to start within a given timeout period. * * @param timeout The maximum time to wait for the background to start, in seconds. * @return A promise that resolves to true if the background has started within the timeout period, and false otherwise. */ export declare function waitForBackground(timeout?: number): Promise; /** * Sets a callback function to be called when a permission update occurs. * * @param callback - The callback function to be called when a permission update occurs. */ export declare function onPermissionUpdate(callback: () => void): void; /** * Cancels the permission update callback. */ export declare function cancelPermissionUpdate(): void; export { openStream, startBackgroundTimer };