You've already forked joplin
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:
15
ReactNativeClient/lib/shim.js
Normal file
15
ReactNativeClient/lib/shim.js
Normal 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 };
|
||||
Reference in New Issue
Block a user