BrowserCreated: Difference between revisions
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
{{CSharpContainer| | {{CSharpContainer| | ||
< | <syntaxhighlight lang="c#"> | ||
public delegate void OnBrowserCreatedDelegate(HtmlWindow window); | public delegate void OnBrowserCreatedDelegate(HtmlWindow window); | ||
</ | </syntaxhighlight> | ||
{{Parameters}} | |||
* '''window''': The created browser handler, output expects '''RAGE.Ui.HtmlWindow''' type. | |||
{{Example}} | |||
The example below shows up a message for a player and hides the browser when it is created. | The example below shows up a message for a player and hides the browser when it is created. | ||
| Line 25: | Line 24: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | |||
{{JSContainer| | |||
{{ | |||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
mp.events.add('browserCreated', (browser) => {}); | mp.events.add('browserCreated', (browser) => {}); | ||
| Line 33: | Line 31: | ||
=== Parameters === | === Parameters === | ||
* '''browser''': The created browser handler, output expects | * '''browser''': The created browser handler, output expects '''any''' type. | ||
=== Examples === | === Examples === | ||
| Line 44: | Line 42: | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | |||
Revision as of 13:52, 27 November 2018
Client-Side Event
This event is called everytime a browser is created.
C# Syntax
public delegate void OnBrowserCreatedDelegate(HtmlWindow window);
Parameters
- window: The created browser handler, output expects RAGE.Ui.HtmlWindow type.
Example
The example below shows up a message for a player and hides the browser when it is created.
RAGE.Events.OnBrowserCreated += OnBrowserCreated;
public void OnBrowserCreated(RAGE.Ui.HtmlWindow htmlWindow)
{
htmlWindow.Active = false;
RAGE.Chat.Output("A CEF Browser has been created and is now invisible!");
}
JavaScript Syntax
mp.events.add('browserCreated', (browser) => {});
Parameters
- browser: The created browser handler, output expects any type.
Examples
The example below shows up a message for a player when a browser is created.
mp.events.add('browserCreated', (browser) => {
mp.gui.chat.push('WOOOOOOAH, a CEF Browser has been created!');
});