@pmndrs/cannon-worker-api
Version:
An API to use cannon-es in a web worker
16 lines (15 loc) • 586 B
TypeScript
import type { Body, ContactEquation } from 'cannon-es';
import type { IncomingWorkerMessage } from '../types';
export declare type WithUUID<C> = C & {
uuid?: string;
};
export interface CannonWorkerGlobalScope extends ServiceWorkerGlobalScope {
postMessage(message: IncomingWorkerMessage['data'], transfer: Transferable[]): void;
postMessage(message: IncomingWorkerMessage['data'], options?: StructuredSerializeOptions): void;
}
export interface CannonCollideEvent {
body: WithUUID<Body>;
contact: ContactEquation;
target: WithUUID<Body>;
type: 'collide';
}