cordova-plugin-webserver/webserver.js

47 lines
795 B
JavaScript
Raw Normal View History

2017-07-11 21:35:12 +08:00
var WEBSERVER_CLASS = "Webserver";
2017-07-11 21:35:12 +08:00
exports.start = function(success_callback, error_callback, port) {
cordova.exec(
success_callback,
error_callback,
WEBSERVER_CLASS,
"start",
[port]
);
};
2017-07-11 21:35:12 +08:00
exports.onRequest = function(success_callback) {
cordova.exec(
success_callback,
2017-07-11 21:35:12 +08:00
function(error) {console.error(error)},
WEBSERVER_CLASS,
"onRequest",
[]
);
};
2017-07-11 21:35:12 +08:00
exports.sendResponse = function(
requestId,
params,
success_callback,
error_callback
) {
cordova.exec(
success_callback,
error_callback,
WEBSERVER_CLASS,
"sendResponse",
[requestId, params]
);
};
2017-07-11 21:35:12 +08:00
exports.stop = function(success_callback, error_callback) {
cordova.exec(
success_callback,
error_callback,
WEBSERVER_CLASS,
"stop",
[]
);
};