Comments (4)
xhook.after
handlers cannot be asynchronous, can you use xhook.before
instead?
from xhook.
How? Or does it possible to make ajax call later, so the asyncData can be received before xhook.after
from xhook.
How to use xhook.before
asynchronous. Does it means in xhook.before
we can wait for remote data and change response? Could you show a snippet code? thanks
from xhook.
hi @jasonzhuang
xhook.before
will hold your request until you call xhook callback, so you can do anything in the meantime and xhook will hold the request until you're ready to give it data by providing it to the callback.
Please see the examples at:
http://jpillora.com/xhook/
And specifically the fake response example:
http://jpillora.com/xhook/#fake-response
from xhook.
Related Issues (20)
- can't post formData HOT 2
- How to get the request in the iframe HOT 1
- Warning 'Event.path' is deprecated and will be removed in M109, around January 2023. Please use 'Event.composedPath()' instead HOT 1
- Slowing down the network calls HOT 2
- Errors are passed to Promise.resolve instead of Promise.reject with xhook 1.4.9 HOT 6
- Automate release process HOT 10
- Speed up tests
- Some files are unnecessary. HOT 1
- Automatic Github releases using conventional commits
- xhook breaks `navigator.sendBeacon(url, formData)` HOT 6
- Change the output of xhook in src/main.js HOT 1
- FormData fails all calls - testing solution but can't make it work at all HOT 17
- Before handlers for fetch(new Request('/foo')) requests : 1) sync handlers get no information; 2) sync and async can't change request parameters or replace the Request instance.
- When other programs modify XMLHttpRequest.prototype., xhook will not work HOT 1
- [Question] How to skip certain URL (some URL use mock data and some still go to real API )? HOT 1
- When you use xhr.response to read response data, the hook becomes invalid
- [Bug] Unable to retrieve the requested URL in the response
- The HTTP field name should be lowercase
- [Bug] The default value of XHR's response is incorrect
- [Bug] isFetch parameter is undefined
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xhook.