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:
parent
ca7f0ce461
commit
37b6fa7a1b
|
@ -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]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue