EventMap
Defined in: client/api.d.ts:1769
Native events dispatched through Events.on. Each property is the exact callback argument tuple for that event.
Properties
Section titled “Properties”browserConsoleMessage
Section titled “browserConsoleMessage”browserConsoleMessage: [
BrowserConsoleMessageEvent]
Defined in: client/api.d.ts:1908
Dispatched for console output of an owned view; the framework logs these regardless.
browserCreated
Section titled “browserCreated”browserCreated: [
BrowserCreatedEvent]
Defined in: client/api.d.ts:1858
Dispatched once per view, before any navigation, to the resource that created it.
browserCursorChange
Section titled “browserCursorChange”browserCursorChange: [
BrowserCursorChangeEvent]
Defined in: client/api.d.ts:1888
Dispatched when an owned view’s requested cursor shape changes.
browserDocumentReady
Section titled “browserDocumentReady”browserDocumentReady: [
BrowserDocumentReadyEvent]
Defined in: client/api.d.ts:1868
Dispatched when an owned view’s main document is ready; the earliest point at which the page can receive Web.emit.
browserInputFocusChange
Section titled “browserInputFocusChange”browserInputFocusChange: [
BrowserInputFocusChangeEvent]
Defined in: client/api.d.ts:1898
Dispatched when focus enters or leaves an editable element of an owned view; use it to stop routing keys to the game.
browserLoadingFailed
Section titled “browserLoadingFailed”browserLoadingFailed: [
BrowserLoadingFailedEvent]
Defined in: client/api.d.ts:1873
Dispatched when a frame of an owned view fails to load.
browserLoadingStart
Section titled “browserLoadingStart”browserLoadingStart: [
BrowserLoadingStartEvent]
Defined in: client/api.d.ts:1863
Dispatched when any frame of an owned view begins loading.
browserNavigate
Section titled “browserNavigate”browserNavigate: [
BrowserNavigateEvent]
Defined in: client/api.d.ts:1878
Dispatched for every navigation an owned view is asked to perform, refused or not.
browserOriginChange
Section titled “browserOriginChange”browserOriginChange: [
BrowserOriginChangeEvent]
Defined in: client/api.d.ts:1913
Dispatched on view creation and whenever Web.loadURL re-locks an owned view to a different origin.
browserPopup
Section titled “browserPopup”browserPopup: [
BrowserPopupEvent]
Defined in: client/api.d.ts:1883
Dispatched when an owned view blocks a popup; windowless views cannot host one, so handle the URL yourself.
browserResourceBlocked
Section titled “browserResourceBlocked”browserResourceBlocked: [
BrowserResourceBlockedEvent]
Defined in: client/api.d.ts:1903
Dispatched when an owned view rejects a navigation or a page event from outside its locked origin.
browserTooltip
Section titled “browserTooltip”browserTooltip: [
BrowserTooltipEvent]
Defined in: client/api.d.ts:1893
Dispatched when an owned view requests a tooltip; windowless rendering draws none, so the script must.
chatMessage
Section titled “chatMessage”chatMessage: [
ChatMessageEvent]
Defined in: client/api.d.ts:1783
Dispatched when the client receives a framework chat-message RPC, before the built-in chat overlay is updated.
chatSend
Section titled “chatSend”chatSend: [
string]
Defined in: client/api.d.ts:1788
Dispatched synchronously when the local player submits a chat line, before it is sent. Return false to keep the line client-side; async handlers cannot block it. Not dispatched for Chat.send.
cityPartChanged
Section titled “cityPartChanged”cityPartChanged: [
CityPartChangeEvent]
Defined in: client/api.d.ts:1813
Dispatched when the local player crosses into a different city district.
dialogAnswer
Section titled “dialogAnswer”dialogAnswer: [
QuestionAnswerEvent]
Defined in: client/api.d.ts:1803
Dispatched when a prompt shown by Ui.showDialog resolves. answerId is 1 for the accepting option and 2 for the declining one.
entityStateChange
Section titled “entityStateChange”entityStateChange: [
Entity,string,any,any]
Defined in: client/api.d.ts:1853
Dispatched when one key of an entity’s state changes: on the server when a script writes it, on a client when the write arrives. value is undefined when the key was removed and previous is undefined when it held nothing before, so a stored null stays distinguishable from an absent key. The entity is whatever the game’s WrapScriptEntity answers, and the base Entity handle by default.
lockpickResult
Section titled “lockpickResult”lockpickResult: [
LockpickResultEvent]
Defined in: client/api.d.ts:1808
Dispatched when a minigame started by Ui.startLockpick ends, including when Ui.cancelLockpick closes it.
playerDamage
Section titled “playerDamage”playerDamage: [
PlayerDamageEvent]
Defined in: client/api.d.ts:1828
Dispatched immediately after the local player receives native damage.
questionAnswer
Section titled “questionAnswer”questionAnswer: [
QuestionAnswerEvent]
Defined in: client/api.d.ts:1798
Dispatched when a prompt shown by Ui.showQuestion resolves. Not dispatched for Ui.showDialog, which raises dialogAnswer, nor for a prompt closed by Ui.cancelQuestion.
radioPowerChange
Section titled “radioPowerChange”radioPowerChange: [
RadioPowerChangeEvent]
Defined in: client/api.d.ts:1823
Dispatched after the local player’s vehicle radio is turned on or off.
radioStationChange
Section titled “radioStationChange”radioStationChange: [
RadioStationChangeEvent]
Defined in: client/api.d.ts:1818
Dispatched after the local player’s vehicle radio changes station.
resourceStart
Section titled “resourceStart”resourceStart: [
string]
Defined in: client/api.d.ts:1773
Dispatched after a resource entry point has run and immediately before the resource becomes running.
resourceStop
Section titled “resourceStop”resourceStop: [
string]
Defined in: client/api.d.ts:1778
Dispatched while a resource is stopping, before its stop callback, timers, exports, and event handlers are cleaned up.
shopOpen
Section titled “shopOpen”shopOpen: [
ShopOpenEvent]
Defined in: client/api.d.ts:1793
Dispatched synchronously before Mafia II’s native shop menu opens. Return false to suppress it entirely: no menu is drawn and no shop camera transition starts, which is what replacing the shop with a custom interface needs. Async handlers cannot block it. The server still receives playerShopEnter.
voiceStart
Section titled “voiceStart”voiceStart: []
Defined in: client/api.d.ts:1843
Dispatched when the local player starts speaking on voice chat. Tracks speech rather than the push-to-talk key: a held key with nothing said never starts. Client-side voice is local only – for other players, listen for playerVoiceStart on the server.
voiceStop
Section titled “voiceStop”voiceStop: []
Defined in: client/api.d.ts:1848
Dispatched when the local player stops speaking, either on releasing push-to-talk or shortly after the last frame the microphone produced.
volumeHit
Section titled “volumeHit”volumeHit: [
VolumeContactEvent]
Defined in: client/api.d.ts:1833
Dispatched when the local player enters a volume, raised straight from the game’s own physics sensor with no server round-trip – react locally here and let the server’s own volumeHit handle anything authoritative. Fires on body overlap, not when the player’s origin crosses the boundary.
volumeLeave
Section titled “volumeLeave”volumeLeave: [
VolumeContactEvent]
Defined in: client/api.d.ts:1838
Dispatched when the local player leaves a volume, including when the volume is disabled, moved away or destroyed.
