forked from tojocky/node-printer
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Typescript typings, bump to 0.6.0 (#39)
* Add typings * Update README * Update readme with main branch
- Loading branch information
Showing
5 changed files
with
88 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": [ | ||
"es6" | ||
], | ||
"noImplicitAny": true, | ||
"noImplicitThis": true, | ||
"strictFunctionTypes": true, | ||
"strictNullChecks": true, | ||
"baseUrl": "../", | ||
"typeRoots": [ | ||
"../" | ||
], | ||
"types": [], | ||
"noEmit": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"types/index.d.ts", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export function getPrinters(): PrinterDetails[]; | ||
export function getPrinter(printerName: string): PrinterDetails; | ||
export function getPrinterDriverOptions(printerName: string): PrinterDriverOptions; | ||
export function getSelectedPaperSize(printerName: string): string; | ||
export function getDefaultPrinterName(): string | undefined; | ||
export function printDirect(options: PrintDirectOptions): void; | ||
export function printFile(options: PrintFileOptions): void; | ||
export function getSupportedPrintFormats(): string[]; | ||
export function getJob(printerName: string, jobId: number): JobDetails; | ||
export function setJob(printerName: string, jobId: number, command: 'CANCEL' | string): void; | ||
export function getSupportedJobCommands(): string[]; | ||
|
||
export interface PrintDirectOptions { | ||
data: string | Buffer; | ||
printer?: string | undefined; | ||
type?: 'RAW' | 'TEXT' | 'PDF' | 'JPEG' | 'POSTSCRIPT' | 'COMMAND' | 'AUTO' | undefined; | ||
options?: { [key: string]: string } | undefined; | ||
success?: PrintOnSuccessFunction | undefined; | ||
error?: PrintOnErrorFunction | undefined; | ||
} | ||
|
||
export interface PrintFileOptions { | ||
filename: string; | ||
printer?: string | undefined; | ||
success?: PrintOnSuccessFunction | undefined; | ||
error?: PrintOnErrorFunction | undefined; | ||
} | ||
|
||
export type PrintOnSuccessFunction = (jobId: string) => any; | ||
export type PrintOnErrorFunction = (err: Error) => any; | ||
|
||
export interface PrinterDetails { | ||
name: string; | ||
isDefault: boolean; | ||
options: { [key: string]: string; }; | ||
} | ||
|
||
export interface PrinterDriverOptions { | ||
[key: string]: { [key: string]: boolean; }; | ||
} | ||
|
||
export interface JobDetails { | ||
id: number; | ||
name: string; | ||
printerName: string; | ||
user: string; | ||
format: string; | ||
priority: number; | ||
size: number; | ||
status: JobStatus[]; | ||
completedTime: Date; | ||
creationTime: Date; | ||
processingTime: Date; | ||
} | ||
|
||
export type JobStatus = 'PAUSED' | 'PRINTING' | 'PRINTED' | 'CANCELLED' | 'PENDING' | 'ABORTED'; |