How to use the qz-tray.api function in qz-tray

To help you get started, we’ve selected a few qz-tray examples, based on popular ways it is used in public projects.

github qzind / tray / assets / signing / sign-message.ts View on Github external
/*
 * Preferred, from a secure controller
 *
 qz.security.setSignaturePromise(hash => {
  return (resolve, reject) => {
   fetch("/path/to/controller?request=" + hash, {cache: 'no-store', headers: {'Content-Type': 'text/plain'}})
    .then(wrapped => wrapped.text())
    .then(data => resolve(data))
    .catch(err => console.error(err));
   });
  };
 });
 */

qz.api.setSha256Type(data => sha256(data));
qz.api.setPromiseType(resolver => new Promise(resolver));

qz.websocket.connect()
 .then(qz.printers.getDefault)
 .then(printer => console.log("The default printer is: " + printer))
 .then(qz.websocket.disconnect)
 .catch(err => console.error(err));

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'QZ Tray AngularJS Signing';
}
github qzind / tray / assets / signing / sign-message.ts View on Github external
/*
 * Preferred, from a secure controller
 *
 qz.security.setSignaturePromise(hash => {
  return (resolve, reject) => {
   fetch("/path/to/controller?request=" + hash, {cache: 'no-store', headers: {'Content-Type': 'text/plain'}})
    .then(wrapped => wrapped.text())
    .then(data => resolve(data))
    .catch(err => console.error(err));
   });
  };
 });
 */

qz.api.setSha256Type(data => sha256(data));
qz.api.setPromiseType(resolver => new Promise(resolver));

qz.websocket.connect()
 .then(qz.printers.getDefault)
 .then(printer => console.log("The default printer is: " + printer))
 .then(qz.websocket.disconnect)
 .catch(err => console.error(err));

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'QZ Tray AngularJS Signing';
}

qz-tray

Connects a web client to the QZ Tray software. Enables printing and device communication from javascript.

LGPL-2.1
Latest version published 10 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages