DEV: refactor JS files to not use `self = this` in code. (#15095)

We no longer use this pattern. Instead, we can use javascript arrow functions.
This commit is contained in:
Vinoth Kannan 2022-02-28 16:57:32 +05:30 committed by GitHub
parent ca7f0ce461
commit 37b6fa7a1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -170,12 +170,11 @@ export default Component.extend(LoadMore, {
},
click(e) {
let self = this;
let onClick = function (sel, callback) {
const onClick = (sel, callback) => {
let target = $(e.target).closest(sel);
if (target.length === 1) {
callback.apply(self, [target]);
callback.apply(this, [target]);
}
};

View File

@ -5,13 +5,12 @@ import { debounce } from "@ember/runloop";
Original function will be called with the context and arguments from the last call made.
**/
export default function (func, wait) {
let self, args;
const later = function () {
func.apply(self, args);
let args;
const later = () => {
func.apply(this, args);
};
return function () {
self = this;
args = arguments;
debounce(null, later, wait);