Fix nodejs CI

replaceAll was added in node 15, but the CI still runs node 12
This commit is contained in:
Olivier Goffart 2021-08-10 20:20:45 +02:00 committed by Olivier Goffart
parent 4e254445d9
commit 0dbb2a7758

View file

@ -77,18 +77,18 @@ interface Callback {
require.extensions['.60'] = require.extensions['.60'] =
function (module, filename) { function (module, filename) {
var c = native.load(filename); var c = native.load(filename);
module.exports[c.name().replaceAll('-', '_')] = function (init_properties: any) { module.exports[c.name().replace(/-/g, '_')] = function (init_properties: any) {
let comp = c.create(init_properties); let comp = c.create(init_properties);
let ret = new Component(comp); let ret = new Component(comp);
c.properties().forEach((x: string) => { c.properties().forEach((x: string) => {
Object.defineProperty(ret, x.replaceAll('-', '_'), { Object.defineProperty(ret, x.replace(/-/g, '_'), {
get() { return comp.get_property(x); }, get() { return comp.get_property(x); },
set(newValue) { comp.set_property(x, newValue); }, set(newValue) { comp.set_property(x, newValue); },
enumerable: true, enumerable: true,
}) })
}); });
c.callbacks().forEach((x: string) => { c.callbacks().forEach((x: string) => {
Object.defineProperty(ret, x.replaceAll('-', '_'), { Object.defineProperty(ret, x.replace(/-/g, '_'), {
get() { get() {
let callback = function () { return comp.invoke_callback(x, [...arguments]); } as Callback; let callback = function () { return comp.invoke_callback(x, [...arguments]); } as Callback;
callback.setHandler = function (callback) { comp.connect_callback(x, callback) }; callback.setHandler = function (callback) { comp.connect_callback(x, callback) };