# Events

> This events can be triggered from your own resource to interact with the Laptop script.

### av\_laptop:close

> This event is client side and works for closing the laptop UI.
>
> ```lua
> -- client side:
> TriggerEvent('av_laptop:close')
> -- server side:
> TriggerClientEvent('av_laptop:close', playerId)
> ```

### av\_laptop:closed

> This client event is triggered when laptop is closed, use it in your own scripts as listener:
>
> ```lua
> AddEventHandler('av_laptop:closed', function()
>     -- laptop is closed do something
> end
> ```

### Wifi Event

> * The following event gets triggered when the player connects/disconnects from a hotspot, you can use it in your own resource:
>
> ```lua
> RegisterNetEvent('av_laptop:WiFi', function(hotspot, state)
>     print(hotspot, state)
>     -- hotspot: string
>     -- state: boolean
> end)
> ```

### av\_laptop:closeApp

> * Close an specific app by sending the app name as argument, this event is client side.
>
> ```lua
> -- client side:
> TriggerEvent('av_laptop:closeApp', "business")
> -- server side:
> TriggerClientEvent('av_laptop:closeApp', playerId, "business")
> ```

> Use this event to trigger a notification to the user, if the user is using the laptop it will use the UI notification component, otherwise it will use the regular ox\_lib notification.
>
> **params:**
>
> * **title**:`string` Notification header
> * **message**:`string` The message to display
> * **type**:`string` Type can be "error", "success" or "inform"
>
> ```lua
> -- client side
> TriggerEvent('av_laptop:notificationUI', "AV Scripts", "Hello world!", "success"
> -- server side
> TriggerClientEvent('av_laptop:notificationUI', playerId, "AV Scripts", "Hello World!", "success"
> ```

### av\_laptop:tablet

> Toggle the tablet animation, it doesn't do anything else just an animation.
>
> **params:**
>
> * **state**:`boolean` Toggle the tablet animation
>
> ```lua
> -- client side
> TriggerEvent('av_laptop:tablet', true) -- or false to stop animation
> -- server side
> TriggerClientEvent('av_laptop:tablet', playerId, true) -- or false to stop animation
> ```
