@steambrew/api
Version:
This sub-project is responsible for transpiling and assembling @steambrew/client and @steambrew/webkit into a bundle that is injectable into the Steam Client. `StartPreloader` is the main function that is called from the backend of Millennium in C++ with
3 lines (2 loc) • 1.95 kB
JavaScript
import{b as e,c as n,_ as t,a as o}from"../millennium.js";var r="steamloopback.host"===window.location.hostname,i=void 0;function a(e){i=e}var u={postMessage:function(e,n){return t(void 0,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return i||console.warn("No Millennium auth token set. This will cause issues with IPC calls."),[4,fetch("https://millennium.ipc",{method:"POST",headers:{"Content-Type":"text/plain","X-Millennium-Auth":i},body:JSON.stringify({id:e,data:n})})];case 1:return[4,t.sent().json()];case 2:return[2,t.sent()]}})})}};window.MILLENNIUM_BACKEND_IPC=u;var s=e({callServerMethod:function(n,t,o){var r=e({pluginName:n,methodName:t},o&&{argumentList:o});return u.postMessage(0,r).then(function(e){return"string"==typeof e.returnValue?decodeURIComponent(escape(atob(e.returnValue))):e.returnValue}).catch(function(e){throw console.error("Error calling server method ".concat(n,".").concat(t,":"),e),e})},findElement:function(e,n,t){return new Promise(function(o,r){var i=e.querySelectorAll(n);if(i.length)return o(i);var a=new MutationObserver(function(){var t=e.querySelectorAll(n);t.length&&(a.disconnect(),u&&clearTimeout(u),o(t))});a.observe(e.body,{childList:!0,subtree:!0});var u=t&&setTimeout(function(){a.disconnect(),r()},t)})}},r&&{exposeObj:function(e,n){return Object.assign(e,n)},AddWindowCreateHook:function(e){Array.from(g_PopupManager.GetPopups()).forEach(e),g_PopupManager.AddPopupCreatedCallback(e)}});window.Millennium=s;var c=function(e,t){return function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];return e.apply(void 0,n([t],o,!1))}},l=r?undefined:void 0,d=function(e){var n,t;return null===(t=null===(n=window.MILLENNIUM_PLUGIN_SETTINGS_STORE)||void 0===n?void 0:n[e])||void 0===t?void 0:t.settingsStore};export{d as BindPluginSettings,s as Millennium,c as callable,l as pluginSelf,a as setMillenniumAuthToken};
//# sourceMappingURL=chunk-millennium-api.js.map