@shijiu/jsview-vue 0.9.246 → 0.9.254
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/dom/bin/package.json +11 -11
- package/dom/browser-root-style.css +21 -21
- package/loader/jsview-main.js +41 -41
- package/loader/jsview.config.default.js +37 -37
- package/loader/jsview.default.config.js +37 -37
- package/package.json +6 -6
- package/patches/node_modules/@babel/preset-env/lib/available-plugins.js +218 -218
- package/patches/node_modules/@vue/cli-plugin-typescript/index.js +100 -100
- package/patches/node_modules/@vue/cli-service/lib/commands/serve.js +395 -395
- package/patches/node_modules/@vue/cli-service/lib/config/app.js +272 -272
- package/patches/node_modules/@vue/cli-service/lib/config/assets.js +70 -70
- package/patches/node_modules/@vue/cli-service/lib/config/base.js +212 -212
- package/patches/node_modules/postcss-js/objectifier.js +90 -90
- package/patches/node_modules/vue-loader/dist/resolveScript.js +70 -70
- package/samples/AdvanceMetroWidget/App.vue +122 -122
- package/samples/AdvanceMetroWidget/Frame.vue +100 -100
- package/samples/AdvanceMetroWidget/Item.vue +57 -57
- package/samples/AdvanceMetroWidget/data.js +136 -136
- package/samples/AnimPicture/App.vue +223 -223
- package/samples/Basic/App.vue +128 -128
- package/samples/Basic/components/TitleBar.vue +28 -28
- package/samples/Basic/components/anim/AnimGroup.vue +67 -67
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +101 -101
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +52 -52
- package/samples/Basic/components/anim/AnimTransition.vue +116 -116
- package/samples/Basic/components/div/DivBackground.vue +14 -14
- package/samples/Basic/components/div/DivClip.vue +80 -80
- package/samples/Basic/components/div/DivCssScoped.vue +26 -26
- package/samples/Basic/components/div/DivCssVar.vue +49 -49
- package/samples/Basic/components/div/DivGroup1.vue +32 -32
- package/samples/Basic/components/div/DivGroup2.vue +40 -40
- package/samples/Basic/components/div/DivLayout.vue +11 -11
- package/samples/Basic/components/div/DivRadius.vue +46 -46
- package/samples/Basic/components/text/TextAlign.vue +47 -47
- package/samples/Basic/components/text/TextFontStyle.vue +57 -57
- package/samples/Basic/components/text/TextGroup.vue +31 -31
- package/samples/Basic/components/text/TextOverflow.vue +77 -77
- package/samples/BasicFocusControl/App.vue +124 -124
- package/samples/BasicFocusControl/components/BaseBlock.vue +50 -50
- package/samples/BasicFocusControl/components/MainArea.vue +97 -97
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +20 -20
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +29 -29
- package/samples/BasicFocusControl/components/SideBar.vue +72 -72
- package/samples/BasicFocusControl/components/SideBarBlock.vue +29 -29
- package/samples/ClassNameDemo/App.vue +119 -119
- package/samples/ClassNameDemo/components/ContentItem.vue +252 -252
- package/samples/ClassNameDemo/components/LoadingView.vue +43 -43
- package/samples/ClassNameDemo/components/TitleView.vue +24 -24
- package/samples/ClassNameDemo/data.js +24 -24
- package/samples/ColorSpace/App.vue +134 -134
- package/samples/DemoHomepage/App.vue +31 -31
- package/samples/DemoHomepage/components/BodyFrame.vue +81 -81
- package/samples/DemoHomepage/components/Dialog.vue +93 -93
- package/samples/DemoHomepage/components/Item.vue +76 -76
- package/samples/DemoHomepage/components/TabFrame.vue +86 -86
- package/samples/DemoHomepage/router.js +132 -132
- package/samples/DemoHomepage/views/Homepage.vue +186 -186
- package/samples/FlipCard/App.vue +80 -80
- package/samples/FlipCard/FlipCard.vue +123 -123
- package/samples/FlipCard/data.js +12 -12
- package/samples/FlowMultiWidget/App.vue +90 -90
- package/samples/FlowMultiWidget/components/Block.vue +106 -106
- package/samples/FlowMultiWidget/components/FlowPage.vue +59 -59
- package/samples/FlowMultiWidget/components/Item.vue +102 -102
- package/samples/FlowMultiWidget/components/MenuItem.vue +71 -71
- package/samples/FlowMultiWidget/components/MyMenu.vue +89 -89
- package/samples/FlowMultiWidget/data.js +446 -446
- package/samples/HashHistory/App.vue +124 -124
- package/samples/HashHistory/components/HorizontalButtonList.vue +113 -113
- package/samples/HashHistory/components/Item.vue +73 -73
- package/samples/HashHistory/router.js +29 -29
- package/samples/HashHistory/views/BasePage.vue +18 -18
- package/samples/HashHistory/views/MainPage.vue +67 -67
- package/samples/HashHistory/views/SubPage.vue +78 -78
- package/samples/HashHistory/views/SubPageFirst.vue +9 -9
- package/samples/HashHistory/views/SubPageSecond.vue +9 -9
- package/samples/LongImage/App.vue +96 -96
- package/samples/LongImage/Button.vue +153 -153
- package/samples/LongImage/LongImageScroll.vue +126 -126
- package/samples/LongImage/Scroll.vue +15 -15
- package/samples/LongText/App.vue +111 -111
- package/samples/LongText/Button.vue +153 -153
- package/samples/LongText/LongTextScroll.vue +224 -224
- package/samples/LongText/Scroll.vue +15 -15
- package/samples/Preload/App.vue +145 -145
- package/samples/Preload/data.js +22 -22
- package/samples/Preload/preloadItem.vue +21 -21
- package/samples/QrcodeDemo/App.vue +72 -72
- package/samples/SimpleWidgetDemo/App.vue +203 -203
- package/samples/SimpleWidgetDemo/Item.vue +82 -82
- package/samples/SimpleWidgetDemo/components/ContentItem.vue +411 -411
- package/samples/SimpleWidgetDemo/components/MyTab.vue +116 -116
- package/samples/SimpleWidgetDemo/data.js +110 -110
- package/samples/SprayView/App.vue +269 -269
- package/samples/SpriteImage/App.vue +174 -174
- package/samples/SpriteImage/images/egg_break.json +116 -116
- package/samples/TextBox/App.vue +178 -178
- package/samples/TextBox/RenderCenter.vue +108 -108
- package/samples/TextBox/RenderLeft.vue +108 -108
- package/samples/TextBox/RenderOneLine.vue +119 -119
- package/samples/TextBox/RenderRight.vue +106 -106
- package/samples/TextShadowDemo/App.vue +97 -97
- package/samples/TextureSize/App.vue +141 -141
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +117 -117
- package/samples/ThrowMoveDemo/App.vue +113 -113
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +115 -115
- package/samples/ThrowMoveDemo/TargetDemo.vue +116 -116
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +121 -121
- package/samples/TransitPage/App.vue +40 -40
- package/samples/VideoDemo/App.vue +137 -137
- package/samples/VideoDemo/components/Button.vue +68 -68
- package/samples/VideoDemo/components/Controllor.vue +195 -195
- package/samples/VideoDemo/components/VideoFrame.vue +152 -152
- package/scripts/common.js +115 -92
- package/scripts/deploy-fast-pack.js +17 -0
- package/scripts/deploy-fast-publish.js +44 -0
- package/scripts/{git-commit-empty.js → deploy-git-commit-empty.js} +21 -21
- package/scripts/{pre-pack.js → deploy-prepare.js} +56 -39
- package/scripts/{install-local-packages.js → jsview-install-local-packages.js} +73 -73
- package/scripts/{post-build.js → jsview-post-build.js} +127 -127
- package/scripts/{post-install.js → jsview-post-install.js} +78 -78
- package/scripts/{run-android.js → jsview-run-android.js} +64 -64
- package/scripts/make-js.sh +181 -181
- package/utils/JsViewEngineWidget/bin/index.js +1 -1
- package/utils/JsViewEngineWidget/bin/package.json +11 -11
- package/utils/JsViewVueTools/JsvHashHistory.js +111 -111
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -417
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -80
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +147 -147
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +54 -54
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +28 -28
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +123 -123
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -83
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -25
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -61
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -119
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -106
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -141
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -20
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -204
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +63 -63
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +426 -426
- package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -12
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +178 -178
- package/utils/JsViewVueWidget/JsvApic/index.js +17 -17
- package/utils/JsViewVueWidget/JsvMarquee.vue +196 -196
- package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -76
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +350 -350
- package/utils/JsViewVueWidget/JsvPreload/index.js +21 -21
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -140
- package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -18
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +139 -139
- package/utils/JsViewVueWidget/JsvSpray/index.js +14 -14
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +447 -447
- package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +56 -56
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -6
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +34 -34
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +494 -494
- package/utils/JsViewVueWidget/JsvSwiper/index.js +9 -9
- package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +34 -34
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +403 -403
- package/utils/JsViewVueWidget/JsvSwiper3D/index.js +9 -9
- package/utils/JsViewVueWidget/JsvTextBox.vue +110 -110
- package/utils/JsViewVueWidget/JsvVideo.vue +35 -35
- package/vetur.config.js +5 -5
- package/.gitmodules +0 -6
- package/README.md +0 -15
- package/doc/IMPORT_CHANGE_LOG.txt +0 -3
- package/doc/about-project-postinstall.md +0 -0
- package/doc/git_commit.md +0 -15
- package/doc/test_version_up.txt +0 -1
- package/scripts/update-version.js +0 -32
- package/shijiu-jsview-vue-0.9.246.tgz +0 -0
|
@@ -1,417 +1,417 @@
|
|
|
1
|
-
/* eslint-disable no-prototype-builtins */
|
|
2
|
-
|
|
3
|
-
let feature_supports = null;
|
|
4
|
-
|
|
5
|
-
let direct_call_map = {};
|
|
6
|
-
function direct_call(name, ...args) {
|
|
7
|
-
if (direct_call_map.hasOwnProperty(name)) {
|
|
8
|
-
let func = direct_call_map[name];
|
|
9
|
-
if (func) {
|
|
10
|
-
return func(...args);
|
|
11
|
-
}
|
|
12
|
-
} else {
|
|
13
|
-
let func = null;
|
|
14
|
-
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge[name] === "function") {
|
|
15
|
-
func = window.jJsvRuntimeBridge[name];
|
|
16
|
-
} else if (window.jContentShellJBridge && typeof window.jContentShellJBridge[name] === "function") {
|
|
17
|
-
func = window.jContentShellJBridge[name];
|
|
18
|
-
}
|
|
19
|
-
direct_call_map[name] = func;
|
|
20
|
-
if (func) {
|
|
21
|
-
return func(...args);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 获取当前集成JsView的APP目前支持的扩展功能列表
|
|
30
|
-
*
|
|
31
|
-
* @returns {string} 功能列表,以逗号隔开,包含:
|
|
32
|
-
* favourite : 支持加入收藏夹功能
|
|
33
|
-
* history : 支持浏览后自动进入历史记录功能
|
|
34
|
-
* textureVideo : 支持将video渲染到texture的方式(JsvVideo高阶控件的usetexture属性控制)
|
|
35
|
-
*/
|
|
36
|
-
function getExtFeatureSupports() {
|
|
37
|
-
if (!feature_supports) {
|
|
38
|
-
feature_supports = direct_call("getExtFeaturesSupport");
|
|
39
|
-
}
|
|
40
|
-
return feature_supports;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 获取设备mac地址,优先获取有线mac,无则获取wifi mac
|
|
45
|
-
* @returns {string} mac address
|
|
46
|
-
*
|
|
47
|
-
*/
|
|
48
|
-
function getMac(){
|
|
49
|
-
return direct_call("getMac");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* 获取设备有线mac地址
|
|
54
|
-
* @returns {string} mac address
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
function getWireMac(){
|
|
58
|
-
return direct_call("getWireMac");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 获取设备wifi mac地址
|
|
63
|
-
* @returns {string} mac address
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
function getWifiMac(){
|
|
67
|
-
return direct_call("getWifiMac");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 获取设备UUID
|
|
72
|
-
* @returns {string} UUID
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
function getDeviceUUID(){
|
|
76
|
-
return direct_call("getDeviceUUID");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* 获取设备Android ID
|
|
81
|
-
* @returns {string} Android ID
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
function getAndroidId(){
|
|
85
|
-
return direct_call("getAndroidId");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* 打开另外一个小程序
|
|
90
|
-
* @param {string} url 小程序url
|
|
91
|
-
* @param {string} startup_image 启动图url
|
|
92
|
-
* @param {string} startup_video 启动视频url
|
|
93
|
-
* @param {int} startup_duration 启动图时长,默认0
|
|
94
|
-
* @param {int} add_history 是否添加历史,0不添加,1添加
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
function openWindow(url, startup_image, startup_video, startup_duration, add_history){
|
|
98
|
-
let setting = {};
|
|
99
|
-
if(startup_image !== null && startup_image !== "")
|
|
100
|
-
setting.startupImage = startup_image;
|
|
101
|
-
|
|
102
|
-
if(startup_video !== null && startup_video !== ""){
|
|
103
|
-
setting.startupVideo = startup_video;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
setting.startupDuration = startup_duration;
|
|
107
|
-
setting.addHistory = (add_history ? 1 : 0); // 兼容true/false传值
|
|
108
|
-
|
|
109
|
-
direct_call("openWindow", url, JSON.stringify(setting));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* 关闭当前小程序
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
function closePage(){
|
|
117
|
-
direct_call("closePage");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 获取设备UUID
|
|
122
|
-
* @param {string} key 属性名称
|
|
123
|
-
* @returns {string} 属性值
|
|
124
|
-
*
|
|
125
|
-
*/
|
|
126
|
-
function getSystemProperty(key){
|
|
127
|
-
return direct_call("getSystemProperty", key);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* 获取已安装应用列表
|
|
132
|
-
* @returns {string} 应用列表,JSON结构的数组
|
|
133
|
-
*
|
|
134
|
-
*/
|
|
135
|
-
function getInstalledApps(){
|
|
136
|
-
return direct_call("getInstalledApps");
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* 启动安卓APP
|
|
141
|
-
* @param {string} package_name 包名
|
|
142
|
-
* @param {string} activity Activity方式启动
|
|
143
|
-
* @param {string} action Action方式启动
|
|
144
|
-
* @param {string} uri Uri方式启动
|
|
145
|
-
* @param {Array} flags 数组,用于intent.addFlags
|
|
146
|
-
* @param {Array} param JSON格式数组,用于intent.putExtra
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
function startNativeApp(package_name, activity, action, uri, flags, param){
|
|
150
|
-
var obj = {};
|
|
151
|
-
if(package_name !== null && package_name !== "")
|
|
152
|
-
obj.packageName = package_name;
|
|
153
|
-
|
|
154
|
-
if(activity !== null && activity !== "")
|
|
155
|
-
obj.activity = activity;
|
|
156
|
-
|
|
157
|
-
if(action !== null && action !== "")
|
|
158
|
-
obj.action = action;
|
|
159
|
-
|
|
160
|
-
if(uri !== null && uri !== "")
|
|
161
|
-
obj.uri = uri;
|
|
162
|
-
|
|
163
|
-
if(flags !== null && flags.length > 0)
|
|
164
|
-
obj.flags = flags;
|
|
165
|
-
|
|
166
|
-
if(param !== null && param.length > 0)
|
|
167
|
-
obj.param = param;
|
|
168
|
-
|
|
169
|
-
direct_call("startNativeApp", JSON.stringify(obj));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* 获取设备信息
|
|
174
|
-
* @returns {string} 终端设备信息,JSON数据结构
|
|
175
|
-
*
|
|
176
|
-
*/
|
|
177
|
-
function getDeviceInfo() {
|
|
178
|
-
return direct_call("getDeviceInfo");
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* 页面加载成功后调用去除启动图
|
|
183
|
-
*
|
|
184
|
-
*/
|
|
185
|
-
function notifyPageLoadDone() {
|
|
186
|
-
notifyPageLoaded();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function notifyPageLoaded() {
|
|
190
|
-
direct_call("notifyPageLoaded");
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* 是否支持收藏功能
|
|
195
|
-
* @returns {boolean} true支持,false不支持
|
|
196
|
-
*
|
|
197
|
-
*/
|
|
198
|
-
function hasFavouriteFunction(){
|
|
199
|
-
let features = getExtFeatureSupports();
|
|
200
|
-
if (features && features.indexOf("favourite") >= 0) {
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* 获取启动内核版本和引擎
|
|
208
|
-
* @returns {Object} 包含
|
|
209
|
-
* COREVERSIONRANGE: 启动时设定的内核版本范围
|
|
210
|
-
* ENGINE: 启动时设定的Js引擎的URL
|
|
211
|
-
*/
|
|
212
|
-
function getStartParams() {
|
|
213
|
-
let json = direct_call("getStartParams");
|
|
214
|
-
if (json) {
|
|
215
|
-
return JSON.parse(json);
|
|
216
|
-
} else {
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* 添加收藏
|
|
223
|
-
* @param {string} url 收藏的url
|
|
224
|
-
* @param {function} callback 执行接口回调, 处理可能被用户否决
|
|
225
|
-
*
|
|
226
|
-
*/
|
|
227
|
-
function addFavourite(url, callback) {
|
|
228
|
-
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.addFavourite === "function") {
|
|
229
|
-
let async_message = window.jJsvRuntimeBridge.addFavourite(url);
|
|
230
|
-
async_message.then((result)=>{
|
|
231
|
-
if (callback) {
|
|
232
|
-
callback(result);
|
|
233
|
-
}
|
|
234
|
-
}).catch((result)=>{
|
|
235
|
-
if (callback) {
|
|
236
|
-
callback(result);
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* 更新收藏
|
|
244
|
-
* @param {string} url 收藏的url
|
|
245
|
-
* @param {function} callback 执行接口回调, 处理可能被用户否决
|
|
246
|
-
*
|
|
247
|
-
*/
|
|
248
|
-
function updateFavourite(url, callback) {
|
|
249
|
-
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.updateFavourite === "function") {
|
|
250
|
-
let async_message = window.jJsvRuntimeBridge.updateFavourite(url);
|
|
251
|
-
async_message.then((result)=>{
|
|
252
|
-
if (callback) {
|
|
253
|
-
callback(result)
|
|
254
|
-
}
|
|
255
|
-
}).catch((result)=>{
|
|
256
|
-
if (callback) {
|
|
257
|
-
callback(result);
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* 删除指定收藏
|
|
265
|
-
* @param {string} app_name app name 唯一标识
|
|
266
|
-
* @param {function} callback 执行接口回调, 处理可能被用户否决
|
|
267
|
-
*
|
|
268
|
-
*/
|
|
269
|
-
function removeFavourite(app_name, callback) {
|
|
270
|
-
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.removeFavourite === "function") {
|
|
271
|
-
let async_message = window.jJsvRuntimeBridge.removeFavourite(app_name);
|
|
272
|
-
async_message.then((result)=>{
|
|
273
|
-
if (callback) {
|
|
274
|
-
callback(result)
|
|
275
|
-
}
|
|
276
|
-
}).catch((result)=>{
|
|
277
|
-
if (callback) {
|
|
278
|
-
callback(result);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* 获取指定收藏
|
|
286
|
-
* @param {string} app_name app name 唯一标识
|
|
287
|
-
*/
|
|
288
|
-
function getFavourite(app_name) {
|
|
289
|
-
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.getFavourite === "function") {
|
|
290
|
-
return window.jJsvRuntimeBridge.getFavourite(app_name);
|
|
291
|
-
}
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* 获取所有收藏
|
|
297
|
-
*
|
|
298
|
-
*/
|
|
299
|
-
function getFavouriteAll() {
|
|
300
|
-
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.getFavouriteAll === "function") {
|
|
301
|
-
return window.jJsvRuntimeBridge.getFavouriteAll();
|
|
302
|
-
}
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* 浮窗控制接口,设置从本浮窗界面进行预热的二级浮窗的启动默认尺寸(若不设置则为全屏)
|
|
308
|
-
* @param {string} mode 全屏模式还是需要Resize的模式。取值范围: "full" 或者 "mini"
|
|
309
|
-
* 设置成 "mini" 模式后,启动后的界面内需要调用popupResizePosition来调整尺寸才能可见
|
|
310
|
-
*/
|
|
311
|
-
function setPopupInitSize(mode) {
|
|
312
|
-
direct_call("setPopupInitSize", mode);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* 浮窗控制接口,设置浮窗显示区域,以相对定位的方式调整弹出框的位置(弹出框弹出后先以尺寸1x1的方式展现)
|
|
317
|
-
* @param {string} align 横纵对齐方式,有left, right, bottom, top, center可选择
|
|
318
|
-
* 例如: 右下角"right bottom", 居中"center center"
|
|
319
|
-
* @param {number} max_width 显示区域最大宽度(占屏幕百分比)
|
|
320
|
-
* @param {number} max_height 显示区域最大高度(占屏幕百分比)
|
|
321
|
-
* @param {number} aspect 横纵比设定
|
|
322
|
-
* 显示区域根据 max_width, max_height, aspect 来计算出同时满足3个条件的最大区域
|
|
323
|
-
*/
|
|
324
|
-
function popupResizePosition(align, max_width, max_height, aspect) {
|
|
325
|
-
direct_call("popupResizePosition", align, max_width, max_height, aspect);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* 浮窗系统认为自己准备好后,调用此接口,获取设备的焦点。若不调用的话,默认浮窗系统捕获的焦点
|
|
330
|
-
*/
|
|
331
|
-
function popupGainFocus() {
|
|
332
|
-
direct_call("popupGainFocus");
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* 页面预热接口,预热页面将会将以一个新的FrameLayout(内含JsView)的方式加载一个新的应用
|
|
337
|
-
* 但这个应用在warmLoadView之前,不会创建texture/surface的实际描画资源,也不会加载图片
|
|
338
|
-
* 仅加载所有JS代码,并正常走完所有启动逻辑(包括描画逻辑),但不会走setTimeout对应的延时逻辑,也不会显示
|
|
339
|
-
* 预热的界面可以极大加速界面切换的时间,例如应用跳转到购物类界面
|
|
340
|
-
* mode为1表示全预热,app_url不能为空,mode为2表示只预热engine url,如果app_url不为空,engine url来自于app_ur
|
|
341
|
-
* 否则来自于当前使用的engine url,app_url表示小程序的链接。
|
|
342
|
-
* 【特别注意】warmUp起来的view,在warmLoadView调用之前,若启动者JsView关闭的话,此View应该在
|
|
343
|
-
* View管理模块被清理掉,以防泄露,但在warmLoadView完成后,就不需要进行关联清理,请管理模块务必保证此机制。
|
|
344
|
-
* [参数]
|
|
345
|
-
* int mode 预热模式,1:全预热,2:半预热
|
|
346
|
-
* String app_url 要预热的app_url,当半预热时,可以为null
|
|
347
|
-
* [返回值]
|
|
348
|
-
* int: 为view_refer_id值,预热后的View的ID,用于后续的warmLoadView和closeWarmView使用
|
|
349
|
-
*/
|
|
350
|
-
function warmUpView(mode, app_url) {
|
|
351
|
-
if(mode !== 1 && mode !== 2) {
|
|
352
|
-
console.error(`not support mode(${mode})`);
|
|
353
|
-
return -1;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if(mode === 1 && (app_url === null || app_url.length === 0)) {
|
|
357
|
-
console.error(`not support params(${mode} ${app_url})`);
|
|
358
|
-
return -1;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
return direct_call("warmUpView", mode, app_url);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* 将warmUpView后的View展示出来
|
|
366
|
-
* 若warmUpView中app_url不为null,进行了全预热,则本调用的app_url可以为null
|
|
367
|
-
* 当warmUpView中设置了app_url时,仍可以新的app_url调整history hash(#)部分进行子页面切换
|
|
368
|
-
*
|
|
369
|
-
* @param {number} view_refer_id warmUpView调用后返回来的View ID
|
|
370
|
-
* @param {string} app_url 界面的应用地址,支持?(search)和#(hash)字段
|
|
371
|
-
* @param {boolean} add_history 启动的界面是否进访问历史列表
|
|
372
|
-
*/
|
|
373
|
-
function warmLoadView(view_refer_id, app_url, add_history) {
|
|
374
|
-
direct_call("warmLoadView", view_refer_id, app_url, !!add_history);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* 关闭warmUp后未进行warmLoad的View,释放资源
|
|
379
|
-
* @param {number} view_refer_id warmUpView调用后返回来的View ID
|
|
380
|
-
*/
|
|
381
|
-
function closeWarmedView(view_refer_id) {
|
|
382
|
-
direct_call("closeWarmedView", view_refer_id);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// 显示声明,可以提高执行速度和利用上编辑器的成员名提示功能
|
|
386
|
-
const bridge = {
|
|
387
|
-
getMac,
|
|
388
|
-
getWireMac,
|
|
389
|
-
getWifiMac,
|
|
390
|
-
getDeviceUUID,
|
|
391
|
-
getAndroidId,
|
|
392
|
-
openWindow,
|
|
393
|
-
closePage,
|
|
394
|
-
getStartParams,
|
|
395
|
-
getSystemProperty,
|
|
396
|
-
getInstalledApps,
|
|
397
|
-
startNativeApp,
|
|
398
|
-
getDeviceInfo,
|
|
399
|
-
notifyPageLoadDone,
|
|
400
|
-
notifyPageLoaded,
|
|
401
|
-
hasFavouriteFunction,
|
|
402
|
-
addFavourite,
|
|
403
|
-
updateFavourite,
|
|
404
|
-
removeFavourite,
|
|
405
|
-
getFavourite,
|
|
406
|
-
getFavouriteAll,
|
|
407
|
-
setPopupInitSize,
|
|
408
|
-
popupResizePosition,
|
|
409
|
-
popupGainFocus,
|
|
410
|
-
warmUpView,
|
|
411
|
-
warmLoadView,
|
|
412
|
-
closeWarmedView
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
export {
|
|
416
|
-
bridge as jJsvRuntimeBridge
|
|
417
|
-
};
|
|
1
|
+
/* eslint-disable no-prototype-builtins */
|
|
2
|
+
|
|
3
|
+
let feature_supports = null;
|
|
4
|
+
|
|
5
|
+
let direct_call_map = {};
|
|
6
|
+
function direct_call(name, ...args) {
|
|
7
|
+
if (direct_call_map.hasOwnProperty(name)) {
|
|
8
|
+
let func = direct_call_map[name];
|
|
9
|
+
if (func) {
|
|
10
|
+
return func(...args);
|
|
11
|
+
}
|
|
12
|
+
} else {
|
|
13
|
+
let func = null;
|
|
14
|
+
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge[name] === "function") {
|
|
15
|
+
func = window.jJsvRuntimeBridge[name];
|
|
16
|
+
} else if (window.jContentShellJBridge && typeof window.jContentShellJBridge[name] === "function") {
|
|
17
|
+
func = window.jContentShellJBridge[name];
|
|
18
|
+
}
|
|
19
|
+
direct_call_map[name] = func;
|
|
20
|
+
if (func) {
|
|
21
|
+
return func(...args);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 获取当前集成JsView的APP目前支持的扩展功能列表
|
|
30
|
+
*
|
|
31
|
+
* @returns {string} 功能列表,以逗号隔开,包含:
|
|
32
|
+
* favourite : 支持加入收藏夹功能
|
|
33
|
+
* history : 支持浏览后自动进入历史记录功能
|
|
34
|
+
* textureVideo : 支持将video渲染到texture的方式(JsvVideo高阶控件的usetexture属性控制)
|
|
35
|
+
*/
|
|
36
|
+
function getExtFeatureSupports() {
|
|
37
|
+
if (!feature_supports) {
|
|
38
|
+
feature_supports = direct_call("getExtFeaturesSupport");
|
|
39
|
+
}
|
|
40
|
+
return feature_supports;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 获取设备mac地址,优先获取有线mac,无则获取wifi mac
|
|
45
|
+
* @returns {string} mac address
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
function getMac(){
|
|
49
|
+
return direct_call("getMac");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 获取设备有线mac地址
|
|
54
|
+
* @returns {string} mac address
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
function getWireMac(){
|
|
58
|
+
return direct_call("getWireMac");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 获取设备wifi mac地址
|
|
63
|
+
* @returns {string} mac address
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
function getWifiMac(){
|
|
67
|
+
return direct_call("getWifiMac");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 获取设备UUID
|
|
72
|
+
* @returns {string} UUID
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
function getDeviceUUID(){
|
|
76
|
+
return direct_call("getDeviceUUID");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 获取设备Android ID
|
|
81
|
+
* @returns {string} Android ID
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
function getAndroidId(){
|
|
85
|
+
return direct_call("getAndroidId");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 打开另外一个小程序
|
|
90
|
+
* @param {string} url 小程序url
|
|
91
|
+
* @param {string} startup_image 启动图url
|
|
92
|
+
* @param {string} startup_video 启动视频url
|
|
93
|
+
* @param {int} startup_duration 启动图时长,默认0
|
|
94
|
+
* @param {int} add_history 是否添加历史,0不添加,1添加
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
function openWindow(url, startup_image, startup_video, startup_duration, add_history){
|
|
98
|
+
let setting = {};
|
|
99
|
+
if(startup_image !== null && startup_image !== "")
|
|
100
|
+
setting.startupImage = startup_image;
|
|
101
|
+
|
|
102
|
+
if(startup_video !== null && startup_video !== ""){
|
|
103
|
+
setting.startupVideo = startup_video;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
setting.startupDuration = startup_duration;
|
|
107
|
+
setting.addHistory = (add_history ? 1 : 0); // 兼容true/false传值
|
|
108
|
+
|
|
109
|
+
direct_call("openWindow", url, JSON.stringify(setting));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* 关闭当前小程序
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
function closePage(){
|
|
117
|
+
direct_call("closePage");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 获取设备UUID
|
|
122
|
+
* @param {string} key 属性名称
|
|
123
|
+
* @returns {string} 属性值
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
function getSystemProperty(key){
|
|
127
|
+
return direct_call("getSystemProperty", key);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 获取已安装应用列表
|
|
132
|
+
* @returns {string} 应用列表,JSON结构的数组
|
|
133
|
+
*
|
|
134
|
+
*/
|
|
135
|
+
function getInstalledApps(){
|
|
136
|
+
return direct_call("getInstalledApps");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 启动安卓APP
|
|
141
|
+
* @param {string} package_name 包名
|
|
142
|
+
* @param {string} activity Activity方式启动
|
|
143
|
+
* @param {string} action Action方式启动
|
|
144
|
+
* @param {string} uri Uri方式启动
|
|
145
|
+
* @param {Array} flags 数组,用于intent.addFlags
|
|
146
|
+
* @param {Array} param JSON格式数组,用于intent.putExtra
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
function startNativeApp(package_name, activity, action, uri, flags, param){
|
|
150
|
+
var obj = {};
|
|
151
|
+
if(package_name !== null && package_name !== "")
|
|
152
|
+
obj.packageName = package_name;
|
|
153
|
+
|
|
154
|
+
if(activity !== null && activity !== "")
|
|
155
|
+
obj.activity = activity;
|
|
156
|
+
|
|
157
|
+
if(action !== null && action !== "")
|
|
158
|
+
obj.action = action;
|
|
159
|
+
|
|
160
|
+
if(uri !== null && uri !== "")
|
|
161
|
+
obj.uri = uri;
|
|
162
|
+
|
|
163
|
+
if(flags !== null && flags.length > 0)
|
|
164
|
+
obj.flags = flags;
|
|
165
|
+
|
|
166
|
+
if(param !== null && param.length > 0)
|
|
167
|
+
obj.param = param;
|
|
168
|
+
|
|
169
|
+
direct_call("startNativeApp", JSON.stringify(obj));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* 获取设备信息
|
|
174
|
+
* @returns {string} 终端设备信息,JSON数据结构
|
|
175
|
+
*
|
|
176
|
+
*/
|
|
177
|
+
function getDeviceInfo() {
|
|
178
|
+
return direct_call("getDeviceInfo");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* 页面加载成功后调用去除启动图
|
|
183
|
+
*
|
|
184
|
+
*/
|
|
185
|
+
function notifyPageLoadDone() {
|
|
186
|
+
notifyPageLoaded();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function notifyPageLoaded() {
|
|
190
|
+
direct_call("notifyPageLoaded");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 是否支持收藏功能
|
|
195
|
+
* @returns {boolean} true支持,false不支持
|
|
196
|
+
*
|
|
197
|
+
*/
|
|
198
|
+
function hasFavouriteFunction(){
|
|
199
|
+
let features = getExtFeatureSupports();
|
|
200
|
+
if (features && features.indexOf("favourite") >= 0) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 获取启动内核版本和引擎
|
|
208
|
+
* @returns {Object} 包含
|
|
209
|
+
* COREVERSIONRANGE: 启动时设定的内核版本范围
|
|
210
|
+
* ENGINE: 启动时设定的Js引擎的URL
|
|
211
|
+
*/
|
|
212
|
+
function getStartParams() {
|
|
213
|
+
let json = direct_call("getStartParams");
|
|
214
|
+
if (json) {
|
|
215
|
+
return JSON.parse(json);
|
|
216
|
+
} else {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* 添加收藏
|
|
223
|
+
* @param {string} url 收藏的url
|
|
224
|
+
* @param {function} callback 执行接口回调, 处理可能被用户否决
|
|
225
|
+
*
|
|
226
|
+
*/
|
|
227
|
+
function addFavourite(url, callback) {
|
|
228
|
+
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.addFavourite === "function") {
|
|
229
|
+
let async_message = window.jJsvRuntimeBridge.addFavourite(url);
|
|
230
|
+
async_message.then((result)=>{
|
|
231
|
+
if (callback) {
|
|
232
|
+
callback(result);
|
|
233
|
+
}
|
|
234
|
+
}).catch((result)=>{
|
|
235
|
+
if (callback) {
|
|
236
|
+
callback(result);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 更新收藏
|
|
244
|
+
* @param {string} url 收藏的url
|
|
245
|
+
* @param {function} callback 执行接口回调, 处理可能被用户否决
|
|
246
|
+
*
|
|
247
|
+
*/
|
|
248
|
+
function updateFavourite(url, callback) {
|
|
249
|
+
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.updateFavourite === "function") {
|
|
250
|
+
let async_message = window.jJsvRuntimeBridge.updateFavourite(url);
|
|
251
|
+
async_message.then((result)=>{
|
|
252
|
+
if (callback) {
|
|
253
|
+
callback(result)
|
|
254
|
+
}
|
|
255
|
+
}).catch((result)=>{
|
|
256
|
+
if (callback) {
|
|
257
|
+
callback(result);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 删除指定收藏
|
|
265
|
+
* @param {string} app_name app name 唯一标识
|
|
266
|
+
* @param {function} callback 执行接口回调, 处理可能被用户否决
|
|
267
|
+
*
|
|
268
|
+
*/
|
|
269
|
+
function removeFavourite(app_name, callback) {
|
|
270
|
+
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.removeFavourite === "function") {
|
|
271
|
+
let async_message = window.jJsvRuntimeBridge.removeFavourite(app_name);
|
|
272
|
+
async_message.then((result)=>{
|
|
273
|
+
if (callback) {
|
|
274
|
+
callback(result)
|
|
275
|
+
}
|
|
276
|
+
}).catch((result)=>{
|
|
277
|
+
if (callback) {
|
|
278
|
+
callback(result);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 获取指定收藏
|
|
286
|
+
* @param {string} app_name app name 唯一标识
|
|
287
|
+
*/
|
|
288
|
+
function getFavourite(app_name) {
|
|
289
|
+
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.getFavourite === "function") {
|
|
290
|
+
return window.jJsvRuntimeBridge.getFavourite(app_name);
|
|
291
|
+
}
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* 获取所有收藏
|
|
297
|
+
*
|
|
298
|
+
*/
|
|
299
|
+
function getFavouriteAll() {
|
|
300
|
+
if (window.jJsvRuntimeBridge && typeof window.jJsvRuntimeBridge.getFavouriteAll === "function") {
|
|
301
|
+
return window.jJsvRuntimeBridge.getFavouriteAll();
|
|
302
|
+
}
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 浮窗控制接口,设置从本浮窗界面进行预热的二级浮窗的启动默认尺寸(若不设置则为全屏)
|
|
308
|
+
* @param {string} mode 全屏模式还是需要Resize的模式。取值范围: "full" 或者 "mini"
|
|
309
|
+
* 设置成 "mini" 模式后,启动后的界面内需要调用popupResizePosition来调整尺寸才能可见
|
|
310
|
+
*/
|
|
311
|
+
function setPopupInitSize(mode) {
|
|
312
|
+
direct_call("setPopupInitSize", mode);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* 浮窗控制接口,设置浮窗显示区域,以相对定位的方式调整弹出框的位置(弹出框弹出后先以尺寸1x1的方式展现)
|
|
317
|
+
* @param {string} align 横纵对齐方式,有left, right, bottom, top, center可选择
|
|
318
|
+
* 例如: 右下角"right bottom", 居中"center center"
|
|
319
|
+
* @param {number} max_width 显示区域最大宽度(占屏幕百分比)
|
|
320
|
+
* @param {number} max_height 显示区域最大高度(占屏幕百分比)
|
|
321
|
+
* @param {number} aspect 横纵比设定
|
|
322
|
+
* 显示区域根据 max_width, max_height, aspect 来计算出同时满足3个条件的最大区域
|
|
323
|
+
*/
|
|
324
|
+
function popupResizePosition(align, max_width, max_height, aspect) {
|
|
325
|
+
direct_call("popupResizePosition", align, max_width, max_height, aspect);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* 浮窗系统认为自己准备好后,调用此接口,获取设备的焦点。若不调用的话,默认浮窗系统捕获的焦点
|
|
330
|
+
*/
|
|
331
|
+
function popupGainFocus() {
|
|
332
|
+
direct_call("popupGainFocus");
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* 页面预热接口,预热页面将会将以一个新的FrameLayout(内含JsView)的方式加载一个新的应用
|
|
337
|
+
* 但这个应用在warmLoadView之前,不会创建texture/surface的实际描画资源,也不会加载图片
|
|
338
|
+
* 仅加载所有JS代码,并正常走完所有启动逻辑(包括描画逻辑),但不会走setTimeout对应的延时逻辑,也不会显示
|
|
339
|
+
* 预热的界面可以极大加速界面切换的时间,例如应用跳转到购物类界面
|
|
340
|
+
* mode为1表示全预热,app_url不能为空,mode为2表示只预热engine url,如果app_url不为空,engine url来自于app_ur
|
|
341
|
+
* 否则来自于当前使用的engine url,app_url表示小程序的链接。
|
|
342
|
+
* 【特别注意】warmUp起来的view,在warmLoadView调用之前,若启动者JsView关闭的话,此View应该在
|
|
343
|
+
* View管理模块被清理掉,以防泄露,但在warmLoadView完成后,就不需要进行关联清理,请管理模块务必保证此机制。
|
|
344
|
+
* [参数]
|
|
345
|
+
* int mode 预热模式,1:全预热,2:半预热
|
|
346
|
+
* String app_url 要预热的app_url,当半预热时,可以为null
|
|
347
|
+
* [返回值]
|
|
348
|
+
* int: 为view_refer_id值,预热后的View的ID,用于后续的warmLoadView和closeWarmView使用
|
|
349
|
+
*/
|
|
350
|
+
function warmUpView(mode, app_url) {
|
|
351
|
+
if(mode !== 1 && mode !== 2) {
|
|
352
|
+
console.error(`not support mode(${mode})`);
|
|
353
|
+
return -1;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if(mode === 1 && (app_url === null || app_url.length === 0)) {
|
|
357
|
+
console.error(`not support params(${mode} ${app_url})`);
|
|
358
|
+
return -1;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return direct_call("warmUpView", mode, app_url);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* 将warmUpView后的View展示出来
|
|
366
|
+
* 若warmUpView中app_url不为null,进行了全预热,则本调用的app_url可以为null
|
|
367
|
+
* 当warmUpView中设置了app_url时,仍可以新的app_url调整history hash(#)部分进行子页面切换
|
|
368
|
+
*
|
|
369
|
+
* @param {number} view_refer_id warmUpView调用后返回来的View ID
|
|
370
|
+
* @param {string} app_url 界面的应用地址,支持?(search)和#(hash)字段
|
|
371
|
+
* @param {boolean} add_history 启动的界面是否进访问历史列表
|
|
372
|
+
*/
|
|
373
|
+
function warmLoadView(view_refer_id, app_url, add_history) {
|
|
374
|
+
direct_call("warmLoadView", view_refer_id, app_url, !!add_history);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* 关闭warmUp后未进行warmLoad的View,释放资源
|
|
379
|
+
* @param {number} view_refer_id warmUpView调用后返回来的View ID
|
|
380
|
+
*/
|
|
381
|
+
function closeWarmedView(view_refer_id) {
|
|
382
|
+
direct_call("closeWarmedView", view_refer_id);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// 显示声明,可以提高执行速度和利用上编辑器的成员名提示功能
|
|
386
|
+
const bridge = {
|
|
387
|
+
getMac,
|
|
388
|
+
getWireMac,
|
|
389
|
+
getWifiMac,
|
|
390
|
+
getDeviceUUID,
|
|
391
|
+
getAndroidId,
|
|
392
|
+
openWindow,
|
|
393
|
+
closePage,
|
|
394
|
+
getStartParams,
|
|
395
|
+
getSystemProperty,
|
|
396
|
+
getInstalledApps,
|
|
397
|
+
startNativeApp,
|
|
398
|
+
getDeviceInfo,
|
|
399
|
+
notifyPageLoadDone,
|
|
400
|
+
notifyPageLoaded,
|
|
401
|
+
hasFavouriteFunction,
|
|
402
|
+
addFavourite,
|
|
403
|
+
updateFavourite,
|
|
404
|
+
removeFavourite,
|
|
405
|
+
getFavourite,
|
|
406
|
+
getFavouriteAll,
|
|
407
|
+
setPopupInitSize,
|
|
408
|
+
popupResizePosition,
|
|
409
|
+
popupGainFocus,
|
|
410
|
+
warmUpView,
|
|
411
|
+
warmLoadView,
|
|
412
|
+
closeWarmedView
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export {
|
|
416
|
+
bridge as jJsvRuntimeBridge
|
|
417
|
+
};
|