Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
enoyee
Scriptable
提交
7d13ca51
S
Scriptable
项目概览
enoyee
/
Scriptable
通知
9
Star
0
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Scriptable
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7d13ca51
编写于
12月 09, 2022
作者:
AndroidLeaves
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
22ca21b2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
83 addition
and
42 deletion
+83
-42
_LSP.js
_LSP.js
+83
-42
未找到文件。
_LSP.js
浏览文件 @
7d13ca51
...
...
@@ -8,7 +8,7 @@
*/
// 当前环境版本号
const
VERSION
=
2022120
8
const
VERSION
=
2022120
9
// 组件配置文件名
const
settingConfigName
=
'
settings.json
'
;
// 组件默认配置
...
...
@@ -53,11 +53,12 @@ class BaseWidget {
return
settings
;
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
配置读取失败
'
,
`
${
error
}
`
);
}
else
{
throw
error
}
this
.
ERRS
.
push
(
error
);
throw
error
}
}
...
...
@@ -66,11 +67,12 @@ class BaseWidget {
this
.
useFileManager
().
writeJSONCache
(
settingConfigName
,
data
);
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
配置写入失败
'
,
`
${
error
}
`
);
}
else
{
throw
error
}
this
.
ERRS
.
push
(
error
);
throw
error
}
}
...
...
@@ -79,11 +81,12 @@ class BaseWidget {
this
.
useFileManager
().
cleanWidgetCache
();
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
配置移除失败
'
,
`
${
error
}
`
);
}
else
{
throw
error
}
this
.
ERRS
.
push
(
error
);
throw
error
}
}
...
...
@@ -230,7 +233,11 @@ class BaseWidget {
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
文件操作
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
}
...
...
@@ -244,11 +251,12 @@ class BaseWidget {
return
true
;
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
文件保存
'
,
`
${
error
}
`
);
}
else
{
throw
error
;
}
this
.
ERRS
.
push
(
error
);
throw
error
;
}
};
...
...
@@ -350,7 +358,11 @@ class BaseWidget {
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
渐变色
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
}
...
...
@@ -432,7 +444,11 @@ class BaseWidget {
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
icon绘制
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
}
...
...
@@ -454,11 +470,7 @@ class BaseWidget {
return
image
;
}
catch
(
error
)
{
console
.
error
(
error
);
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
字体加载
'
,
`
${
error
}
`
);
}
this
.
ERRS
.
push
(
error
);
throw
error
}
}
...
...
@@ -749,11 +761,12 @@ class BaseWidget {
}
}
catch
(
e
)
{
console
.
error
(
`🚫 Get请求失败:
${
e
}
:
${
url
}
`
);
this
.
ERRS
.
push
(
e
);
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
网络请求失败
'
,
`🚫
${
e
}
`
);
}
else
{
throw
e
}
this
.
ERRS
.
push
(
e
);
throw
e
}
this
.
logDivider
();
return
data
;
...
...
@@ -831,11 +844,12 @@ class BaseWidget {
}
}
catch
(
error
)
{
console
.
error
(
`🚫 Post请求失败:
${
error
}
:
${
url
}
`
);
this
.
ERRS
.
push
(
error
);
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
网络请求失败
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
this
.
ERRS
.
push
(
error
);
throw
error
}
this
.
logDivider
();
return
data
;
...
...
@@ -917,11 +931,12 @@ class BaseWidget {
if
(
locationCache
&&
locationCache
.
length
>
0
)
{
locationData
=
JSON
.
parse
(
locationCache
);
}
this
.
ERRS
.
push
(
error
);
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
定位出错
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
this
.
ERRS
.
push
(
error
);
throw
error
}
this
.
logDivider
();
return
locationData
;
...
...
@@ -940,9 +955,13 @@ class BaseWidget {
return
await
drawContext
.
getImage
()
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
logDivider
();
this
.
ERRS
.
push
(
error
);
throw
error
this
.
logDivider
();
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
蒙层添加
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
}
...
...
@@ -1680,7 +1699,11 @@ class BaseWidget {
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
透明背景
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
}
...
...
@@ -2325,20 +2348,30 @@ class BaseWidget {
const
injectListener
=
async
()
=>
{
const
event
=
await
previewWebView
.
evaluateJavaScript
(
`(() => {
const controller = new AbortController()
const listener = (e) => {
completion(e.detail)
controller.abort()
try {
const controller = new AbortController()
const listener = (e) => {
completion(e.detail)
controller.abort()
}
window.addEventListener(
'JBridge',
listener,
{ signal: controller.signal }
)
} catch (e) {
alert("预览界面出错:" + e);
throw new Error("界面处理出错: " + e);
return;
}
window.addEventListener(
'JBridge',
listener,
{ signal: controller.signal }
)
})()`
,
true
).
catch
((
err
)
=>
{
console
.
error
(
err
);
this
.
ERRS
.
push
(
err
);
throw
err
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
APP主界面
'
,
`🚫
${
err
}
`
);
}
else
{
throw
err
}
});
////////////////////////////////////
let
widgetSetting
=
this
.
readWidgetSetting
();
...
...
@@ -2422,7 +2455,11 @@ class BaseWidget {
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
背景处理
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
this
.
dismissLoading
(
previewWebView
);
break
...
...
@@ -2534,7 +2571,11 @@ class BaseWidget {
injectListener
().
catch
((
e
)
=>
{
console
.
error
(
e
);
this
.
ERRS
.
push
(
e
);
throw
e
if
(
!
config
.
runsInApp
)
{
this
.
notify
(
'
主界面
'
,
`🚫
${
e
}
`
);
}
else
{
throw
e
}
});
previewWebView
.
present
();
...
...
@@ -2651,7 +2692,11 @@ class BaseWidget {
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
if
(
!
config
.
runsInApp
)
{
await
this
.
notify
(
'
小组件运行出错
'
,
`🚫
${
error
}
`
);
}
else
{
throw
error
}
}
}
...
...
@@ -2972,8 +3017,6 @@ class CustomFont {
return
Image
.
fromData
(
imageData
)
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
}
}
...
...
@@ -3013,8 +3056,6 @@ class CustomFont {
`
)
}
catch
(
error
)
{
console
.
error
(
error
);
this
.
ERRS
.
push
(
error
);
throw
error
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录