bring back event loop activator
This commit is contained in:
parent
a746c341ae
commit
e0cddc9a7b
2189
package-lock.json
generated
2189
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nodegui/nodegui",
|
||||
"version": "0.18.2",
|
||||
"version": "0.19.0",
|
||||
"description": "A cross platform library to build native desktop apps.",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
@ -40,20 +40,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bindings": "^1.3.0",
|
||||
"@types/jest": "^25.1.1",
|
||||
"@types/node": "^13.9.1",
|
||||
"@typescript-eslint/eslint-plugin": "^2.23.0",
|
||||
"@typescript-eslint/parser": "^2.23.0",
|
||||
"@types/jest": "^25.2.1",
|
||||
"@types/node": "^13.11.1",
|
||||
"@typescript-eslint/eslint-plugin": "^2.28.0",
|
||||
"@typescript-eslint/parser": "^2.28.0",
|
||||
"clang-format": "^1.3.0",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-prettier": "^6.5.0",
|
||||
"eslint-plugin-prettier": "^3.1.1",
|
||||
"husky": "^4.0.10",
|
||||
"jest": "^25.1.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^25.3.0",
|
||||
"prebuild": "^10.0.0",
|
||||
"prettier": "^2.0.1",
|
||||
"ts-jest": "^25.0.0",
|
||||
"typedoc": "^0.17.0",
|
||||
"prettier": "^2.0.4",
|
||||
"ts-jest": "^25.3.1",
|
||||
"typedoc": "^0.17.4",
|
||||
"typedoc-plugin-markdown": "^2.2.14",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { EventEmitter } from 'events';
|
||||
import { NativeElement, Component, NativeRawPointer } from './Component';
|
||||
import { wrapWithActivateUvLoop } from '../utils/helpers';
|
||||
|
||||
function addDefaultErrorHandler(native: NativeElement, emitter: EventEmitter): void {
|
||||
native.subscribeToQtEvent('error');
|
||||
@ -38,7 +39,7 @@ export abstract class EventWidget<Signals extends {}> extends Component {
|
||||
super();
|
||||
if (native.initNodeEventEmitter) {
|
||||
this.emitter = new EventEmitter();
|
||||
this.emitter.emit = this.emitter.emit.bind(this.emitter);
|
||||
this.emitter.emit = wrapWithActivateUvLoop(this.emitter.emit.bind(this.emitter));
|
||||
native.initNodeEventEmitter(this.emitter.emit);
|
||||
} else {
|
||||
throw new Error('initNodeEventEmitter not implemented on native side');
|
||||
|
||||
@ -10,15 +10,14 @@ export function checkIfNapiExternal(arg: any): boolean {
|
||||
return addon.NUtils.isNapiExternal(arg);
|
||||
}
|
||||
|
||||
// function noop(): void {
|
||||
// return;
|
||||
// }
|
||||
function noop(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
export const wrapWithActivateUvLoop = (func: Function) => {
|
||||
return (...args: any[]): any => {
|
||||
// Temporarily removing activateUvLoop
|
||||
// const activateUvLoop = (process as any).activateUvLoop || noop;
|
||||
// activateUvLoop();
|
||||
const activateUvLoop = (process as any).activateUvLoop || noop;
|
||||
activateUvLoop();
|
||||
return func(...args);
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user