Plugin XML settings

This commit is contained in:
Michael Bykovski 2017-07-11 15:35:12 +02:00
parent fb261d6c67
commit ac5b47b1a0
3 changed files with 43 additions and 49 deletions

View File

@ -21,7 +21,7 @@
<source-file src="src/android/NanoHTTPDWebserver.java" target-dir="src/org/apache/cordova/plugin"/> <source-file src="src/android/NanoHTTPDWebserver.java" target-dir="src/org/apache/cordova/plugin"/>
<config-file target="config.xml" parent="/*"> <config-file target="config.xml" parent="/*">
<feature name="Webserver"> <feature name="Webserver">
<param name="android-package" value="Webserver"/> <param name="android-package" value="org.apache.cordova.plugin.Webserver"/>
</feature> </feature>
</config-file> </config-file>
</platform> </platform>

View File

@ -1,4 +1,3 @@
cordova.define("cordova-plugin-webserver-tests.tests", function(require, exports, module) {
exports.defineAutoTests = function() { exports.defineAutoTests = function() {
describe('Webserver (window.webserver)', function () { describe('Webserver (window.webserver)', function () {
@ -91,5 +90,3 @@ exports.defineManualTests = function(contentEl, createActionButton) {
); );
}); });
}; };
});

View File

@ -1,49 +1,46 @@
cordova.define("cordova-plugin-webserver.webserver", function(require, exports, module) { var WEBSERVER_CLASS = "Webserver";
var WEBSERVER_CLASS = "Webserver";
exports.start = function(success_callback, error_callback, port) { exports.start = function(success_callback, error_callback, port) {
cordova.exec( cordova.exec(
success_callback,
error_callback,
WEBSERVER_CLASS,
"start",
[port]
);
};
exports.onRequest = function(success_callback) {
cordova.exec(
success_callback,
function(error) {console.error(error)},
WEBSERVER_CLASS,
"onRequest",
[]
);
};
exports.sendResponse = function(
requestId,
params,
success_callback, success_callback,
error_callback error_callback,
) { WEBSERVER_CLASS,
cordova.exec( "start",
success_callback, [port]
error_callback, );
WEBSERVER_CLASS, };
"sendResponse",
[requestId, params]
);
};
exports.stop = function(success_callback, error_callback) { exports.onRequest = function(success_callback) {
cordova.exec( cordova.exec(
success_callback, success_callback,
error_callback, function(error) {console.error(error)},
WEBSERVER_CLASS, WEBSERVER_CLASS,
"stop", "onRequest",
[] []
); );
}; };
}); exports.sendResponse = function(
requestId,
params,
success_callback,
error_callback
) {
cordova.exec(
success_callback,
error_callback,
WEBSERVER_CLASS,
"sendResponse",
[requestId, params]
);
};
exports.stop = function(success_callback, error_callback) {
cordova.exec(
success_callback,
error_callback,
WEBSERVER_CLASS,
"stop",
[]
);
};