2022-06-25 00:31:39 +08:00
|
|
|
import 'iframe-resizer/js/iframeResizer.contentWindow'
|
|
|
|
import './style.scss'
|
|
|
|
|
2023-07-01 03:03:49 +08:00
|
|
|
import { debug, splitName } from './helper.js'
|
2022-06-25 00:31:39 +08:00
|
|
|
|
|
|
|
export default function init(name: string, source: any) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.source = source
|
|
|
|
document.title = name
|
|
|
|
|
2023-06-02 00:21:47 +08:00
|
|
|
const [demoCategory, demoName, frameworkName] = splitName(name)
|
2022-06-25 00:31:39 +08:00
|
|
|
|
2023-06-02 00:21:47 +08:00
|
|
|
import(`../src/${demoCategory}/${demoName}/${frameworkName}/index.svelte`)
|
2022-06-25 00:31:39 +08:00
|
|
|
.then(Module => {
|
|
|
|
const Component = Module.default
|
|
|
|
|
|
|
|
new Component({ target: document.querySelector('#app') }) // eslint-disable-line
|
|
|
|
|
|
|
|
debug()
|
|
|
|
})
|
|
|
|
}
|