Events::delayInitialization

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

Server-Side
Function

Js.png JavaScript



This function delays server's initialization of packages to run early functions.

Setter

  • Boolean

Example

Server-Side
mp.events.delayInitialization = true;
let asyncDone = false;

(async () => {
  // async calls done, now let it invoke "packagesLoaded"
  await someAsyncFunction();
  mp.events.delayInitialization = false;
  asyncDone = true;
})();

mp.events.add('packagesLoaded', () => {
  console.log(`async done: ${asyncDone}`); // Doesn't get triggered till mp.events.delayInitialization is true.
});

See Also