Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion types/qz-tray/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export interface ConnectOptions {
};
usingSecure?: boolean;
keepAlive?: number;
retries?: number;
delay?: number;
}

export interface GetConnectionInfoResponse {
Expand Down Expand Up @@ -474,7 +476,7 @@ export interface Security {
options?: SetCertificatePromiseOptions,
) => void;
setSignatureAlgorithm: (algorithm: Algorithm) => void;
setSignaturePromise: (promiseFactory: PromiseFactory) => void;
setSignaturePromise: (promiseFactory: PromiseFactory | ((dataToSign: string) => Promise<string>)) => void;
}

export interface Serial {
Expand Down
5 changes: 5 additions & 0 deletions types/qz-tray/qz-tray-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ const stopListeningPrintersFn = async () => qz.printers.stopListening();
qz.security.getSignatureAlgorithm();
qz.security.setCertificatePromise((resolve) => resolve());
qz.security.setSignatureAlgorithm("SHA512");
const signaturePromiseAsync = async (dataToSign: string): Promise<string> => {
return await "signed_request";
};
qz.security.setSignaturePromise((dataToSign) => (resolve) => resolve(dataToSign));
qz.security.setSignaturePromise(signaturePromiseAsync);
const closePortFn = async () => qz.serial.closePort("6000");
const findPortsFn = async () => qz.serial.findPorts();
const openPortFn = async () => qz.serial.openPort("6000");
Expand Down Expand Up @@ -110,6 +114,7 @@ const sendDataUsbFn = async () =>
qz.usb.setUsbCallbacks(() => doSomething());
qz.websocket.getNetworkInfo();
const connectFn = async () => qz.websocket.connect();
const connectFnWithOptions = async () => qz.websocket.connect({ retries: 10, delay: 3 });
const disconnectFn = async () => qz.websocket.disconnect();
const getConnectionInfoFn = async () => qz.websocket.getConnectionInfo();
qz.websocket.isActive();
Expand Down