question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Before event - can not cancel request

See original GitHub issue

Potrebujem 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:closed
  • Created 5 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jiripudilcommented, May 29, 2019

It’s hidden here and editable in the docs/ directory in this repo. I should probably move it to a more prominent place 😃

0reactions
jiripudilcommented, Aug 21, 2020

I’m closing this as it’s resolved in 2.0 which is coming out Very Soon™

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found