getting error: a dependency to an entry point is not allowed
This commit is contained in:
parent
4f96ab5353
commit
b24d3b952b
3 changed files with 6 additions and 86 deletions
|
@ -43,6 +43,7 @@ module.exports = function(config) {
|
|||
'static/js/**/*.ts': ['webpack'],
|
||||
},
|
||||
webpack: {
|
||||
resolve: webpackConfig.resolve,
|
||||
module: webpackConfig.module,
|
||||
},
|
||||
webpackMiddleware: {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import IInjectorService = angular.auto.IInjectorService;
|
||||
// import { ViewArrayImpl } from './view-array.impl';
|
||||
|
||||
|
||||
describe("Service: AngularViewArray", () => {
|
||||
|
|
|
@ -16,93 +16,11 @@ AngularViewArrayFactory.$inject = [
|
|||
'$interval'
|
||||
];
|
||||
|
||||
export default function AngularViewArrayFactory($interval) {
|
||||
var ADDTIONAL_COUNT = 20;
|
||||
|
||||
function _ViewArray() {
|
||||
this.isVisible = false;
|
||||
this.visibleEntries = null;
|
||||
this.hasEntries = false;
|
||||
this.entries = [];
|
||||
this.hasHiddenEntries = false;
|
||||
|
||||
this.timerRef_ = null;
|
||||
this.currentIndex_ = 0;
|
||||
}
|
||||
|
||||
_ViewArray.prototype.length = function(): number {
|
||||
return this.entries.length;
|
||||
};
|
||||
|
||||
_ViewArray.prototype.get = function(index: number): any {
|
||||
return this.entries[index];
|
||||
};
|
||||
|
||||
_ViewArray.prototype.push = function(elem: any): void {
|
||||
this.entries.push(elem);
|
||||
this.hasEntries = true;
|
||||
|
||||
if (this.isVisible) {
|
||||
this.startTimer_();
|
||||
export default function AngularViewArrayFactory($interval): any {
|
||||
return {
|
||||
create: function(): ViewArray {
|
||||
return new ViewArrayImpl($interval, 20);
|
||||
}
|
||||
};
|
||||
|
||||
_ViewArray.prototype.toggle = function(): void {
|
||||
this.setVisible(!this.isVisible);
|
||||
};
|
||||
|
||||
_ViewArray.prototype.setVisible = function(newState: boolean): void {
|
||||
this.isVisible = newState;
|
||||
|
||||
this.visibleEntries = [];
|
||||
this.currentIndex_ = 0;
|
||||
|
||||
if (newState) {
|
||||
this.showAdditionalEntries_();
|
||||
this.startTimer_();
|
||||
}
|
||||
else {
|
||||
this.stopTimer_();
|
||||
}
|
||||
};
|
||||
|
||||
_ViewArray.prototype.showAdditionalEntries_ = function(): void {
|
||||
var i: number = 0;
|
||||
for (i = this.currentIndex_; i < (this.currentIndex_ + ADDTIONAL_COUNT) && i < this.entries.length; ++i) {
|
||||
this.visibleEntries.push(this.entries[i]);
|
||||
}
|
||||
|
||||
this.currentIndex_ = i;
|
||||
this.hasHiddenEntries = this.currentIndex_ < this.entries.length;
|
||||
if (this.currentIndex_ >= this.entries.length) {
|
||||
this.stopTimer_();
|
||||
}
|
||||
};
|
||||
|
||||
_ViewArray.prototype.startTimer_ = function(): void {
|
||||
if (this.timerRef_) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
this.timerRef_ = $interval(function() {
|
||||
that.showAdditionalEntries_();
|
||||
}, 10);
|
||||
};
|
||||
|
||||
_ViewArray.prototype.stopTimer_ = function(): void {
|
||||
if (this.timerRef_) {
|
||||
$interval.cancel(this.timerRef_);
|
||||
this.timerRef_ = null;
|
||||
}
|
||||
};
|
||||
|
||||
var service: any = {
|
||||
create: function(): any {
|
||||
return new _ViewArray();
|
||||
}
|
||||
};
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue