@jolibox/implement 1.1.18 → 1.1.19-beta.1
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/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.
|
|
3
|
+
> @jolibox/implement@1.1.19-beta.1 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.
|
|
7
|
+
> @jolibox/implement@1.1.19-beta.1 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.19-beta.1",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.
|
|
10
|
-
"@jolibox/types": "1.1.
|
|
11
|
-
"@jolibox/native-bridge": "1.1.
|
|
9
|
+
"@jolibox/common": "1.1.19-beta.1",
|
|
10
|
+
"@jolibox/types": "1.1.19-beta.1",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.19-beta.1",
|
|
12
12
|
"localforage": "1.10.0",
|
|
13
13
|
"@jolibox/ui": "1.0.0",
|
|
14
14
|
"web-vitals": "4.2.4"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createCommands, UserCustomError } from '@jolibox/common';
|
|
1
|
+
import { createCommands, hostEmitter, UserCustomError } from '@jolibox/common';
|
|
2
2
|
import { invokeNative } from '@jolibox/native-bridge';
|
|
3
3
|
import { createSyncAPI, t, registerCanIUse } from './base';
|
|
4
4
|
import { context } from '@/common/context';
|
|
@@ -44,9 +44,17 @@ const closePageSync = createSyncAPI('closePageSync', {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
+
const interceptSystemExitSync = createSyncAPI('interceptSystemExitSync', {
|
|
48
|
+
paramsSchema: t.tuple(t.boolean()),
|
|
49
|
+
implement: (intercept) => {
|
|
50
|
+
hostEmitter.emit('onInterceptSystemExit', { intercept });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
47
54
|
commands.registerCommand('RouterSDK.openSchema', openSchemaSync);
|
|
48
55
|
commands.registerCommand('RouterSDK.openPage', openPageSync);
|
|
49
56
|
commands.registerCommand('RouterSDK.closePage', closePageSync);
|
|
57
|
+
commands.registerCommand('RouterSDK.interceptSystemExit', interceptSystemExitSync);
|
|
50
58
|
|
|
51
59
|
registerCanIUse('router.openSchema', {
|
|
52
60
|
version: '1.1.10'
|
|
@@ -59,3 +67,7 @@ registerCanIUse('router.openPage', {
|
|
|
59
67
|
registerCanIUse('router.closePage', {
|
|
60
68
|
version: '1.1.10'
|
|
61
69
|
});
|
|
70
|
+
|
|
71
|
+
registerCanIUse('router.interceptSystemExit', {
|
|
72
|
+
version: '1.1.18'
|
|
73
|
+
});
|
|
@@ -40,6 +40,11 @@ let isAdShowing = false;
|
|
|
40
40
|
|
|
41
41
|
let baskcMeta: IBasicMetaConfig | null = null;
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* 是否全局系统退出
|
|
45
|
+
*/
|
|
46
|
+
let isInterceptSystemExit = false;
|
|
47
|
+
|
|
43
48
|
RuntimeLoader.onReady(() => {
|
|
44
49
|
// TODO: merge some env config
|
|
45
50
|
});
|
|
@@ -59,6 +64,15 @@ function addShowAdListener() {
|
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
/**
|
|
68
|
+
* 添加系统退出拦截监听
|
|
69
|
+
*/
|
|
70
|
+
function addInterceptSystemExitListener() {
|
|
71
|
+
hostEmitter.on('onInterceptSystemExit', ({ intercept }) => {
|
|
72
|
+
isInterceptSystemExit = intercept;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
/**
|
|
63
77
|
* The DOMContentLoaded event might be triggered very early,
|
|
64
78
|
* so the global loaded listener should be executed during the bootstrap process.
|
|
@@ -124,8 +138,12 @@ function addDoExitLoader() {
|
|
|
124
138
|
taskTracker.close(Date.now() - start_timestamp);
|
|
125
139
|
};
|
|
126
140
|
|
|
141
|
+
const shouldInterceptSystemExit = () => {
|
|
142
|
+
return isAdShowing || isInterceptSystemExit;
|
|
143
|
+
};
|
|
144
|
+
|
|
127
145
|
RuntimeLoader.onDoExit(async () => {
|
|
128
|
-
if (
|
|
146
|
+
if (shouldInterceptSystemExit()) {
|
|
129
147
|
return true; // Forbid exit on watching ads
|
|
130
148
|
}
|
|
131
149
|
|
|
@@ -168,6 +186,7 @@ export function config(): void {
|
|
|
168
186
|
start_timestamp = Date.now();
|
|
169
187
|
addGameServiceReadyListener();
|
|
170
188
|
addShowAdListener();
|
|
189
|
+
addInterceptSystemExitListener();
|
|
171
190
|
addDoExitLoader();
|
|
172
191
|
addWebviewReadyListener();
|
|
173
192
|
addI18nChangedListener();
|