When attempting to call a function within my class, I encounter a warning/error in this particular section of the code:
rpc.register('cBrowser-SetUrl', (url: string, enableCursor: boolean) => {
this.setBrowserUrl(url, enableCursor);
});
The error message is as follows: https://i.sstatic.net/3CqcE.png
Here's the complete code snippet:
const rpc = require('rage-rpc');
class BrowserSingleton {
browser: BrowserMp;
constructor() {
this.browser = mp.browsers.new('http://package/cef/index.html');
rpc.register('cBrowser-SetUrl', (url: string, enableCursor: boolean) => {
this.setBrowserUrl(url, enableCursor);
});
}
setBrowserUrl(url: string, enableCursor: boolean) {
const path = `app.$router.push('${url}');`;
this.setInteractState(enableCursor);
this.pasteJS(path);
}
pasteJS(data: string) {
this.browser.execute(data);
}
setInteractState(state: boolean) {
mp.gui.cursor.visible = state;
mp.game.ui.displayRadar(!state);
mp.gui.chat.show(!state);
mp.nametags.enabled = !state;
}
}
new BrowserSingleton();
Any insights on why this issue is occurring would be greatly appreciated. Thank you for your help and suggestions.