gd-bs
Version:
Bootstrap JavaScript, TypeScript and Web Components library.
25 lines (22 loc) • 642 B
text/typescript
/**
* Class Names
*/
export class ClassNames {
private _items: Array<string> = null;
// Constructor
constructor(items: Array<string>) {
// Set the items
this._items = items || [];
}
// Gets a class name by type
// The enumerator value is equal to the index + 1
getByType(type: number) { return this._items[type - 1]; }
// Parse the class names
parse(callback: (className: string) => void) {
// Parse the items
for (let i = 0; i < this._items.length; i++) {
// Call the callback
callback(this._items[i]);
}
}
}