Skip to content

Commit

Permalink
feat: code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-north committed Aug 22, 2018
1 parent 2bfc7f3 commit 4fed02d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Mike North
Copyright (c) 2018 Mike North

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
12 changes: 8 additions & 4 deletions addon/mixins/resize-aware.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export default Mixin.create({
_handleResizeEvent(evt) {
const w = floor(this._getComponentSize().width);
const h = floor(this._getComponentSize().height);
if ((this.get('resizeWidthSensitive') && (this.get('_oldViewWidth') !== w)) ||
(this.get('resizeHeightSensitive') && (this.get('_oldViewHeight') !== h))) {
if (
(this.get('resizeWidthSensitive') && this.get('_oldViewWidth') !== w) ||
(this.get('resizeHeightSensitive') && this.get('_oldViewHeight') !== h)
) {
this.didResize(w, h, evt);
this.setProperties({
_oldViewWidth: w,
Expand All @@ -55,8 +57,10 @@ export default Mixin.create({
_handleDebouncedResizeEvent(evt) {
const w = floor(this._getComponentSize().width);
const h = floor(this._getComponentSize().height);
if ((this.get('resizeWidthSensitive') && (this.get('_oldViewWidthDebounced') !== w)) ||
(this.get('resizeHeightSensitive') && (this.get('_oldViewHeightDebounced') !== h))) {
if (
(this.get('resizeWidthSensitive') && this.get('_oldViewWidthDebounced') !== w) ||
(this.get('resizeHeightSensitive') && this.get('_oldViewHeightDebounced') !== h)
) {
this.debouncedDidResize(w, h, evt);
this.setProperties({
_oldViewWidthDebounced: w,
Expand Down
14 changes: 8 additions & 6 deletions addon/services/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default Base.extend(Evented, {
init() {
this._super(...arguments);
this._setDefaults();
this._onResizeHandler = (evt) => {
this._onResizeHandler = evt => {
this._fireResizeNotification(evt);
debounce(this, this._fireDebouncedResizeNotification, evt, this.get('debounceTimeout'));
};
Expand All @@ -42,19 +42,21 @@ export default Base.extend(Evented, {
_setDefaults() {
const defaults = getWithDefault(this, 'resizeServiceDefaults', {});

keys(defaults).map((key) => {
keys(defaults).map(key => {
const classifiedKey = classify(key);
const defaultKey = `default${classifiedKey}`;
return set(this, defaultKey, defaults[key]);
});
},

_hasWindowSizeChanged(w, h, debounced=false) {
return (this.get('widthSensitive') && (w !== this.get(`_oldWidth${debounced ? 'Debounced' : ''}`))) ||
(this.get('heightSensitive') && (h !== this.get(`_oldHeight${debounced ? 'Debounced' : ''}`)));
_hasWindowSizeChanged(w, h, debounced = false) {
return (
(this.get('widthSensitive') && w !== this.get(`_oldWidth${debounced ? 'Debounced' : ''}`)) ||
(this.get('heightSensitive') && h !== this.get(`_oldHeight${debounced ? 'Debounced' : ''}`))
);
},

_updateCachedWindowSize(w, h, debounced=false) {
_updateCachedWindowSize(w, h, debounced = false) {
const wKey = `_oldWidth${debounced ? 'Debounced' : ''}`;
const hKey = `_oldHeight${debounced ? 'Debounced' : ''}`;
let props = {};
Expand Down

0 comments on commit 4fed02d

Please sign in to comment.