Skip to content

Commit c8050cb

Browse files
committed
Saving the app context in the component
1 parent 7f39b1a commit c8050cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/component.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export function defineComponent({ render,
2828
#dispatcher = new Dispatcher();
2929
#subscriptions = []; // An array for the unsubscribe functions
3030
#children = []; // Slots
31+
#appContext = null;
3132

3233

3334
constructor(
@@ -164,10 +165,13 @@ export function defineComponent({ render,
164165
return Promise.resolve(onUnmounted.call(this));
165166
}
166167

167-
// async onMounted() {
168-
// const data = await fetch('https://api.example.com/data')
169-
// this.updateState({ data })
170-
// }
168+
setAppContext(appContext) {
169+
this.#appContext = appContext;
170+
}
171+
172+
get appContext() {
173+
return this.#appContext;
174+
}
171175
}
172176

173177
for (const methodName in methods) {

0 commit comments

Comments
 (0)