14 lines
366 B
TypeScript
14 lines
366 B
TypeScript
|
|
/**
|
||
|
|
* For the full copyright and license information, please view the
|
||
|
|
* docs/licenses/LICENSE.txt file that was distributed with this source code.
|
||
|
|
*/
|
||
|
|
const onReady = (callback: () => void): void => {
|
||
|
|
if (document.readyState !== 'loading') {
|
||
|
|
callback();
|
||
|
|
} else {
|
||
|
|
document.addEventListener('DOMContentLoaded', callback);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
export default onReady;
|