Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzj-java
uni-app
提交
b72b47ea
U
uni-app
项目概览
wzj-java
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b72b47ea
编写于
4月 15, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build: v3
上级
c9b4b6c9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
109 addition
and
156 deletion
+109
-156
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+109
-156
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
b72b47ea
...
...
@@ -6628,7 +6628,7 @@ var serviceContext = (function () {
function compressImage$1 (tempFilePath) {
const dstPath = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(tempFilePath)}`;
return new Promise((resolve
, reject
) => {
return new Promise((resolve) => {
plus.nativeUI.showWaiting();
plus.zip.compressImage({
src: tempFilePath,
...
...
@@ -6637,9 +6637,9 @@ var serviceContext = (function () {
}, () => {
plus.nativeUI.closeWaiting();
resolve(dstPath);
}, (
error
) => {
}, () => {
plus.nativeUI.closeWaiting();
re
ject(error
);
re
solve(tempFilePath
);
});
})
}
...
...
@@ -6746,16 +6746,20 @@ var serviceContext = (function () {
function successCallback (tempFilePath = '') {
const dst = `${TEMP_PATH}/compressed/${Date.now()}_${getFileName(tempFilePath)}`;
const compressVideo = compressed ? plus.zip.compressVideo : function (_, callback) {
callback({ tempFilePath });
};
const compressVideo = compressed ? new Promise((resolve) => {
plus.zip.compressVideo({
src: tempFilePath,
dst
}, ({ tempFilePath }) => {
resolve(tempFilePath);
}, () => {
resolve(tempFilePath);
});
}) : Promise.resolve();
if (compressed) {
plus.nativeUI.showWaiting();
}
compressVideo({
src: tempFilePath,
dst
}, ({ tempFilePath }) => {
compressVideo.then(tempFilePath => {
if (compressed) {
plus.nativeUI.closeWaiting();
}
...
...
@@ -6771,12 +6775,9 @@ var serviceContext = (function () {
result.width = videoInfo.width;
result.height = videoInfo.height;
invoke$1(callbackId, result);
},
},
errorCallback
});
}, error => {
plus.nativeUI.closeWaiting();
errorCallback(error);
});
}
...
...
@@ -10737,15 +10738,22 @@ var serviceContext = (function () {
return new RewardedVideoAd(options)
}
const eventTypes = {
load: 'load',
close: 'close',
error: 'error',
adClicked: 'adClicked'
};
const eventNames$1 = [
'load'
,
'close'
,
'error'
,
'adClicked'
eventTypes.load
,
eventTypes.close
,
eventTypes.error
,
eventTypes.adClicked
];
class
FullScreenVideoAd
{
constructor (
options = {}
) {
class
AdBase
{
constructor (
adInstance, options
) {
const _callbacks = this._callbacks = {};
eventNames$1.forEach(item => {
_callbacks[item] = [];
...
...
@@ -10755,151 +10763,69 @@ var serviceContext = (function () {
};
});
this._isLoad = false;
this._adError = '';
this._loadPromiseResolve = null;
this._loadPromiseReject = null;
this._lastLoadTime = 0;
const ad = this._ad = plus.ad.createFullScreenVideoAd(options);
ad.onLoad((e) => {
this._isLoad = true;
this._lastLoadTime = Date.now();
this._dispatchEvent('load', {});
if (this._loadPromiseResolve != null) {
this._loadPromiseResolve();
this._loadPromiseResolve = null;
}
});
ad.onClose((e) => {
this._isLoad = false;
this._dispatchEvent('close', { isEnded: e.isEnded });
});
ad.onError((e) => {
const { code, message } = e;
const data = { code: code, errMsg: message };
this._adError = message;
if (code === -5008) {
this._isLoad = false;
}
this._dispatchEvent('error', data);
if (this._loadPromiseReject != null) {
this._loadPromiseReject(data);
this._loadPromiseReject = null;
}
});
ad.onAdClicked((e) => {
this._dispatchEvent('adClicked', {});
});
}
load () {
return new Promise((resolve, reject) => {
if (this._isLoad) {
resolve();
return
}
this._loadPromiseResolve = resolve;
this._loadPromiseReject = reject;
this._loadAd();
})
}
show () {
return new Promise((resolve, reject) => {
if (this._isLoad) {
this._ad.show();
resolve();
} else {
reject(new Error(this._adError));
}
})
}
getProvider () {
return this._ad.getProvider()
}
destroy () {
this._ad.destroy();
}
_loadAd () {
this._isLoad = false;
this._ad.load();
}
_dispatchEvent (name, data) {
this._callbacks[name].forEach(callback => {
if (typeof callback === 'function') {
callback(data || {});
}
});
}
}
function createFullScreenVideoAd (options) {
return new FullScreenVideoAd(options)
}
const eventNames$2 = [
'load',
'close',
'error',
'adClicked'
];
this._preload = options.preload !== undefined ? options.preload : false;
class InterstitialAd {
constructor (options = {}) {
const _callbacks = this._callbacks = {};
eventNames$2.forEach(item => {
_callbacks[item] = [];
const name = item[0].toUpperCase() + item.substr(1);
this[`on${name}`] = function (callback) {
_callbacks[item].push(callback);
};
});
this._isLoad = false;
this._isLoaded = false;
this._isLoading = false;
this._adError = '';
this._loadPromiseResolve = null;
this._loadPromiseReject = null;
this._showPromiseResolve = null;
this._showPromiseReject = null;
const ad = this._ad =
plus.ad.createInterstitialAd(options)
;
const ad = this._ad =
adInstance
;
ad.onLoad((e) => {
this._isLoad = true;
this._isLoad
ed
= true;
this._isLoading = false;
this._dispatchEvent(
'load'
, {});
this._dispatchEvent(
eventTypes.load
, {});
if (this._loadPromiseResolve != null) {
this._loadPromiseResolve();
this._loadPromiseResolve = null;
}
if (this._showPromiseResolve != null) {
this._showPromiseResolve();
this._showPromiseResolve = null;
this._showAd();
}
});
ad.onClose((e) => {
this._isLoad = false;
this._isLoad
ed
= false;
this._isLoading = false;
this._dispatchEvent('close', {});
this._dispatchEvent(eventTypes.close, { isEnded: e.isEnded });
if (this._preload === true) {
this._loadAd();
}
});
ad.onError((e) => {
this._isLoading = false;
const { code, message } = e;
const data = { code: code, errMsg: message };
this._adError = message;
const data = {
code: e.code,
errMsg: e.message
};
this._dispatchEvent('error', data);
this._adError = data;
this._dispatchEvent(eventTypes.error, data);
const promiseError = new Error(JSON.stringify(this._adError));
promiseError.code = e.code;
promiseError.errMsg = e.message;
if (this._loadPromiseReject != null) {
this._loadPromiseReject(
data
);
this._loadPromiseReject(
promiseError
);
this._loadPromiseReject = null;
}
if (this._showPromiseReject != null) {
this._showPromiseReject(promiseError);
this._showPromiseReject = null;
}
});
ad.onAdClicked((e) => {
this._dispatchEvent(
'adClicked'
, {});
ad.onAdClicked
&& ad.onAdClicked
((e) => {
this._dispatchEvent(
eventTypes.adClicked
, {});
});
}
...
...
@@ -10910,43 +10836,52 @@ var serviceContext = (function () {
if (this._isLoading) {
return
}
if (this._isLoad) {
if (this._isLoaded) {
resolve();
return
} else {
this._loadAd();
}
this._loadAd();
})
}
show () {
return new Promise((resolve, reject) => {
this._showPromiseResolve = resolve;
this._showPromiseReject = reject;
if (this._isLoading) {
return
}
if (this._isLoad) {
this._
ad.show
();
if (this._isLoad
ed
) {
this._
showAd
();
resolve();
} else {
reject(new Error(this._adError)
);
this._loadAd(
);
}
})
}
getProvider () {
return this._ad.getProvider()
}
destroy () {
this._ad.destroy();
}
getProvider () {
return this._ad.getProvider()
}
_loadAd () {
this._isLoad = false;
this._adError = '';
this._isLoaded = false;
this._isLoading = true;
this._ad.load();
}
_showAd () {
this._ad.show();
}
_dispatchEvent (name, data) {
this._callbacks[name].forEach(callback => {
if (typeof callback === 'function') {
...
...
@@ -10956,6 +10891,24 @@ var serviceContext = (function () {
}
}
class FullScreenVideoAd extends AdBase {
constructor (options = {}) {
super(plus.ad.createFullScreenVideoAd(options), options);
}
}
function createFullScreenVideoAd (options) {
return new FullScreenVideoAd(options)
}
class InterstitialAd extends AdBase {
constructor (options = {}) {
super(plus.ad.createInterstitialAd(options), options);
this.load();
}
}
function createInterstitialAd (options) {
return new InterstitialAd(options)
}
...
...
@@ -11158,7 +11111,7 @@ var serviceContext = (function () {
return page && page.$page.id
}
const eventNames$
3
= [
const eventNames$
2
= [
'canplay',
'play',
'pause',
...
...
@@ -11171,7 +11124,7 @@ var serviceContext = (function () {
'waiting'
];
const callbacks$5 = {};
eventNames$
3
.forEach(name => {
eventNames$
2
.forEach(name => {
callbacks$5[name] = [];
});
...
...
@@ -11290,7 +11243,7 @@ var serviceContext = (function () {
}
}
eventNames$
3
.forEach(item => {
eventNames$
2
.forEach(item => {
const name = item[0].toUpperCase() + item.substr(1);
BackgroundAudioManager.prototype[`on${name}`] = function (callback) {
callbacks$5[item].push(callback);
...
...
@@ -19191,7 +19144,7 @@ var serviceContext = (function () {
EditorContext: EditorContext
});
const eventNames$
4
= [
const eventNames$
3
= [
'canplay',
'play',
'pause',
...
...
@@ -19256,7 +19209,7 @@ var serviceContext = (function () {
this.id = id;
this._callbacks = {};
this._options = {};
eventNames$
4
.forEach(name => {
eventNames$
3
.forEach(name => {
this._callbacks[name.toLowerCase()] = [];
});
props$1.forEach(item => {
...
...
@@ -19316,7 +19269,7 @@ var serviceContext = (function () {
}
}
eventNames$
4
.forEach(item => {
eventNames$
3
.forEach(item => {
const name = item[0].toUpperCase() + item.substr(1);
item = item.toLowerCase();
InnerAudioContext.prototype[`on${name}`] = function (callback) {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录