@ccos/ccsdk-lite 1.0.1 → 1.0.3
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/dist/bundle.js +19 -8
- package/dist/index.d.ts +4 -2
- package/dist/system/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -80,13 +80,14 @@ function unsetAppCommandCallback() {
|
|
|
80
80
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
81
81
|
let persistentCallbackId = []; // 持久化 callback-id 列表
|
|
82
82
|
function nativeCall(funcName, callbackId, params) {
|
|
83
|
-
if (window['
|
|
83
|
+
if (window['_liteNativeApi']) {
|
|
84
|
+
// 运行于 android 浏览器webview
|
|
84
85
|
var object1 = {
|
|
85
86
|
func: funcName,
|
|
86
87
|
id: callbackId,
|
|
87
88
|
params: params || {}
|
|
88
89
|
};
|
|
89
|
-
window['
|
|
90
|
+
window['_liteNativeApi'].exec(JSON.stringify(object1));
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
function nativeRequest(funcName, params, persistent, persistentIdName, persistentCallback) {
|
|
@@ -480,6 +481,14 @@ function getProperty(key) {
|
|
|
480
481
|
function getLocation() {
|
|
481
482
|
return callNative(getFuncName$4('getLocation'), null);
|
|
482
483
|
}
|
|
484
|
+
// 检查 JS-API 是否已经实现
|
|
485
|
+
function checkApi(apiName) {
|
|
486
|
+
return callNative(getFuncName$4('checkApi'), { apiName });
|
|
487
|
+
}
|
|
488
|
+
// 获取显示屏幕信息
|
|
489
|
+
function getDisplayInfo() {
|
|
490
|
+
return callNative(getFuncName$4('getDisplayInfo'), null);
|
|
491
|
+
}
|
|
483
492
|
var system = {
|
|
484
493
|
getSdkVersion,
|
|
485
494
|
addLifeCycleHook,
|
|
@@ -487,7 +496,9 @@ var system = {
|
|
|
487
496
|
enableSystemKey,
|
|
488
497
|
getDeviceInfo,
|
|
489
498
|
getProperty,
|
|
490
|
-
getLocation
|
|
499
|
+
getLocation,
|
|
500
|
+
checkApi,
|
|
501
|
+
getDisplayInfo,
|
|
491
502
|
};
|
|
492
503
|
|
|
493
504
|
const moduleName$3 = 'storage';
|
|
@@ -960,7 +971,7 @@ var file = {
|
|
|
960
971
|
list
|
|
961
972
|
};
|
|
962
973
|
|
|
963
|
-
window['
|
|
974
|
+
window['appNativeCall'] = function apkNativeCall(str) {
|
|
964
975
|
let res = null;
|
|
965
976
|
//console.log('str1=' + str);
|
|
966
977
|
try {
|
|
@@ -989,8 +1000,8 @@ window['apkNativeCall'] = function apkNativeCall(str) {
|
|
|
989
1000
|
}
|
|
990
1001
|
}
|
|
991
1002
|
};
|
|
992
|
-
function
|
|
993
|
-
return window['
|
|
1003
|
+
function isRunInAppBrowser() {
|
|
1004
|
+
return window['_liteNativeApi'] ? true : false;
|
|
994
1005
|
}
|
|
995
1006
|
var index = {
|
|
996
1007
|
network,
|
|
@@ -1000,7 +1011,7 @@ var index = {
|
|
|
1000
1011
|
androidView,
|
|
1001
1012
|
audio,
|
|
1002
1013
|
file,
|
|
1003
|
-
|
|
1014
|
+
isRunInAppBrowser
|
|
1004
1015
|
};
|
|
1005
1016
|
|
|
1006
|
-
export { index as default,
|
|
1017
|
+
export { index as default, isRunInAppBrowser, setAppCommandCallback, unsetAppCommandCallback };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { setAppCommandCallback, unsetAppCommandCallback } from './core';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function isRunInAppBrowser(): boolean;
|
|
3
3
|
declare const _default: {
|
|
4
4
|
network: {
|
|
5
5
|
simpleHttpRequest: typeof import("./network").simpleHttpRequest;
|
|
@@ -39,6 +39,8 @@ declare const _default: {
|
|
|
39
39
|
getDeviceInfo: typeof import("./system").getDeviceInfo;
|
|
40
40
|
getProperty: typeof import("./system").getProperty;
|
|
41
41
|
getLocation: typeof import("./system").getLocation;
|
|
42
|
+
checkApi: typeof import("./system").checkApi;
|
|
43
|
+
getDisplayInfo: typeof import("./system").getDisplayInfo;
|
|
42
44
|
};
|
|
43
45
|
storage: {
|
|
44
46
|
setKey: typeof import("./storage").setKey;
|
|
@@ -122,6 +124,6 @@ declare const _default: {
|
|
|
122
124
|
setLastModified: typeof import("./file").setLastModified;
|
|
123
125
|
list: typeof import("./file").list;
|
|
124
126
|
};
|
|
125
|
-
|
|
127
|
+
isRunInAppBrowser: typeof isRunInAppBrowser;
|
|
126
128
|
};
|
|
127
129
|
export default _default;
|
package/dist/system/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare function enableSystemKey(params: SystemKeyParam | null): Promise<
|
|
|
8
8
|
export declare function getDeviceInfo(): Promise<any>;
|
|
9
9
|
export declare function getProperty(key: string): Promise<any>;
|
|
10
10
|
export declare function getLocation(): Promise<any>;
|
|
11
|
+
export declare function checkApi(apiName: string): Promise<any>;
|
|
12
|
+
export declare function getDisplayInfo(): Promise<any>;
|
|
11
13
|
declare const _default: {
|
|
12
14
|
getSdkVersion: typeof getSdkVersion;
|
|
13
15
|
addLifeCycleHook: typeof addLifeCycleHook;
|
|
@@ -16,5 +18,7 @@ declare const _default: {
|
|
|
16
18
|
getDeviceInfo: typeof getDeviceInfo;
|
|
17
19
|
getProperty: typeof getProperty;
|
|
18
20
|
getLocation: typeof getLocation;
|
|
21
|
+
checkApi: typeof checkApi;
|
|
22
|
+
getDisplayInfo: typeof getDisplayInfo;
|
|
19
23
|
};
|
|
20
24
|
export default _default;
|