move window.__config to an Angular constant; refactor AngularViewArray -> ViewArray + ViewArrayFactory

This commit is contained in:
alecmerdler 2017-01-21 00:14:37 -08:00
parent 615e233671
commit eea2a18c3f
16 changed files with 316 additions and 231 deletions

View file

@ -0,0 +1,62 @@
/**
* Specialized wrapper around array which provides a toggle() method for viewing the contents of the
* array in a manner that is asynchronously filled in over a short time period. This prevents long
* pauses in the UI for ngRepeat's when the array is significant in size.
*/
export abstract class ViewArray {
/**
* The stored entries.
*/
public abstract entries: any;
/**
* If the entries are displayed.
*/
public abstract isVisible: boolean;
/**
* The displayed entries.
*/
public abstract visibleEntries: any[];
/**
* If there are stored entries.
*/
public abstract hasEntries: boolean;
/**
* If there are entries not visible.
*/
public abstract hasHiddenEntries: boolean;
/**
* Get the number of entries stored.
* @return number The number of entries.
*/
public abstract length(): number;
/**
* Get a specific entry.
* @param index The index of the entry.
* @return element The element at the given index.
*/
public abstract get(index: number): any;
/**
* Add a new element.
* @param elem The new element.
*/
public abstract push(elem: any): void;
/**
* Toggle whether the elements are visible.
*/
public abstract toggle(): void;
/**
* Set whether the elements are visible.
* @param newState True/False if the contents are visible.
*/
public abstract setVisible(newState: boolean): void;
}