onDemandResources.setEventListener()

Type Function
Return value none
Revision Release 2024.3703
Keywords on-demand resources, onDemandResources, setEventListener
See also onDemandResources.request()
onDemandResources.*

Overview

Sets a "global" listener function that will receive on-demand resources events. This function will receive events from individual calls to onDemandResources.request(). It will also receive the event type of "lowDiskSpace".

Note

If you're not interested in "lowDiskSpace" events, you can ignore this method and simply use individual listener references within request calls.

Syntax

onDemandResources.setEventListener( listener )
listener (required)

Listener. Listener function that will receive on-demand resources events.

Example

local odr = require( "plugin.onDemandResources" )

-- Function to receive events from all on-demand resources calls
local function odrGlobalListener( event )
    print( "Received on-demand resources event" )
    print( "Type: " .. event.type )
    print( "Tag: " .. event.tag )
end

odr.setEventListener( odrGlobalListener )