@gjsify/node-globals 0.3.19 → 0.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- function e(){return globalThis.imports?.gi?.GLib}const t=e()!==void 0;var n=class{_id=null;_refed=!0;_callback;_delay;_args;_repeat;constructor(e,t,n,r){this._callback=e,this._delay=t,this._args=n,this._repeat=r,this._schedule()}_schedule(){let t=e();if(!t)return;let n=t.timeout_add.bind(t);this._id=n(t.PRIORITY_DEFAULT,this._delay,()=>{try{this._callback.apply(globalThis,this._args)}catch(e){setTimeout(()=>{throw e},0)}return this._repeat?t.SOURCE_CONTINUE:(this._id=null,t.SOURCE_REMOVE)})}ref(){return this._refed=!0,this}unref(){return this._refed=!1,this}hasRef(){return this._refed}refresh(){return this._cancel(),this._schedule(),this}_cancel(){if(this._id!==null){try{e()?.Source.remove(this._id)}catch{}this._id=null}}[Symbol.toPrimitive](){return this._id}[Symbol.dispose](){this._cancel()}};function r(t){if(t instanceof n)t._cancel();else if(typeof t==`number`)try{e()?.Source.remove(t)}catch{}}if(t){let e=(e,t=0,...r)=>new n(e,Math.max(0,t|0),r,!1),t=(e,t=0,...r)=>new n(e,Math.max(0,t|0),r,!0),i=globalThis;i.setTimeout=e,i.clearTimeout=r,i.setInterval=t,i.clearInterval=r}function i(e,...t){return setTimeout(e,0,...t)}function a(e){clearTimeout(e)}`setImmediate`in globalThis||Object.defineProperty(globalThis,`setImmediate`,{value:i,enumerable:!0,writable:!0,configurable:!0}),`clearImmediate`in globalThis||Object.defineProperty(globalThis,`clearImmediate`,{value:a,enumerable:!0,writable:!0,configurable:!0});
1
+ function getGLib(){return globalThis.imports?.gi?.GLib}const e=getGLib()!==void 0;var GjsifyTimeout=class{_id=null;_refed=!0;_callback;_delay;_args;_repeat;constructor(e,t,n,r){this._callback=e,this._delay=t,this._args=n,this._repeat=r,this._schedule()}_schedule(){let e=getGLib();if(!e)return;let t=e.timeout_add.bind(e);this._id=t(e.PRIORITY_DEFAULT,this._delay,()=>{try{this._callback.apply(globalThis,this._args)}catch(e){setTimeout(()=>{throw e},0)}return this._repeat?e.SOURCE_CONTINUE:(this._id=null,e.SOURCE_REMOVE)})}ref(){return this._refed=!0,this}unref(){return this._refed=!1,this}hasRef(){return this._refed}refresh(){return this._cancel(),this._schedule(),this}_cancel(){if(this._id!==null){try{getGLib()?.Source.remove(this._id)}catch{}this._id=null}}[Symbol.toPrimitive](){return this._id}[Symbol.dispose](){this._cancel()}};function removeById(e){if(e instanceof GjsifyTimeout)e._cancel();else if(typeof e==`number`)try{getGLib()?.Source.remove(e)}catch{}}if(e){let setT=(e,t=0,...n)=>new GjsifyTimeout(e,Math.max(0,t|0),n,!1),setI=(e,t=0,...n)=>new GjsifyTimeout(e,Math.max(0,t|0),n,!0),e=globalThis;e.setTimeout=setT,e.clearTimeout=removeById,e.setInterval=setI,e.clearInterval=removeById}function setImmediate(e,...t){return setTimeout(e,0,...t)}function clearImmediate(e){clearTimeout(e)}`setImmediate`in globalThis||Object.defineProperty(globalThis,`setImmediate`,{value:setImmediate,enumerable:!0,writable:!0,configurable:!0}),`clearImmediate`in globalThis||Object.defineProperty(globalThis,`clearImmediate`,{value:clearImmediate,enumerable:!0,writable:!0,configurable:!0});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/node-globals",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "Node.js globals module for Gjs",
5
5
  "keywords": [
6
6
  "gjs",
@@ -61,14 +61,14 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@girs/glib-2.0": "2.88.0-4.0.0-rc.14",
64
- "@gjsify/buffer": "^0.3.19",
65
- "@gjsify/process": "^0.3.19",
66
- "@gjsify/url": "^0.3.19",
67
- "@gjsify/utils": "^0.3.19"
64
+ "@gjsify/buffer": "^0.3.21",
65
+ "@gjsify/process": "^0.3.21",
66
+ "@gjsify/url": "^0.3.21",
67
+ "@gjsify/utils": "^0.3.21"
68
68
  },
69
69
  "devDependencies": {
70
- "@gjsify/cli": "^0.3.19",
71
- "@gjsify/unit": "^0.3.19",
70
+ "@gjsify/cli": "^0.3.21",
71
+ "@gjsify/unit": "^0.3.21",
72
72
  "@types/node": "^25.6.2",
73
73
  "typescript": "^6.0.3"
74
74
  }