diff --git a/requirements/specifications/lifecycle/index.md b/requirements/specifications/lifecycle/index.md index ed7f85a11..9a1cecdf3 100644 --- a/requirements/specifications/lifecycle/index.md +++ b/requirements/specifications/lifecycle/index.md @@ -71,7 +71,6 @@ off. - [4. Core SDK APIs](#4-core-sdk-apis) - [4.1. LifecycleManagement Interface](#41-lifecyclemanagement-interface) - [4.2. Ready](#42-ready) - - [4.3. Loading](#43-loading) - [4.4. Close](#44-close) - [4.5. Background](#45-background) - [4.6. Finished](#46-finished) @@ -107,7 +106,6 @@ For information on *influencing* state transitions, see [State Transitions](#3-l | Background | ✔ | ✔ | ✔ | ✔ | | App has full access to CPU and RAM, but not RCU input focus. | | Suspended | | | | | | App state is persisted to storage and removed from CPU & RAM. | - ### 2.1. Started This state allows an app to be running, but not in one of the two active @@ -609,7 +607,7 @@ The `LifeCycleManagement` interface is implemented by Apps to provide resource m ```typescript interface LifecycleManagement { - function initialize(): Promise; + function create(params: LaunchParameters): Promise; function activate(intent: NavigationIntent): Promise; function deactivate(): Promise; function suspend(): Promise; @@ -617,6 +615,43 @@ interface LifecycleManagement { } ``` +Example: + +```typescript +import { Lifecycle } from '@firebolt-js/sdk' + +class ExampleLifecycleManager implements Lifecycle.LifecycleManagement { + function create(params: LaunchParameters): Promise { + const limitTracking:boolean = params.limitAdTracking + } + + function activate(intent: NavigationIntent): Promise { + if (intent.action === "playback") { + console.log("Deep link to playback of " + intent.data.entityId) + } + } + + function deactivate(): Promise { + // free up MSE + video.src = "" + video.load() + } + + function suspend(): Promise { + // unload all images + document.querySelectorAll("img").forEach((img:HTMLElement) => { + img.parentElement.removeChild(img) + }) + } + + function resume(): Promise { + // reload images + } +} + + +``` + See the [Firebolt API Documentation](https://developer.comcast.com/firebolt/core/sdk/latest/api/) for details around syntax, etc. @@ -750,6 +785,8 @@ app to unsuspend. ## 6. Lifecycle Configuration +TODO: do we want these to be per spec, per distributor, or per app? + In order to enable Firebolt Certification of a device's Lifecycle Management features, the device **MUST** support the following configuration options, so that the Firebolt Certification Test Suite