Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ts/output/chtml/Usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@

/**
* Class used for tracking usage of font characters or wrappers
* (should extend Set<T>, but that doesn't work for compiling to ES2015).
*/
export class Usage<T> {

/**
* The used items.
*/
protected used: Set<T> = new Set<T>();
protected used: Set<string> = new Set<string>();

/**
* The items marked as used since last update.
Expand All @@ -41,18 +40,19 @@ export class Usage<T> {
* @param {T} item The item that has been used
*/
public add(item: T) {
if (!this.used.has(item)) {
const name = JSON.stringify(item);
if (!this.used.has(name)) {
this.needsUpdate.push(item);
}
this.used.add(item);
this.used.add(name);
}

/**
* @param {T} item The item to check for being used
* @return {boolean} True if the item has been used
*/
public has(item: T): boolean {
return this.used.has(item);
return this.used.has(JSON.stringify(item));
}

/**
Expand Down