UNPKG

@eva/react-eva

Version:

React EVA是一个让开发同学能够在React技术体系下,利用EVA JS的游戏研发能力,开发动画、游戏类场景的框架。它可以让开发同学用熟悉的JSX和Hooks语法编写动画、游戏场景的代码。

38 lines (30 loc) 669 B
import {resource, LOAD_EVENT} from '@eva/eva.js'; export class Preload { resources = {}; onStart(fn) { const handler = fn; resource.on(LOAD_EVENT.START, handler); return this; } onProgress(fn) { const handler = fn; resource.on(LOAD_EVENT.PROGRESS, handler); return this; } onLoaded(fn) { const handler = fn; resource.on(LOAD_EVENT.LOADED, handler); return this; } onComplete(fn) { const handler = fn; resource.on(LOAD_EVENT.COMPLETE, handler); return this; } onError(fn) { const handler = fn; resource.on(LOAD_EVENT.ERROR, handler); return this; } } export default new Preload();