This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/src/DoricRegistry.ts

47 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-12-19 11:52:15 +08:00
import { DoricPluginClass } from "./DoricPlugin"
2019-12-19 13:34:56 +08:00
import { ShaderPlugin } from "./plugins/ShaderPlugin"
2019-12-19 20:44:14 +08:00
import { DoricViewNodeClass } from "./shader/DoricViewNode"
2019-12-20 17:28:24 +08:00
import { DoricStackNode } from "./shader/DoricStackNode"
import { DoricVLayoutNode } from './shader/DoricVLayoutNode'
import { DoricHLayoutNode } from './shader/DoricHLayoutNode'
2019-12-20 17:56:01 +08:00
import { DoricTextNode } from "./shader/DoricTextNode"
2019-12-21 16:37:55 +08:00
import { DoricImageNode } from "./shader/DoricImageNode"
2019-12-19 11:52:15 +08:00
const bundles: Map<string, string> = new Map
const plugins: Map<string, DoricPluginClass> = new Map
2019-12-19 20:44:14 +08:00
const nodes: Map<string, DoricViewNodeClass> = new Map
2019-12-19 11:52:15 +08:00
export function acquireJSBundle(name: string) {
return bundles.get(name)
}
export function registerJSBundle(name: string, bundle: string) {
bundles.set(name, bundle)
}
export function registerPlugin(name: string, plugin: DoricPluginClass) {
plugins.set(name, plugin)
}
export function acquirePlugin(name: string) {
return plugins.get(name)
}
2019-12-19 13:34:56 +08:00
2019-12-19 20:44:14 +08:00
export function registerViewNode(name: string, node: DoricViewNodeClass) {
nodes.set(name, node)
}
export function acquireViewNode(name: string) {
return nodes.get(name)
}
2019-12-19 13:34:56 +08:00
registerPlugin('shader', ShaderPlugin)
2019-12-19 20:44:14 +08:00
2019-12-20 17:28:24 +08:00
registerViewNode('Stack', DoricStackNode)
registerViewNode('VLayout', DoricVLayoutNode)
2019-12-20 17:56:01 +08:00
registerViewNode('HLayout', DoricHLayoutNode)
2019-12-21 16:37:55 +08:00
registerViewNode('Text', DoricTextNode)
registerViewNode('Image', DoricImageNode)