quickjs-android icon indicating copy to clipboard operation
quickjs-android copied to clipboard

I use axios in js, but throw error

Open s949492225 opened this issue 3 years ago • 1 comments

I use axios in js, but throw error is this not support axios?

s949492225 avatar Oct 13 '21 07:10 s949492225

No. Axios requires http API in Node.js, or XMLHttpRequests in a browser. But QuickJS is only a js interpreter. No dom, no Node.js API.

It's still possible to make http requests. You can call any java code in js like this. https://github.com/seven332/quickjs-android/blob/wrapper/library/src/androidTest/java/com/hippo/quickjs/android/JSFunctionCallbackTest.java#L14

seven332 avatar Oct 13 '21 09:10 seven332