Feature: #91122 - Introduce DocumentService as JQuery.ready substitute
See forge#91122
Description
The module
TYPO3/
provides native JavaScript
functions to detect DOM ready-state returning a
Promise<Document>
.
Internally the Promise is resolved when native
DOMContent
event has
been emitted or when
document.
is defined already. It means
that initial HTML document has been completely loaded and parsed, without
waiting for stylesheets, images, and subframes to finish loading.
Impact
$(document).ready(() => {
// your application code
});
Copied!
Above JQuery code can be transformed into the following using
Document
:
require(['TYPO3/CMS/Core/DocumentService'], function (DocumentService) {
DocumentService.ready().then(() => {
// your application code
});
});
Copied!