3

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)

4

2 回答 2

1

您需要使用事件类型:cast.framework.system.EventType.SHUTDOWN:

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

于 2018-04-13T16:55:17.000 回答
0

带 CAF 接收器的 Synthax:

context.addEventListener(cast.framework.system.EventType.SHUTDOWN,
      e => {
        console.log("Shutdown");
    });
于 2018-11-13T10:37:40.527 回答