File tree Expand file tree Collapse file tree 1 file changed +18
-18
lines changed
examples/svelte-kit/src/routes Expand file tree Collapse file tree 1 file changed +18
-18
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { onDestroy , onMount } from " svelte" ;
2+ import { onDestroy , onMount } from " svelte" ;
33
4- const container: HTMLDivElement | null = null ;
5- let NutrientViewer: typeof import (" @nutrient-sdk/viewer" ).default | undefined ;
4+ let container: HTMLDivElement | null = null ;
5+ let NutrientViewer: typeof import (" @nutrient-sdk/viewer" ).default | undefined ;
66
7- onMount (async () => {
8- NutrientViewer = (await import (" @nutrient-sdk/viewer" )).default ;
9- if (container && NutrientViewer ) {
10- NutrientViewer .load ({
11- container ,
12- // you may also specify a file in public directory e.g. /document.pdf
13- document: " https://www.nutrient.io/downloads/pspdfkit-web-demo.pdf" ,
14- // baseUrl tells the SDK where to load the assets from
15- baseUrl: ` ${window .location .protocol }//${window .location .host }/${import .meta .env .PUBLIC_URL ?? " " } ` ,
16- });
17- }
18- });
7+ onMount (async () => {
8+ NutrientViewer = (await import (" @nutrient-sdk/viewer" )).default ;
9+ if (container && NutrientViewer ) {
10+ NutrientViewer .load ({
11+ container ,
12+ // you may also specify a file in public directory e.g. /document.pdf
13+ document: " https://www.nutrient.io/downloads/pspdfkit-web-demo.pdf" ,
14+ // baseUrl tells the SDK where to load the assets from
15+ baseUrl: ` ${window .location .protocol }//${window .location .host }/${import .meta .env .PUBLIC_URL ?? " " } ` ,
16+ });
17+ }
18+ });
1919
20- onDestroy (() => {
21- NutrientViewer ?.unload (container );
22- });
20+ onDestroy (() => {
21+ NutrientViewer ?.unload (container );
22+ });
2323 </script >
2424
2525<div class ="container" bind:this ={container }></div >
You can’t perform that action at this time.
0 commit comments