Renamed isAvailable to check

This commit is contained in:
Sebastián Katzer 2016-08-03 17:20:10 +02:00
parent a1dc163ccc
commit 7d38b4e354
5 changed files with 34 additions and 27 deletions

View File

@ -117,8 +117,8 @@ public class Printer extends CordovaPlugin {
command = callback; command = callback;
if (action.equalsIgnoreCase("isAvailable")) { if (action.equalsIgnoreCase("check")) {
isAvailable(); check();
return true; return true;
} }
@ -139,7 +139,7 @@ public class Printer extends CordovaPlugin {
* Informs if the device is able to print documents. * Informs if the device is able to print documents.
* A Internet connection is required to load the cloud print dialog. * A Internet connection is required to load the cloud print dialog.
*/ */
private void isAvailable () { private void check () {
cordova.getThreadPool().execute(new Runnable() { cordova.getThreadPool().execute(new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -25,11 +25,11 @@
@interface APPPrinter : CDVPlugin <UIWebViewDelegate> @interface APPPrinter : CDVPlugin <UIWebViewDelegate>
// Prints the content
- (void) print:(CDVInvokedUrlCommand*)command;
// Find out whether printing is supported on this platform // Find out whether printing is supported on this platform
- (void) isAvailable:(CDVInvokedUrlCommand*)command; - (void) check:(CDVInvokedUrlCommand*)command;
// Displays system interface for selecting a printer // Displays system interface for selecting a printer
- (void) pick:(CDVInvokedUrlCommand*)command; - (void) pick:(CDVInvokedUrlCommand*)command;
// Prints the content
- (void) print:(CDVInvokedUrlCommand*)command;
@end @end

View File

@ -41,7 +41,7 @@
* @param {Function} callback * @param {Function} callback
* A callback function to be called with the result * A callback function to be called with the result
*/ */
- (void) isAvailable:(CDVInvokedUrlCommand*)command - (void) check:(CDVInvokedUrlCommand*)command
{ {
[self.commandDelegate runInBackground:^{ [self.commandDelegate runInBackground:^{
CDVPluginResult* pluginResult; CDVPluginResult* pluginResult;

View File

@ -34,7 +34,7 @@ var Printing = Windows.Graphics.Printing,
* @param {Array} args * @param {Array} args
* Interface arguments * Interface arguments
*/ */
exports.isAvailable = function (success, fail, args) { exports.check = function (success, fail, args) {
success(MSApp.hasOwnProperty('getHtmlPrintDocumentSourceAsync'), 0); success(MSApp.hasOwnProperty('getHtmlPrintDocumentSourceAsync'), 0);
}; };

View File

@ -54,10 +54,17 @@ exports.getDefaults = function () {
* *
* @return {Boolean} * @return {Boolean}
*/ */
exports.isAvailable = function (callback, scope) { exports.check = function (callback, scope) {
var fn = this._createCallbackFn(callback); var fn = this._createCallbackFn(callback);
exec(fn, null, 'Printer', 'isAvailable', []); exec(fn, null, 'Printer', 'check', []);
};
/**
* @deprecated API call. Use `check` instead!
*/
exports.isAvailable = function () {
exports.check.apply(exports, arguments);
}; };
/** /**