web:add source loader

This commit is contained in:
pengfei.zhou
2021-04-13 16:49:38 +08:00
committed by osborn
parent 17addc232a
commit ace3d30e73
5 changed files with 120 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
import axios from 'axios';
import { registerDoricJSLoader } from './src/DoricBundleLoader';
import { DoricElement } from './src/DoricElement'
import { NavigationElement } from './src/navigate/NavigationElement'
window.customElements.define('doric-div', DoricElement);
@@ -7,4 +9,12 @@ export * from './src/navigate/NavigationElement'
export * from './src/DoricPlugin'
export * from './src/DoricRegistry'
export * from './src/DoricDriver'
export * from './src/shader/DoricViewNode'
export * from './src/shader/DoricViewNode'
registerDoricJSLoader({
filter: (source) => source.startsWith("assets://"),
request: async (source) => {
const ret = await axios.get(source.replace("assets://", `${window.location.href}/../../doric-demo/bundle/`))
return ret.data
}
})