@flighthq/lifecycle 0.5.1-next.903.f434bc2 → 0.5.1-next.905.5fbf787
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +4 -4
- package/src/lifecycle.test.ts +27 -14
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/lifecycle`. The `@fl
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/lifecycle@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/lifecycle@0.5.1-next.905.5fbf787](https://github.com/flighthq/flight/tree/5fbf7874064c384307542d68b4dcb6a895ff0dcf/packages/lifecycle)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/5fbf7874064c384307542d68b4dcb6a895ff0dcf/LICENSE.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/lifecycle",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.905.5fbf787",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.905.5fbf787",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.905.5fbf787",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.905.5fbf787"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/lifecycle.test.ts
CHANGED
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
getAppLaunchKind,
|
|
21
21
|
getAppLifecycleState,
|
|
22
22
|
hasLifecycleOperation,
|
|
23
|
+
initializeAppLifecycle,
|
|
24
|
+
initializeWebLifecycleBackend,
|
|
23
25
|
isAppActive,
|
|
24
26
|
isAppBackground,
|
|
25
27
|
isAppInactive,
|
|
@@ -535,6 +537,31 @@ describe('hasLifecycleOperation', () => {
|
|
|
535
537
|
});
|
|
536
538
|
});
|
|
537
539
|
|
|
540
|
+
describe('initializeAppLifecycle', () => {
|
|
541
|
+
it('is the construction initializer of createAppLifecycle', () => {
|
|
542
|
+
expect(typeof initializeAppLifecycle).toBe('function');
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
describe('initializeWebLifecycleBackend', () => {
|
|
547
|
+
it('is the construction initializer of createWebLifecycleBackend', () => {
|
|
548
|
+
expect(typeof initializeWebLifecycleBackend).toBe('function');
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
// Per-operation availability for LifecycleBackend. The operations below are the ones the interface declares
|
|
553
|
+
// OPTIONAL, so a host that omits them is compliant rather than broken — that is the absence-of-an-export
|
|
554
|
+
// ruling, and this is the query that makes it observable.
|
|
555
|
+
const OPTIONAL_OPERATIONS: readonly LifecycleOperation[] = ['getLaunchKind', 'subscribeMemoryWarning'];
|
|
556
|
+
|
|
557
|
+
// A host implementing only the REQUIRED members — partial support declared by absence.
|
|
558
|
+
function partialBackend(): LifecycleBackend {
|
|
559
|
+
const out = allocateEntity<LifecycleBackend>();
|
|
560
|
+
out.getState = (() => undefined) as never;
|
|
561
|
+
out.subscribe = (() => undefined) as never;
|
|
562
|
+
return finishEntity(out);
|
|
563
|
+
}
|
|
564
|
+
|
|
538
565
|
describe('isAppActive', () => {
|
|
539
566
|
it("returns true when state is 'active'", () => {
|
|
540
567
|
const backend = fakeBackend();
|
|
@@ -573,20 +600,6 @@ describe('isAppBackground', () => {
|
|
|
573
600
|
expect(isAppBackground(host)).toBe(false);
|
|
574
601
|
});
|
|
575
602
|
});
|
|
576
|
-
|
|
577
|
-
// Per-operation availability for LifecycleBackend. The operations below are the ones the interface declares
|
|
578
|
-
// OPTIONAL, so a host that omits them is compliant rather than broken — that is the absence-of-an-export
|
|
579
|
-
// ruling, and this is the query that makes it observable.
|
|
580
|
-
const OPTIONAL_OPERATIONS: readonly LifecycleOperation[] = ['getLaunchKind', 'subscribeMemoryWarning'];
|
|
581
|
-
|
|
582
|
-
// A host implementing only the REQUIRED members — partial support declared by absence.
|
|
583
|
-
function partialBackend(): LifecycleBackend {
|
|
584
|
-
const out = allocateEntity<LifecycleBackend>();
|
|
585
|
-
out.getState = (() => undefined) as never;
|
|
586
|
-
out.subscribe = (() => undefined) as never;
|
|
587
|
-
return finishEntity(out);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
603
|
describe('isAppInactive', () => {
|
|
591
604
|
it("returns true when state is 'inactive'", () => {
|
|
592
605
|
const backend = fakeBackend();
|