-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
125 lines (125 loc) · 5.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Injectable } from '@angular/core';
import { Cordova, CordovaCheck, Plugin, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Printer
* @description Prints documents or HTML rendered content
* @usage
* ```typescript
* import { Printer, PrintOptions } from '@ionic-native/printer';
*
* constructor(private printer: Printer) { }
*
* ...
*
* this.printer.isAvailable().then(onSuccess, onError);
*
* let options: PrintOptions = {
* name: 'MyDocument',
* printerId: 'printer007',
* duplex: true,
* landscape: true,
* grayscale: true
* };
*
* this.printer.print(content, options).then(onSuccess, onError);
* ```
* @interfaces
* PrintOptions
*/
var Printer = (function (_super) {
__extends(Printer, _super);
function Printer() {
return _super !== null && _super.apply(this, arguments) || this;
}
Printer_1 = Printer;
/**
* Checks whether the device is capable of printing (uses `check()` internally)
* @returns {Promise<boolean>}
*/
Printer.prototype.isAvailable = function () {
return this.check()
.then(function (res) { return Promise.resolve(res.avail); });
};
/**
* Checks if the printer service is available (iOS) or if printer services are installed and enabled (Android).
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available, and providing the number of printers available
*/
Printer.prototype.check = function () {
return new Promise(function (resolve) {
Printer_1.getPlugin()
.check(function (avail, count) {
resolve({ avail: avail, count: count });
});
});
};
/**
* Displays a system interface allowing the user to select an available printer. To speak with a printer directly you need to know the network address by picking them before via `printer.pick`.
* @returns {Promise<any>}
*/
Printer.prototype.pick = function () { return; };
/**
* Sends content to the printer.
* @param content {string | HTMLElement} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
* @param options {PrintOptions} optional. The options to pass to the printer
* @returns {Promise<any>}
*/
Printer.prototype.print = function (content, options) { return; };
Printer.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Printer.ctorParameters = function () { return []; };
__decorate([
CordovaCheck(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], Printer.prototype, "check", null);
__decorate([
Cordova(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], Printer.prototype, "pick", null);
__decorate([
Cordova({
successIndex: 2,
errorIndex: 4
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Object]),
__metadata("design:returntype", Promise)
], Printer.prototype, "print", null);
Printer = Printer_1 = __decorate([
Plugin({
pluginName: 'Printer',
plugin: 'de.appplant.cordova.plugin.printer',
pluginRef: 'cordova.plugins.printer',
repo: 'https://github.com/katzer/cordova-plugin-printer',
platforms: ['Android', 'iOS', 'Windows']
})
], Printer);
return Printer;
var Printer_1;
}(IonicNativePlugin));
export { Printer };
//# sourceMappingURL=index.js.map