From 0edd75b2f8013b21d174cb0ea63614fb4b6e5ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Mon, 26 Oct 2020 11:57:05 +0300 Subject: [PATCH] Add abp.domReady --- .../wwwroot/libs/abp/js/abp.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/libs/abp/js/abp.js b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/libs/abp/js/abp.js index b8e8d358e3..c086b0460b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/libs/abp/js/abp.js +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/wwwroot/libs/abp/js/abp.js @@ -2,6 +2,16 @@ (function () { abp.utils = abp.utils || {}; + // DOM READY ///////////////////////////////////////////////////// + + abp.domReady = function (fn) { + if (document.readyState === "complete" || document.readyState === "interactive") { + setTimeout(fn, 1); + } else { + document.addEventListener("DOMContentLoaded", fn); + } + }; + // COOKIES /////////////////////////////////////////////////////// /**