You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Add option to ensure cross-origin isolation headers on web export
This commit is contained in:
@@ -179,9 +179,7 @@ const Engine = (function () {
|
||||
preloader.preloadedFiles.length = 0; // Clear memory
|
||||
me.rtenv['callMain'](me.config.args);
|
||||
initPromise = null;
|
||||
if (me.config.serviceWorker && 'serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register(me.config.serviceWorker);
|
||||
}
|
||||
me.installServiceWorker();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
@@ -242,6 +240,17 @@ const Engine = (function () {
|
||||
this.rtenv['request_quit']();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Install the progressive-web app service worker.
|
||||
* @returns {Promise} The service worker registration promise.
|
||||
*/
|
||||
installServiceWorker: function () {
|
||||
if (this.config.serviceWorker && 'serviceWorker' in navigator) {
|
||||
return navigator.serviceWorker.register(this.config.serviceWorker);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
|
||||
Engine.prototype = proto;
|
||||
@@ -252,6 +261,7 @@ const Engine = (function () {
|
||||
Engine.prototype['startGame'] = Engine.prototype.startGame;
|
||||
Engine.prototype['copyToFS'] = Engine.prototype.copyToFS;
|
||||
Engine.prototype['requestQuit'] = Engine.prototype.requestQuit;
|
||||
Engine.prototype['installServiceWorker'] = Engine.prototype.installServiceWorker;
|
||||
// Also expose static methods as instance methods
|
||||
Engine.prototype['load'] = Engine.load;
|
||||
Engine.prototype['unload'] = Engine.unload;
|
||||
|
||||
Reference in New Issue
Block a user