altv-rpc
altv-rpc copied to clipboard
rpc.addWebView() optional naming: server + browser-side named callBrowser(), triggerBrowser()
Proposal
Expand rpc.addWebView()
to have a second argument, name
.
When adding WebViews at client-side, a second optional argument could be passed like this:
rpc.addWebView(animBrowser, 'animBrowser')
Internally, this could then map browser names to individual browsers, allowing individual browsers to be triggered from any context. For example, you could do:
rpc.callBrowser('animBrowser', 'someProcedureInAnimBrowser')
rpc.triggerBrowser('animBrowser', 'someEventInAnimBrowser')
^ from server-side, any browser, or the client. This would greatly improve performance by removing the need to loop through all browsers when calling remotely, i.e. from server-side.
Changes
- Optional second argument for rpc.addWebView() -
name
. - If optional argument is specified, the name string is mapped to the given browser.
-
callBrowser
andtriggerBrowser
adapted to handle case where browser is string for server, client + browser environment. - If either function is called in the client environment and the browser argument is not a string or browser type, it should still throw an error as expected.
this is a great idea! i will look into implementing this.
Proposal
Expand
rpc.addWebView()
to have a second argument,name
.When adding WebViews at client-side, a second optional argument could be passed like this:
rpc.addWebView(animBrowser, 'animBrowser')
Internally, this could then map browser names to individual browsers, allowing individual browsers to be triggered from any context. For example, you could do:
rpc.callBrowser('animBrowser', 'someProcedureInAnimBrowser') rpc.triggerBrowser('animBrowser', 'someEventInAnimBrowser')
^ from server-side, any browser, or the client. This would greatly improve performance by removing the need to loop through all browsers when calling remotely, i.e. from server-side.
Changes
- Optional second argument for rpc.addWebView() -
name
.- If optional argument is specified, the name string is mapped to the given browser.
callBrowser
andtriggerBrowser
adapted to handle case where browser is string for server, client + browser environment.- If either function is called in the client environment and the browser argument is not a string or browser type, it should still throw an error as expected.
Why run multiple browsers at the same time? When you can run a single browser and render whatever you want on the browser side (react + redux) ?
@uncle-ara not sure how this question is relevant to this repo. make your game however you see fit and this library can adapt accordingly.