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

chore: get rid of deprecation - deprecated-run-loop-and-computed-dot-access #1242

Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions addon/components/paper-dialog-inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import Component from '@ember/component';

import { run } from '@ember/runloop';
import { bind } from '@ember/runloop';
import Translate3dMixin from '../mixins/translate3d-mixin';

/**
Expand Down Expand Up @@ -42,7 +42,7 @@ export default Component.extend(Translate3dMixin, {
this.checkContentOverflow();
// content overflow might change depending on load of images inside dialog.
let imageElements = this.element.querySelectorAll('img');
this._checkContentOverflowOnLoad = run.bind(this, this.checkContentOverflow);
this._checkContentOverflowOnLoad = bind(this, this.checkContentOverflow);
imageElements.forEach((image) => {
image.addEventListener('load', this._checkContentOverflowOnLoad);
});
Expand Down
10 changes: 5 additions & 5 deletions addon/components/paper-grid-list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable ember/no-computed-properties-in-native-classes, ember/classic-decorator-no-classic-methods, ember/no-classic-components, ember/require-tagless-components, ember/no-component-lifecycle-hooks, ember/no-get */
/* eslint-disable ember/no-computed-properties-in-native-classes, ember/classic-decorator-no-classic-methods, ember/no-classic-components, ember/no-component-lifecycle-hooks, ember/no-get */
/**
* @module ember-paper
*/
Expand All @@ -7,7 +7,7 @@ import { inject as service } from '@ember/service';
import { tagName, layout } from '@ember-decorators/component';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { bind, debounce } from '@ember/runloop';
import template from '../templates/components/paper-grid-list';
import { ParentMixin } from 'ember-composability-tools';
import gridLayout from '../utils/grid-layout';
Expand Down Expand Up @@ -56,7 +56,7 @@ export default class PaperGridList extends Component.extend(ParentMixin) {
super.didUpdate(...arguments);

// Debounces until the next run loop
run.debounce(this, this.updateGrid, 0);
debounce(this, this.updateGrid, 0);
}

willDestroyElement() {
Expand All @@ -75,7 +75,7 @@ export default class PaperGridList extends Component.extend(ParentMixin) {
this.set(`${listenerName}List`, mediaList);

// Creates a function based on mediaName so that removeListener can remove it.
this.set(listenerName, run.bind(this, (result) => {
this.set(listenerName, bind(this, (result) => {
this._mediaDidChange(mediaName, result.matches);
}));

Expand All @@ -98,7 +98,7 @@ export default class PaperGridList extends Component.extend(ParentMixin) {
this.set(mediaName, matches);

// Debounces until the next run loop
run.debounce(this, this._updateCurrentMedia, 0);
debounce(this, this._updateCurrentMedia, 0);
}

_updateCurrentMedia() {
Expand Down
4 changes: 2 additions & 2 deletions addon/components/paper-grid-tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { computed } from '@ember/object';
import { alias } from '@ember/object/computed';

import Component from '@ember/component';
import { run } from '@ember/runloop';
import { debounce } from '@ember/runloop';
import layout from '../templates/components/paper-grid-tile';
import { ChildMixin } from 'ember-composability-tools';
import { invokeAction } from 'ember-paper/utils/invoke-action';
Expand Down Expand Up @@ -42,7 +42,7 @@ export default class PaperGridTile extends Component.extend(ChildMixin) {
let gridList = this.gridList;

// Debounces until the next run loop
run.debounce(gridList, gridList.updateGrid, 0);
debounce(gridList, gridList.updateGrid, 0);
}

updateTile() {
Expand Down
6 changes: 3 additions & 3 deletions addon/components/paper-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { or, bool, and } from '@ember/object/computed';
import Component from '@ember/component';
import { computed, set } from '@ember/object';
import { isEmpty } from '@ember/utils';
import { run } from '@ember/runloop';
import { bind, next } from '@ember/runloop';
import { assert } from '@ember/debug';
import layout from '../templates/components/paper-input';
import FocusableMixin from 'ember-paper/mixins/focusable-mixin';
Expand Down Expand Up @@ -102,7 +102,7 @@ export default Component.extend(FocusableMixin, ColorMixin, ChildMixin, Validati
didInsertElement() {
this._super(...arguments);
if (this.textarea) {
this._growTextareaOnResize = run.bind(this, this.growTextarea);
this._growTextareaOnResize = bind(this, this.growTextarea);
window.addEventListener('resize', this._growTextareaOnResize);
}
},
Expand Down Expand Up @@ -184,7 +184,7 @@ export default Component.extend(FocusableMixin, ColorMixin, ChildMixin, Validati
handleInput(e) {
invokeAction(this, 'onChange', e.target.value);
// setValue below ensures that the input value is the same as this.value
run.next(() => {
next(() => {
if (this.isDestroyed) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions addon/components/paper-sidenav-inner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { inject as service } from '@ember/service';
import Component from '@ember/component';
import layout from '../templates/components/paper-sidenav-inner';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { bind } from '@ember/runloop';
import { invokeAction } from 'ember-paper/utils/invoke-action';

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ export default Component.extend({

didInsertElement() {
this._super(...arguments);
this._updateOnResize = run.bind(this, this.updateLockedOpen);
this._updateOnResize = bind(this, this.updateLockedOpen);
window.addEventListener('resize', this._updateOnResize);
this.updateLockedOpen();
},
Expand Down
4 changes: 2 additions & 2 deletions addon/components/paper-speed-dial.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components, ember/require-tagless-components, ember/no-component-lifecycle-hooks */
import Component from '@ember/component';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { next } from '@ember/runloop';
import layout from '../templates/components/paper-speed-dial';
import { invokeAction } from 'ember-paper/utils/invoke-action';

Expand Down Expand Up @@ -55,7 +55,7 @@ export default Component.extend({

didRender() {
this._super(...arguments);
run.next(() => {
next(() => {
if (!this.isDestroyed && !this.isDestroying) {
this.set('elementDidRender', true);
}
Expand Down
12 changes: 6 additions & 6 deletions addon/components/paper-switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { assert } from '@ember/debug';
import { get, computed } from '@ember/object';
import { run } from '@ember/runloop';
import { bind } from '@ember/runloop';
import { htmlSafe } from '@ember/string';
import layout from '../templates/components/paper-switch';
import FocusableMixin from 'ember-paper/mixins/focusable-mixin';
Expand Down Expand Up @@ -86,15 +86,15 @@ export default Component.extend(FocusableMixin, ColorMixin, ProxiableMixin, {

// Enable dragging the switch container
switchHammer.get('pan').set({ threshold: 1 });
switchHammer.on('panstart', run.bind(this, this._dragStart))
.on('panmove', run.bind(this, this._drag))
.on('panend', run.bind(this, this._dragEnd));
switchHammer.on('panstart', bind(this, this._dragStart))
.on('panmove', bind(this, this._drag))
.on('panend', bind(this, this._dragEnd));

// Enable tapping gesture on the switch
this._switchHammer = new Hammer(this.element);
this._switchHammer.on('tap', run.bind(this, this._dragEnd));
this._switchHammer.on('tap', bind(this, this._dragEnd));

this._onClickHandleNativeClick = run.bind(this, this._handleNativeClick);
this._onClickHandleNativeClick = bind(this, this._handleNativeClick);

this.element.querySelector('.md-container')
.addEventListener('click', this._onClickHandleNativeClick);
Expand Down
6 changes: 3 additions & 3 deletions addon/components/paper-toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { inject as service } from '@ember/service';
import { or } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { bind, later } from '@ember/runloop';
import { guidFor } from '@ember/object/internals';
import { getOwner } from '@ember/application';
import layout from '../templates/components/paper-toast';
Expand Down Expand Up @@ -98,12 +98,12 @@ export default Component.extend({
this._super(...arguments);

if (this.duration !== false) {
run.later(this, '_destroyMessage', this.duration);
later(this, '_destroyMessage', this.duration);
}

if (this.escapeToClose) {
// Adding Listener to body tag, FIXME
this._escapeToClose = run.bind(this, (e) => {
this._escapeToClose = bind(this, (e) => {
if (e.keyCode === this.get('constants.KEYCODE.ESCAPE') && this.onClose) {
this._destroyMessage();
}
Expand Down
4 changes: 2 additions & 2 deletions addon/components/paper-tooltip-inner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from '@ember/component';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { schedule } from '@ember/runloop';
import layout from '../templates/components/paper-tooltip-inner';
import { nextTick } from 'ember-css-transitions/utils/transition-utils';
import calculateTooltipPosition from 'ember-paper/utils/calculate-tooltip-position';
Expand All @@ -15,7 +15,7 @@ export default Component.extend({
}),

setupTooltip(element, [position, anchorElement]) {
run.schedule('afterRender', () => {
schedule('afterRender', () => {
let pos = calculateTooltipPosition(element, anchorElement, position);
element.style.top = `${pos.top}px`;
element.style.left = `${pos.left}px`;
Expand Down
4 changes: 2 additions & 2 deletions addon/components/paper-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { or } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { later } from '@ember/runloop';
import { htmlSafe } from '@ember/string';
import { getOwner } from '@ember/application';
import layout from '../templates/components/paper-tooltip';
Expand Down Expand Up @@ -72,7 +72,7 @@ export default Component.extend({
let leaveHandler = () => {
if (!this.isDestroyed) {
this.set('hideTooltip', true);
run.later(() => {
later(() => {
if (!this.isDestroyed) {
this.set('renderTooltip', false);
}
Expand Down
6 changes: 3 additions & 3 deletions addon/mixins/proxiable-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import Mixin from '@ember/object/mixin';

import { run } from '@ember/runloop';
import { next, later } from '@ember/runloop';
import { ChildMixin } from 'ember-composability-tools';

/**
Expand All @@ -18,15 +18,15 @@ export default Mixin.create(ChildMixin, {
shouldRegister: false,

registerWithParent() {
run.next(this, this._super);
next(this, this._super);
},

mouseDown() {
this._super(...arguments);
let parentComponent = this.parentComponent;
if (parentComponent) {
parentComponent.set('mouseActive', true);
run.later(() => {
later(() => {
if (parentComponent.isDestroyed) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions addon/mixins/translate3d-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import Mixin from '@ember/object/mixin';
import { htmlSafe } from '@ember/string';
import { computed } from '@ember/object';
import { run } from '@ember/runloop';
import { schedule, later } from '@ember/runloop';
import { nextTick, computeTimeout } from 'ember-css-transitions/utils/transition-utils';

import { getOwner } from '@ember/application';
Expand Down Expand Up @@ -43,7 +43,7 @@ export default Mixin.create({
didInsertElement() {
this._super(...arguments);

run.schedule('afterRender', () => {
schedule('afterRender', () => {
// Set translate3d style to start at the `from` origin
this.set('transformStyleApply', 'from');
// Wait while CSS takes affect
Expand All @@ -52,7 +52,7 @@ export default Mixin.create({
if (this.isDestroyed) {
return;
}
run.later(() => {
later(() => {
if (!this.isDestroying && !this.isDestroyed) {
this.onTranslateFromEnd();
}
Expand Down Expand Up @@ -100,7 +100,7 @@ export default Mixin.create({
dialogClone.classList.add('md-transition-out');
dialogClone.style.cssText = toStyle;
nextTick().then(() => {
run.later(() => {
later(() => {
if (containerClone.parentNode !== null) {
containerClone.parentNode.removeChild(containerClone);
}
Expand Down
10 changes: 5 additions & 5 deletions addon/modifiers/toast-hammer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Modifier from 'ember-modifier';
import { run } from '@ember/runloop';
import { bind } from '@ember/runloop';

/* global Hammer */

Expand All @@ -19,10 +19,10 @@ export default class ToastHammer extends Modifier {
containerManager.add(swipe);
containerManager.add(pan);
containerManager
.on('panstart', run.bind(this, this.dragStart))
.on('panmove', run.bind(this, this.drag))
.on('panend', run.bind(this, this.dragEnd))
.on('swiperight swipeleft', run.bind(this, this.dragEnd));
.on('panstart', bind(this, this.dragStart))
.on('panmove', bind(this, this.drag))
.on('panend', bind(this, this.dragEnd))
.on('swiperight swipeleft', bind(this, this.dragEnd));
this.hammer = containerManager;
}
}
Expand Down
4 changes: 2 additions & 2 deletions addon/services/paper-toaster.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { reads } from '@ember/object/computed';
import { assign } from '@ember/polyfills';
import { run } from '@ember/runloop';
import { later } from '@ember/runloop';
import { A } from '@ember/array';
import Service from '@ember/service';
import EObject from '@ember/object';
Expand Down Expand Up @@ -32,7 +32,7 @@ export default Service.extend({
toast.set('show', false);

if (this.activeToast === toast) {
run.later(() => {
later(() => {
if (toast.onClose) { toast.onClose() }
this.queue.removeObject(toast);
}, 400);
Expand Down
6 changes: 3 additions & 3 deletions tests/dummy/app/controllers/demo/autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable ember/no-actions-hash */
import { run } from '@ember/runloop';
import { cancel, later } from '@ember/runloop';
import RSVP from 'rsvp';
import Controller from '@ember/controller';
import { A } from '@ember/array';
Expand Down Expand Up @@ -35,9 +35,9 @@ export default Controller.extend({
let XHR_TIMEOUT = Math.floor(Math.random() * 1000) + 100;

return new RSVP.Promise((resolve) => {
run.cancel(this.searchTimer);
cancel(this.searchTimer);

this.searchTimer = run.later(this, () => {
this.searchTimer = later(this, () => {
let nameRegExp = new RegExp(escapeRegExp(`${term}`), 'i', 'g');
let countries = this.items;
let results = countries.filter((c) => nameRegExp.exec(c.name)) || [];
Expand Down
6 changes: 3 additions & 3 deletions tests/dummy/app/controllers/demo/grid-list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Controller from '@ember/controller';
import { run } from '@ember/runloop';
import { later } from '@ember/runloop';
import { A } from '@ember/array';
import EObject, { computed } from '@ember/object';
import { assign } from '@ember/polyfills';
Expand Down Expand Up @@ -89,10 +89,10 @@ export default Controller.extend({
basicRows: 6,

setupTimer() {
run.later(this, () => {
later(this, () => {
this.recalculateColorTiles();

run.later(this, this.setupTimer);
later(this, this.setupTimer);
}, 10 * 1000);
},

Expand Down
6 changes: 3 additions & 3 deletions tests/dummy/app/controllers/demo/progress-circular.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable ember/no-actions-hash */
import Controller from '@ember/controller';
import { run } from '@ember/runloop';
import { later, cancel } from '@ember/runloop';

export default Controller.extend({
mode: 'query',
Expand All @@ -13,7 +13,7 @@ export default Controller.extend({
},

setupTimer() {
this.set('timer', run.later(this, function() {
this.set('timer', later(this, function() {
let value = this.incrementProperty('determinateValue', 1);
if (value > 100) {
this.set('determinateValue', 30);
Expand All @@ -23,7 +23,7 @@ export default Controller.extend({
},

stop() {
run.cancel(this.timer);
cancel(this.timer);
},

sliderDiameter: 100,
Expand Down
Loading