jQuery: Enforce order of execution of document.ready() calls

后端 未结 5 892
小蘑菇
小蘑菇 2020-12-10 23:45

I\'m working on a codebase with multiple blocks of code setting some behavior on document.ready() (jQuery). Is there a way to enforce that one specific block is called befor

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-11 00:30

    You can execute the logging start code in DOMReady and other initialization in load. Or you could make your own initialization manager which calls your logging start code first and then all other initialization callbacks (provided that those are registered with your manager and not jQuery, unless you want to hack jQuery and extract them from there, which I don't advise).

提交回复
热议问题