Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implicit this, runloop, and assign issues #791

Merged
merged 3 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update runloop imports
  • Loading branch information
RobbieTheWagner committed Jul 13, 2022
commit 0c7a87baf0d96c72c7b4ac218d97fb463e2aaa8b
20 changes: 10 additions & 10 deletions addon/components/lt-body.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { deprecate } from '@ember/application/deprecations';
import { computed, observer } from '@ember/object';
import { readOnly } from '@ember/object/computed';
import layout from 'ember-light-table/templates/components/lt-body';
import { run } from '@ember/runloop';
import { cancel, debounce, once, schedule, scheduleOnce } from '@ember/runloop';
import Row from 'ember-light-table/classes/Row';

/**
Expand Down Expand Up @@ -331,7 +331,7 @@ export default Component.extend({
/*
Continue scheduling onScrolledToBottom until no longer in viewport
*/
this._schedulerTimer = run.scheduleOnce(
this._schedulerTimer = scheduleOnce(
'afterRender',
this,
this._debounceScrolledToBottom
Expand All @@ -349,7 +349,7 @@ export default Component.extend({
been initialized since fixedHeader and fixedFooter are set on t.head and t.foot
initialization.
*/
run.once(this, this._setupVirtualScrollbar);
once(this, this._setupVirtualScrollbar);
},

didReceiveAttrs() {
Expand All @@ -368,7 +368,7 @@ export default Component.extend({
},

onRowsChange: observer('rows.[]', function () {
this._checkTargetOffsetTimer = run.scheduleOnce(
this._checkTargetOffsetTimer = scheduleOnce(
'afterRender',
this,
this.checkTargetScrollOffset
Expand Down Expand Up @@ -417,7 +417,7 @@ export default Component.extend({

if (targetScrollOffset > currentScrollOffset) {
this.set('targetScrollOffset', null);
this._setTargetOffsetTimer = run.schedule('render', null, () => {
this._setTargetOffsetTimer = schedule('render', null, () => {
this.set('targetScrollOffset', targetScrollOffset);
});
} else {
Expand Down Expand Up @@ -446,17 +446,17 @@ export default Component.extend({
This debounce is needed when there is not enough delay between onScrolledToBottom calls.
Without this debounce, all rows will be rendered causing immense performance problems
*/
this._debounceTimer = run.debounce(this, this.onScrolledToBottom, delay);
this._debounceTimer = debounce(this, this.onScrolledToBottom, delay);
},

/**
* @method _cancelTimers
*/
_cancelTimers() {
run.cancel(this._checkTargetOffsetTimer);
run.cancel(this._setTargetOffsetTimer);
run.cancel(this._schedulerTimer);
run.cancel(this._debounceTimer);
cancel(this._checkTargetOffsetTimer);
cancel(this._setTargetOffsetTimer);
cancel(this._schedulerTimer);
cancel(this._debounceTimer);
},

// Noop for closure actions
Expand Down
6 changes: 3 additions & 3 deletions addon/mixins/draggable-column.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Mixin from '@ember/object/mixin';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { cancel, next } from '@ember/runloop';

let sourceColumn;

Expand Down Expand Up @@ -125,7 +125,7 @@ export default Mixin.create({
/*
Restore click event
*/
this._clickResetTimer = run.next(this, () => (this.click = this.__click__));
this._clickResetTimer = next(this, () => (this.click = this.__click__));
},

drop(e) {
Expand Down Expand Up @@ -156,7 +156,7 @@ export default Mixin.create({

destroy() {
this._super(...arguments);
run.cancel(this._clickResetTimer);
cancel(this._clickResetTimer);
},

// Noop for passed actions
Expand Down