Skip to content

Commit

Permalink
Make module name and typings consistent
Browse files Browse the repository at this point in the history
Change interface to use `printJS` both as an import as well
as on window object.
  • Loading branch information
Sam Tsai committed Sep 20, 2018
1 parent ceac6c1 commit cc4fa86
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
54 changes: 27 additions & 27 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'./src/index.js'
],
output: {
library: 'printJs',
library: 'printJS',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'dist'),
filename: 'print.js',
Expand Down

0 comments on commit cc4fa86

Please sign in to comment.