Ember.js V5 - Ember Jquery Legacy

This codemod ensures access to the native event without triggering any deprecations via wrapping the event with the normalizeEvent function provided by ember-jquery-legacy.

Ember.js
jscodeshift
Estimated time saving
5 minutes/occurrence
Change mode
Autonomous
Applicability criteria

Ember.js version higher or equal to 3.3.

Made by
Rajasegar Chandran
Rajasegar Chandran

Usage →

Codemod CLI:

intalling vs code extension tooltip icon
codemod ember/5/ember-jquery-legacy
copy CLI command icon

Codemod VS Code extension:

intalling vs code extension tooltip icon
vs code logo
Run in VS Code

Use/edit codemod in Codemod Studio:

intuita logo without text
Open in Codemod Studio

Description

Using event object APIs that are specific to jQuery.Event, such as originalEvent, is deprecated in Ember.js v3.3. This codemod ensures the access to the native event without triggering any deprecations via wrapping the event with the normalizeEvent function provided by ember-jquery-legacy.

Example

Before:

export default Component.extend({
	click(event) {
		let nativeEvent = event.originalEvent;
	},
});

After:

import { normalizeEvent } from 'ember-jquery-legacy';

export default Component.extend({
	click(event) {
		let nativeEvent = normalizeEvent(event);
	},
});