mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-04-24 00:00:03 +08:00
867b8ea202
- implement checks for #101 - add some specs
23 lines
600 B
JavaScript
23 lines
600 B
JavaScript
module.exports = function init(FormData, console, messages) {
|
||
var interface = {
|
||
checkFormDataApi: checkFormDataApi,
|
||
logWarnings: logWarnings,
|
||
};
|
||
|
||
return interface;
|
||
|
||
function logWarnings() {
|
||
if (!FormData) {
|
||
console.warn(messages.MISSING_FORMDATA_API);
|
||
} else if (!FormData.prototype || !FormData.prototype.entries) {
|
||
console.warn(messages.MISSING_FORMDATA_ENTRIES_API);
|
||
}
|
||
}
|
||
|
||
function checkFormDataApi() {
|
||
if (!FormData || !FormData.prototype || !FormData.prototype.entries) {
|
||
throw new Error(messages.MISSING_FORMDATA_ENTRIES_API);
|
||
}
|
||
}
|
||
};
|