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

Update all the things #142

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
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
Remove Ember global, fix lint
  • Loading branch information
RobbieTheWagner committed Jul 14, 2022
commit 878c9bcccb2b48ced598b324e69b4435d3d53e4a
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ module.exports = {
browser: true,
},
rules: {
'ember/no-actions-hash': 'off',
'ember/no-classic-classes': 'off',
'ember/no-classic-components': 'off',
'ember/no-component-lifecycle-hooks': 'off',
'ember/no-ember-testing-in-module-scope': 'off',
'ember/require-tagless-components': 'off',
},
overrides: [
// node files
Expand Down
12 changes: 9 additions & 3 deletions addon/components/ember-scrollable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
import { action } from '@ember/object';
import { getOwner } from '@ember/application';
import { isPresent } from '@ember/utils';
import { inject as service } from '@ember/service';
import { bind, scheduleOnce, debounce, throttle } from '@ember/runloop';
Expand All @@ -11,7 +11,6 @@ import { getHeight, getWidth } from '../util/measurements';
import classic from 'ember-classic-decorator';
import { layout, tagName } from '@ember-decorators/component';

const hideDelay = Ember.testing ? 16 : 1000;
const PAGE_JUMP_MULTIPLE = 7 / 8;

export const THROTTLE_TIME_LESS_THAN_60_FPS_IN_MS = 1; // 60 fps -> 1 sec / 60 = 16ms
Expand Down Expand Up @@ -107,6 +106,13 @@ export default class EmberScrollableComponent extends Component {

@tracked showHandle = false;

init() {
super.init(...arguments);

const config = getOwner(this).resolveRegistration('config:environment');
this.hideDelay = config.environment === 'test' ? 16 : 1000;
}

didReceiveAttrs() {
super.didReceiveAttrs(...arguments);

Expand Down Expand Up @@ -409,7 +415,7 @@ export default class EmberScrollableComponent extends Component {
return;
}

debounce(this, this.hideScrollbar, hideDelay);
debounce(this, this.hideScrollbar, this.hideDelay);
}

@action
Expand Down
28 changes: 16 additions & 12 deletions tests/dummy/app/controllers/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
/* eslint no-console: 0 */
/* eslint-disable no-console */

import Controller from '@ember/controller';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';

export default Controller.extend({
isShort: true,
actions: {
log(message) {
console.log(message);
},
toggleHeight() {
this.toggleProperty('isShort');
},
},
});
export default class IndexController extends Controller {
@tracked isShort = true;

@action
log(message) {
console.log(message);
}

@action
toggleHeight() {
this.isShort = !this.isShort;
}
}