react-defold
Version:
Defold component for react
33 lines (32 loc) • 1.12 kB
TypeScript
import React from 'react';
declare global {
interface Window {
[key: string]: {
inbound: Array<{
command: string;
payload: Record<string, unknown>;
}>;
outbound: Array<{
command: string;
payload: Record<string, unknown>;
}>;
data: Record<string, unknown>;
in: (msg: string) => void;
out: () => string;
tick: () => void;
};
}
}
declare type DefoldAppContextProviderProps = React.PropsWithChildren<{
namespace: string;
data: Record<string, unknown>;
}>;
declare const DefoldAppContextProvider: React.FC<DefoldAppContextProviderProps>;
declare const useDefoldAppContext: ({ onReceive }: {
onReceive?: ((command: string, payload: Record<string, unknown>) => void) | undefined;
}) => {
data: Record<string, unknown>;
send: (command: string, payload: Record<string, unknown>) => void;
};
export { DefoldAppContextProvider, useDefoldAppContext };
export type { DefoldAppContextProviderProps };