File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ npm i pdfeasy
3030```
3131
3232``` ts
33- import pdfeasy from ' pdfeasy'
33+ import { PDFEasy } from ' pdfeasy'
34+
35+ const pdfeasy = new PDFEasy ()
3436
3537pdfeasy .new ()
3638
Original file line number Diff line number Diff line change 1- import pdfeasy , { Utils } from 'pdfeasy'
1+ import { PDFEasy , Utils } from 'pdfeasy'
22import './style.css'
33
44const app = document . querySelector < HTMLDivElement > ( '#app' ) !
@@ -7,6 +7,8 @@ app.innerHTML = `
77 <iframe id="pdf">
88`
99
10+ const pdfeasy = new PDFEasy ( )
11+
1012pdfeasy . new ( {
1113 document : {
1214 margins : {
Original file line number Diff line number Diff line change 11import { fileURLToPath } from 'url'
22import { defineNuxtModule , addPlugin , createResolver } from '@nuxt/kit'
3- import PDFEASY from 'pdfeasy'
3+ import { PDFEasy } from 'pdfeasy'
44
55export interface ModuleOptions { }
66
@@ -24,12 +24,12 @@ export default defineNuxtModule<ModuleOptions>({
2424
2525declare module '#app' {
2626 interface NuxtApp {
27- $pdf : typeof PDFEASY
27+ $pdf : PDFEasy
2828 }
2929}
3030
3131declare module 'vue' {
3232 interface ComponentCustomProperties {
33- $pdf : typeof PDFEASY
33+ $pdf : PDFEasy
3434 }
3535}
Original file line number Diff line number Diff line change 11import { defineNuxtPlugin } from '#app'
2- import PDFEASY from 'pdfeasy'
2+ import { PDFEasy } from 'pdfeasy'
33
44export default defineNuxtPlugin ( ( { provide } ) => {
5- // @ts -expect-error
6- provide ( 'pdf' , PDFEASY . default as typeof PDFEASY )
5+ provide ( 'pdf' , new PDFEasy ( ) )
76} )
Original file line number Diff line number Diff line change 1- import PDFEasy from './runner/pdfeasy'
2-
3- export default new PDFEasy ( )
4-
5- export * as Utils from './utils'
6- export * as Types from './types'
1+ export * from './runner/pdfeasy'
2+
3+ export * as Utils from './utils'
4+ export * as Types from './types'
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { runPluginBackground } from '../plugins/background'
2727/**
2828 * A Base PDFEasy Runner
2929 */
30- export default class {
30+ export class PDFEasy {
3131 /**
3232 * A internal emitter.
3333 *
Original file line number Diff line number Diff line change 11import { App , Plugin } from 'vue-demi' ;
2- import pdfeasy from 'pdfeasy'
2+ import { PDFEasy } from 'pdfeasy'
33
44interface PluginOptions { }
55
66export const PDFPlugin : Plugin = {
77 install : ( app : App , options : PluginOptions = { } ) => {
8- // @ts -expect-error
9- app . config . globalProperties . $pdf = pdfeasy . default ;
8+ app . config . globalProperties . $pdf = new PDFEasy ( ) ;
109 } ,
1110} ;
1211
1312declare module "@vue/runtime-core" {
1413 interface ComponentCustomProperties {
15- $pdf : typeof pdfeasy ;
14+ $pdf : PDFEasy ;
1615 }
1716}
Original file line number Diff line number Diff line change 1- import pdfeasy from 'pdfeasy' ;
1+ import { PDFEasy } from 'pdfeasy' ;
22import { getCurrentInstance , ComponentInternalInstance } from 'vue-demi' ;
33
4- export const usePDF = ( ) : typeof pdfeasy => {
4+ export const usePDF = ( ) : PDFEasy => {
55 const instance = getCurrentInstance ( ) ;
66
77 if ( ! instance ) {
You can’t perform that action at this time.
0 commit comments