1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Make fetch and FormData work in both RN and node

This commit is contained in:
Laurent Cozic
2017-07-06 18:58:01 +00:00
parent 9e3a2a894e
commit bdb250de8a
6 changed files with 224 additions and 105 deletions

View File

@@ -0,0 +1,15 @@
let shim = {};
shim.fetch = typeof fetch !== 'undefined' ? fetch : null;
if (!shim.fetch) {
let moduleName = 'node-fetch';
shim.fetch = require(moduleName);
}
if (!shim.FormData) {
let moduleName = 'form-data';
shim.FormData = require(moduleName);
}
export { shim };