Skip to content

Commit f440ea8

Browse files
committed
fix: removed unused functions
1 parent 0851f24 commit f440ea8

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

src/index.js

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import observer from '@cocreate/observer';
22

3-
export function addComponent(key, component) {
4-
this[key] = component;
5-
}
6-
7-
export function removeComponent(key) {
8-
if (this[key]) {}
9-
}
10-
113
function listen(callback, selector) {
124

135
function observerCallback({ target }) {
@@ -54,24 +46,16 @@ function listen(callback, selector) {
5446

5547
}
5648

57-
export async function lazyLoad(name, selector, cb) {
58-
async function cc() {
59-
let component = (await cb()).default;
60-
Object.assign(window.CoCreate, {
61-
[name]: component
62-
})
63-
}
64-
49+
export async function lazyLoad(name, selector, callback) {
6550
if (document.querySelector(selector))
66-
await cc()
51+
await dependency(name, await callback())
6752
else
68-
listen(cc, selector)
69-
53+
listen(callback, selector)
7054
}
7155

7256
export async function dependency(name, promise) {
73-
let module = await promise;
57+
let component = await promise;
7458
Object.assign(window.CoCreate, {
75-
[name]: module.default
59+
[name]: component.default
7660
});
7761
}

0 commit comments

Comments
 (0)