Skip to content

Commit 6977fc1

Browse files
committed
Remove additional ES6 code and replace with angular functions
1 parent 2a271f0 commit 6977fc1

File tree

7 files changed

+12
-20
lines changed

7 files changed

+12
-20
lines changed

src/modules/adapter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Adapter {
3737
throw error;
3838
}
3939

40-
Object.assign(adapterOnScope, this.publicContext);
40+
angular.extend(adapterOnScope, this.publicContext);
4141
this.publicContext = adapterOnScope;
4242
}
4343

@@ -130,7 +130,7 @@ class Adapter {
130130
}
131131
// out-of-buffer case: deletion may affect Paddings
132132
else if(index >= this.buffer.getAbsMinIndex() && index <= this.buffer.getAbsMaxIndex()) {
133-
if(Array.isArray(newItems) && !newItems.length) {
133+
if(angular.isArray(newItems) && !newItems.length) {
134134
this.viewport.removeCacheItem(index, index === this.buffer.minIndex);
135135
if(index === this.buffer.getAbsMinIndex()) {
136136
this.buffer.incrementMinIndex();
@@ -143,7 +143,7 @@ class Adapter {
143143
}
144144

145145
applyUpdate(wrapper, newItems) {
146-
if (!Array.isArray(newItems)) {
146+
if (!angular.isArray(newItems)) {
147147
return;
148148
}
149149
let position = this.buffer.indexOf(wrapper);
@@ -200,4 +200,4 @@ class Adapter {
200200

201201
}
202202

203-
export default Adapter;
203+
export default Adapter;

src/modules/buffer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { isInteger } from './util.js';
2-
31
export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) {
42
const buffer = Object.create(Array.prototype);
53

6-
Object.assign(buffer, {
4+
angular.extend(buffer, {
75
size: bufferSize,
86

97
reset(startIndex) {
@@ -69,7 +67,7 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) {
6967

7068
// removes elements from buffer
7169
remove(arg1, arg2) {
72-
if (isInteger(arg1)) {
70+
if (angular.isNumber(arg1)) {
7371
// removes items from arg1 (including) through arg2 (excluding)
7472
for (let i = arg1; i < arg2; i++) {
7573
elementRoutines.removeElement(buffer[i]);

src/modules/jqLiteExtras.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { isInteger } from './util.js';
2-
31
/*!
42
globals: angular, window
53
List of used element methods available in JQuery but not in JQuery Lite
@@ -201,7 +199,7 @@ export default class JQLiteExtras {
201199
var self;
202200
self = this;
203201
if (typeof value !== 'undefined') {
204-
if (isInteger(value)) {
202+
if (angular.isNumber(value)) {
205203
value = value + 'px';
206204
}
207205
return css.call(self, 'height', value);

src/modules/util.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/modules/viewport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Viewport(elementRoutines, buffer, element, viewportContr
1717
return viewport.outerHeight() * padding; // some extra space to initiate preload
1818
}
1919

20-
Object.assign(viewport, {
20+
angular.extend(viewport, {
2121
getScope() {
2222
return scope;
2323
},

src/ui-scroll-grid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ angular.module('ui.scroll.grid', [])
4444
// controller api methods
4545

4646
this.applyLayout = function(layout) {
47-
this.css = Object.assign({}, layout.css);
47+
this.css = angular.extend({}, layout.css);
4848
this.mapTo = layout.mapTo;
4949
applyCss(this.header, this.css);
5050
};
@@ -158,7 +158,7 @@ angular.module('ui.scroll.grid', [])
158158
let result = [];
159159
columns.forEach((column, index) => result.push({
160160
index: index,
161-
css: Object.assign({}, column.css),
161+
css: angular.extend({}, column.css),
162162
mapTo: column.mapTo
163163
}));
164164
return result;

src/ui-scroll.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import ElementRoutines from './modules/elementRoutines.js';
33
import ScrollBuffer from './modules/buffer.js';
44
import Viewport from './modules/viewport.js';
55
import Adapter from './modules/adapter.js';
6-
import { isInteger } from './modules/util.js';
76

87
angular.module('ui.scroll', [])
98

@@ -111,9 +110,9 @@ angular.module('ui.scroll', [])
111110
function persistDatasourceIndex(datasource, propName) {
112111
let getter;
113112
// need to postpone min/maxIndexUser processing if the view is empty
114-
if(isInteger(datasource[propName])) {
113+
if(angular.isNumber(datasource[propName])) {
115114
getter = datasource[propName];
116-
if(isInteger(getter)) {
115+
if(angular.isNumber(getter)) {
117116
onRenderHandlers = onRenderHandlers.filter(handler => handler.id !== propName);
118117
onRenderHandlers.push({
119118
id: propName,

0 commit comments

Comments
 (0)