mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
Improve
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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()
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user