tauri-plugin-nosleep-api-fork
Version:
Tauri plugin to block the power save functionality in the OS
2 lines (1 loc) • 2.12 kB
JavaScript
function e(e,n,t,r){return new(t||(t=Promise))((function(o,u){function i(e){try{c(r.next(e))}catch(e){u(e)}}function l(e){try{c(r.throw(e))}catch(e){u(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,l)}c((r=r.apply(e,n||[])).next())}))}function n(e,n){var t,r,o,u,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function l(l){return function(c){return function(l){if(t)throw new TypeError("Generator is already executing.");for(;u&&(u=0,l[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=n.call(e,i)}catch(e){l=[6,e],r=0}finally{t=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}}async function t(e,n={},t){return window.__TAURI_INTERNALS__.invoke(e,n,t)}var r;function o(r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,t("plugin:nosleep|block",{noSleepType:r})];case 1:return[2,e.sent()]}}))}))}function u(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,t("plugin:nosleep|unblock")];case 1:return[2,e.sent()]}}))}))}"function"==typeof SuppressedError&&SuppressedError,"function"==typeof SuppressedError&&SuppressedError,function(e){e.PreventUserIdleDisplaySleep="PreventUserIdleDisplaySleep",e.PreventUserIdleSystemSleep="PreventUserIdleSystemSleep"}(r||(r={}));export{r as NoSleepType,o as block,u as unblock};