2017-06-21 13:29:06 +00:00
|
|
|
export function* findAll(className: string) {
|
2017-06-21 16:44:20 +00:00
|
|
|
// getElementsByClassName failed for some reason.
|
|
|
|
// TODO: Test getElementsByClassName again.
|
2017-06-26 10:32:07 +00:00
|
|
|
// let elements = document.querySelectorAll("." + className)
|
|
|
|
let elements = document.getElementsByClassName(className)
|
2017-06-21 16:44:20 +00:00
|
|
|
|
2017-06-20 10:41:26 +00:00
|
|
|
for(let i = 0; i < elements.length; ++i) {
|
|
|
|
yield elements[i] as HTMLElement
|
|
|
|
}
|
2017-06-26 01:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export function delay<T>(millis: number, value?: T): Promise<T> {
|
|
|
|
return new Promise(resolve => setTimeout(() => resolve(value), millis))
|
2017-06-20 10:41:26 +00:00
|
|
|
}
|