mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
25 lines
383 B
TypeScript
25 lines
383 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class WaitForDomService {
|
|
|
|
selectorString = ""
|
|
constructor() { }
|
|
|
|
selector({ selector, callback }) {
|
|
|
|
function _try() {
|
|
if (!document.querySelector(selector)) {
|
|
window.requestAnimationFrame(_try);
|
|
} else {
|
|
callback()
|
|
}
|
|
};
|
|
|
|
_try()
|
|
|
|
}
|
|
}
|