OnElementDestroy: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{ScriptItem2 | ||
| | |name = onElementDestroy | ||
|side = shared | |||
|type = event | |type = event | ||
| | |games = iii vc sa iv | ||
| | |desc = an element is destroyed | ||
| | |arg1 = Element element The element that has been destroyed. | ||
|cancel = true | |||
| | |exampleJS = addEventHandler('OnElementDestroy', (event, element) => { | ||
|exampleLua = addEventHandler( | message(`Element with id ${element.id} has been destroyed.`, COLOUR_RED) | ||
message( | }); | ||
|exampleLua = addEventHandler('OnElementDestroy', function(event, element) | |||
message('Element with id ' .. element.id .. ' has been destroyed.', COLOUR_RED) | |||
end) | end) | ||
}} | }} |
Latest revision as of 03:25, 26 February 2024
Event
Server and Client
Online and Offline
Cancellable
Available since Server 1.0.0, Client 1.0.0
onElementDestroy(Event event, Element element)
The onElementDestroy event is invoked when an element is destroyed.
Parameters
1) | Event | event | The event object for this event. |
2) | Element | element | The element that has been destroyed. |
Attributes
cancellable | This event can be cancelled, by using event.preventDefault. |
Notes
There aren't any notes for this event.
Examples
Example 1 - JavaScript:
addEventHandler('OnElementDestroy', (event, element) => {
message(`Element with id ${element.id} has been destroyed.`, COLOUR_RED)
});
Example 2 - Lua:
addEventHandler('OnElementDestroy', function(event, element)
message('Element with id ' .. element.id .. ' has been destroyed.', COLOUR_RED)
end)
Compatibility
There isn't any compatibility information for this event.
Related
Server Related
OnElementDestroy
OnElementStreamIn
OnElementStreamOut
Client Related
OnElementDestroy
OnElementStreamIn
OnElementStreamOut