-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
preload.min.js
4 lines (4 loc) · 894 Bytes
/
preload.min.js
1
2
3
4
// preload.min.js, for SugarCube 2, by Chapel
// v1.1.0, 2024-07-22, 336675ff2cabe5f729a5f30d86aa409cc8432726
;!function(){"use strict";function r(r,o){var t=0,e=r.length;if(0===e)throw new Error("No URLs to preload!");r.forEach((function(r){!function(r,o){var t=new Image;t.onload=o,t.onerror=o,t.src=r}(r,(function(){++t===e&&o()}))}))}function o(){return State.length<=0}function t(){var t=[].slice.call(arguments).flat(1/0),e=!!o()&&LoadScreen.lock();return r(t,(function(){e&&LoadScreen.unlock(e)})),e}setup.preload=t,setup.preload.force=!1,Macro.add("preload",{handler:function(){if(!o()&&!setup.preload.force)return this.error("Attempting to preload images outside of `StoryInit` or similar can cause performance issues. Set `setup.preload.force` to `true` if you want to do it anyway.");t(this.args.flat(1/0).filter((function(r){return"string"==typeof r})))}})}();
// end preload.min.js