UNPKG

node-gtk

Version:

GNOME Gtk+ bindings for NodeJS

33 lines (26 loc) 842 B
/* * GLib-2.0.js */ const internal = require('../native.js') const { runLoopEntry } = require('../loop.js') exports.apply = (GLib) => { GLib.MainLoop.prototype._run = GLib.MainLoop.prototype.run GLib.MainLoop.prototype._quit = GLib.MainLoop.prototype.quit GLib.MainLoop.prototype.run = function run() { const loopStack = internal.GetLoopStack() loopStack.push(() => this.quit()) return runLoopEntry(() => { /* Run before we enter the loop otherwise pending microtasks * are not run */ process._tickCallback() this._run() if (this._userQuit) loopStack.pop() delete this._userQuit }) } GLib.MainLoop.prototype.quit = function quit() { this._userQuit = true this._quit() } }