File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,7 @@ export default defineContentScript({
200
200
` ` ` ts [Svelte ]
201
201
// entrypoints/example-ui.content/index.ts
202
202
import App from ' ./App.svelte' ;
203
+ import { mount , unmount } from ' svelte' ;
203
204
204
205
export default defineContentScript ({
205
206
matches: [' <all_urls>' ],
@@ -210,14 +211,13 @@ export default defineContentScript({
210
211
anchor: ' body' ,
211
212
onMount : (container ) => {
212
213
// Create the Svelte app inside the UI container
213
- const app = new App ( {
214
+ mount ( App , {
214
215
target: container ,
215
216
});
216
- return app ;
217
217
},
218
218
onRemove : (app ) => {
219
219
// Destroy the app when the UI is removed
220
- app . $destroy ( );
220
+ unmount ( app );
221
221
},
222
222
});
223
223
@@ -381,6 +381,7 @@ export default defineContentScript({
381
381
// 1. Import the style
382
382
import ' ./style.css' ;
383
383
import App from ' ./App.svelte' ;
384
+ import { mount , unmount } from ' svelte' ;
384
385
385
386
export default defineContentScript ({
386
387
matches: [' <all_urls>' ],
@@ -395,14 +396,13 @@ export default defineContentScript({
395
396
anchor: ' body' ,
396
397
onMount : (container ) => {
397
398
// Create the Svelte app inside the UI container
398
- const app = new App ( {
399
+ mount ( App , {
399
400
target: container ,
400
401
});
401
- return app ;
402
402
},
403
- onRemove : (app ) => {
403
+ onRemove : () => {
404
404
// Destroy the app when the UI is removed
405
- app ?. $destroy ( );
405
+ unmount ( app );
406
406
},
407
407
});
408
408
You can’t perform that action at this time.
0 commit comments