mirror of
https://github.com/status-im/status-go.git
synced 2025-01-13 08:05:40 +00:00
6a096607cf
This PR adds Fetch API and fixes #289 by using concurrency safe Otto VM wrapper wherever it's possible. This involves new package geth/jail/vm that is used by jail and by our forked ottoext/{fetch/timers/loop} packages. It also adds more tests that are supposed to be run with --race flag of go test.
18 lines
391 B
JavaScript
18 lines
391 B
JavaScript
const Request = require('./request');
|
|
const Response = require('./response');
|
|
|
|
export default function fetch(input, init) {
|
|
const req = new Request(input, init);
|
|
const res = new Response();
|
|
|
|
return new Promise((resolve, reject) => {
|
|
return __private__fetch_execute(req, res, err => {
|
|
if (err) {
|
|
return reject(err);
|
|
}
|
|
|
|
return resolve(res);
|
|
});
|
|
});
|
|
}
|