From cc4fa86c06c5a531d4b9cfd696134288dd73ad48 Mon Sep 17 00:00:00 2001 From: Sam Tsai Date: Thu, 20 Sep 2018 09:27:06 -0400 Subject: [PATCH] Make module name and typings consistent Change interface to use `printJS` both as an import as well as on window object. --- index.d.ts | 54 +++++++++++++++++++++++------------------------ src/index.js | 6 +++--- webpack.config.js | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/index.d.ts b/index.d.ts index ec65223..be8279e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,33 +3,33 @@ import 'print-js/dist/print'; declare type PrintTypes = 'pdf' | 'html' | 'image' | 'json'; export interface Configuration { - printable: any; - fallbackPrintable?: string; - type?: PrintTypes; - documentTitle?: string; - header?: any; - headerStyle?: string; - maxWidth?: number; - font?: string; - font_size?: string; - honorMarginPadding?: boolean; - honorColor?: boolean; - targetStyle?: string | string[]; - targetStyles?: string | string[]; - properties?: any; - gridHeaderStyle?: string; - gridStyle?: string; - showModal?: boolean; - onLoadingStart?: () => void; - onLoadingEnd?: () => void; - modalMessage?: string; - frameId?: string; - ignoreElements?: string | string[]; - imageStyle?: string; - repeatTableHeader?: boolean; - css?: string | string[]; - style?: string; - scanStyles?: boolean; + printable: any; + fallbackPrintable?: string; + type?: PrintTypes; + documentTitle?: string; + header?: any; + headerStyle?: string; + maxWidth?: number; + font?: string; + font_size?: string; + honorMarginPadding?: boolean; + honorColor?: boolean; + targetStyle?: string | string[]; + targetStyles?: string | string[]; + properties?: any; + gridHeaderStyle?: string; + gridStyle?: string; + showModal?: boolean; + onLoadingStart?: () => void; + onLoadingEnd?: () => void; + modalMessage?: string; + frameId?: string; + ignoreElements?: string | string[]; + imageStyle?: string; + repeatTableHeader?: boolean; + css?: string | string[]; + style?: string; + scanStyles?: boolean; } declare var printJS: (params: string | Configuration) => void; diff --git a/src/index.js b/src/index.js index f6bc169..e4e40a3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,10 +1,10 @@ import './sass/index.scss' import print from './js/init' -const printjs = print.init +const printJS = print.init if (typeof window !== 'undefined') { - window.printJS = printjs + window.printJS = printJS } -export default printjs +export default printJS diff --git a/webpack.config.js b/webpack.config.js index e589128..fc7b7af 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,7 +8,7 @@ module.exports = { './src/index.js' ], output: { - library: 'printJs', + library: 'printJS', libraryTarget: 'umd', path: path.resolve(__dirname, 'dist'), filename: 'print.js',