mirror of
https://github.com/galacean/engine.git
synced 2026-06-21 20:02:45 +08:00
20 lines
460 B
TypeScript
20 lines
460 B
TypeScript
import { Engine } from "@oasis-engine/core";
|
|
import type { BufferReader } from "./BufferReader";
|
|
|
|
export const decoderMap: Record<
|
|
string,
|
|
{
|
|
decode: (engine: Engine, bufferReader: BufferReader) => Promise<any>;
|
|
}
|
|
> = {};
|
|
|
|
/**
|
|
* Decoder decorator generator.
|
|
* @param type - resource file type.
|
|
* @returns Decoder decorator
|
|
*/
|
|
export function decoder(type: string): ClassDecorator {
|
|
return (target: any) => {
|
|
decoderMap[type] = target;
|
|
};
|
|
} |