Jump to content

How can I send data from the client to the cef?


Dragos001

Recommended Posts

How can I send data from the client to the cef?
For the client I use c# and for CEF I use angular. I managed to activate cef and send data from CEF to the client, but I don't know how to send data from the client to cef.

Can you help me?

Link to comment
Share on other sites

There are two ways provided by ragemp.

1. You can define events inside of your browser script logic with mp.events.add, then you can call those events from client-side with

browserInstance.call("eventName", args..);
2. You can define JS methods and on component load bind them(on unload unbind) to window object in browser, then you can use 

browserInstance.execute

 or 

browserInstance.executeCached , you can check their usages on wiki by clicking on the hyperlinks.

"browserInstance" would be the variable that has reference towards your browser for example:

 

const browserInstance = mp.browsers.new("...your link...");


I personally prefer event way because it feels nicer to write and use. Also you can always introduce your own way of data transfer if needer or wanted, but that's whole another topic. Hope that clears it up a little bit.

References:
Browser::Browser - RAGE Multiplayer Wiki
Browser::execute - RAGE Multiplayer Wiki

Browser::executeCached - RAGE Multiplayer Wiki
Browser::callProc - RAGE Multiplayer Wiki

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...