16 lines
330 B
JavaScript
16 lines
330 B
JavaScript
import {createContext, useContext} from 'react';
|
|
|
|
import {usePacket} from './client.js';
|
|
|
|
const context = createContext();
|
|
|
|
export default context;
|
|
|
|
export function useEcs() {
|
|
return useContext(context);
|
|
}
|
|
|
|
export function useEcsTick(fn, dependencies) {
|
|
const ecs = useEcs();
|
|
usePacket(':Ecs', fn, [ecs, ...dependencies]);
|
|
} |