This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Force WebView Documentation for Server Side
- Loading branch information
Showing
2 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1 @@ | ||
import * as alt from 'alt-server'; | ||
import { WebViewEventNames } from '../../shared/enums/webViewEvents'; | ||
|
||
/** | ||
* Emits an event directly to the client's WebView. | ||
* | ||
* @static | ||
* @param {string} eventName | ||
* @param {...any[]} args | ||
* | ||
*/ | ||
export function emit(player: alt.Player, eventName: string, ...args: any[]) { | ||
player.emit(WebViewEventNames.ON_SERVER, eventName, ...args); | ||
} | ||
|
||
/** | ||
* Closes all pages if no pages are specified. | ||
* If pages are specified it only closes those specific pages. | ||
* | ||
* @param {Array<string>} [pages=[]] | ||
*/ | ||
export function closePages(player: alt.Player, pages: Array<string> = []) { | ||
if (typeof pages === 'undefined') { | ||
pages = []; | ||
} | ||
|
||
player.emit(WebViewEventNames.CLOSE_PAGES, pages); | ||
} | ||
export { emit, closePages } from './utilities'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as alt from 'alt-server'; | ||
import { WebViewEventNames } from '../../shared/enums/webViewEvents'; | ||
|
||
/** | ||
* Emits an event directly to the client's WebView. | ||
* | ||
* @static | ||
* @param {string} eventName | ||
* @param {...any[]} args | ||
* | ||
*/ | ||
export function emit(player: alt.Player, eventName: string, ...args: any[]) { | ||
player.emit(WebViewEventNames.ON_SERVER, eventName, ...args); | ||
} | ||
|
||
/** | ||
* Closes all pages if no pages are specified. | ||
* If pages are specified it only closes those specific pages. | ||
* | ||
* @param {Array<string>} [pages=[]] | ||
*/ | ||
export function closePages(player: alt.Player, pages: Array<string> = []) { | ||
if (typeof pages === 'undefined') { | ||
pages = []; | ||
} | ||
|
||
player.emit(WebViewEventNames.CLOSE_PAGES, pages); | ||
} | ||
|