Before event - can not cancel request
See original GitHub issuePotrebujem zrušiť ajax request (class=“ajax”). Keď zavolám event.preventDefault()
v naja before evente request úspešne pokračuje ďalej. Takýto request neobsahuje X-Requested-With: XMLHttpRequest, čiže vráti celú stránku.
export default class TestPreventDefaultExtension {
constructor(naja) {
naja.addEventListener('init', () => {
console.log('naja: init');
});
naja.addEventListener('load', () => {
console.log('naja: load');
});
naja.addEventListener('interaction', () => {
console.log('naja: interaction');
});
naja.addEventListener('before', event => {
console.log('naja: before');
event.preventDefault();
// ajax request continue to 'start', 'success' and 'complete' event
// request - status: 200 type: xhr
});
naja.addEventListener('start', () => {
console.log('naja: start');
});
naja.addEventListener('abort', () => {
console.log('naja: abort');
});
naja.addEventListener('success', () => {
console.log('naja: success');
});
naja.addEventListener('error', () => {
console.log('naja: error');
});
naja.addEventListener('complete', () => {
console.log('naja: complete');
});
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
How to Cancel an Event with the Least Drama (with Sample ...
Knowing how to cancel an event with grace can help smooth bad feelings. Jump to the event cancellation email.
Read more >Event Postponement and Cancellation Guide | Cvent Blog
Sometimes, event postponement and cancellation is a step that you have to take. We'll walk through best practices for postponing and ...
Read more >Event.cancelable - Web APIs - MDN Web Docs
To cancel an event, call the preventDefault() method on the event. This keeps the implementation from executing the default action that is ......
Read more >Cancel a meeting - Microsoft Support
Type a message to let the attendees know the meeting is cancelled. It's not necessary, but it helps to avoid confusion. Click Send...
Read more >Events: Cancelling an Event - Handshake Help Center
There may be times when an event needs to be canceled in Handshake. This article will provide an outline of the steps required...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s hidden here and editable in the
docs/
directory in this repo. I should probably move it to a more prominent place 😃I’m closing this as it’s resolved in 2.0 which is coming out Very Soon™