Kici
Kici

Reputation: 169

CAF Receiver, shutdown handling

i'm trying to add logic to the shutdown event on my receiver app but every time the sender disconnects, debugger just closes and no logic is executed (like sending some HttpRequests). My piece of code:

this.context.addEventListener(
        cast.framework.system.ShutdownEvent,
        e => {
                this._sendStats();
        });

Also tried cast.framework.system.SHUTDOWN and cast.framework.system.SENDER_DISCONNECTED. Is there other way to get the expected result (executing logic on apps shutdown)

Upvotes: 3

Views: 756

Answers (2)

Hrk
Hrk

Reputation: 2764

Synthax with CAF Receiver:

context.addEventListener(cast.framework.system.EventType.SHUTDOWN,
      e => {
        console.log("Shutdown");
    });

Upvotes: 1

Leon Nicholls
Leon Nicholls

Reputation: 4656

You need to use the event type: cast.framework.system.EventType.SHUTDOWN:

https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.system#.EventType

Upvotes: 1

Related Questions