提交 0e30690a 编写于 作者: d-u-a's avatar d-u-a

docs: ad

上级 6ed5a55a
...@@ -302,7 +302,6 @@ code|message| ...@@ -302,7 +302,6 @@ code|message|
``` ```
// ad.js // ad.js
class AdHelper { class AdHelper {
static get instance() { static get instance() {
if (this._instance == null) { if (this._instance == null) {
...@@ -316,12 +315,12 @@ class AdHelper { ...@@ -316,12 +315,12 @@ class AdHelper {
this._ads = {} this._ads = {}
} }
load(adpid) { load(adpid, onload, onerror) {
if (!adpid || this.isBusy(adpid)) { if (!adpid || this.isBusy(adpid)) {
return return
} }
this.get(adpid).load() this.get(adpid).load(onload, onerror)
} }
show(adpid, onsuccess, onfail) { show(adpid, onsuccess, onfail) {
...@@ -384,6 +383,7 @@ class RewardedVideo { ...@@ -384,6 +383,7 @@ class RewardedVideo {
this._isLoad = false this._isLoad = false
this._isLoading = false this._isLoading = false
this._lastLoadTime = 0 this._lastLoadTime = 0
this._lastError = null
this._loadCallback = null this._loadCallback = null
this._closeCallback = null this._closeCallback = null
...@@ -420,6 +420,8 @@ class RewardedVideo { ...@@ -420,6 +420,8 @@ class RewardedVideo {
this._isLoad = false this._isLoad = false
} }
this._lastError = data
this.onError(data) this.onError(data)
}) })
} }
...@@ -459,6 +461,11 @@ class RewardedVideo { ...@@ -459,6 +461,11 @@ class RewardedVideo {
return return
} }
if (this._lastError !== null) {
this.onError(this._lastError)
return
}
const provider = this.getProvider() const provider = this.getProvider()
if (provider === ProviderType.CSJ && this.isExpired) { if (provider === ProviderType.CSJ && this.isExpired) {
this._isLoad = false this._isLoad = false
...@@ -496,6 +503,7 @@ class RewardedVideo { ...@@ -496,6 +503,7 @@ class RewardedVideo {
_loadAd() { _loadAd() {
this._isLoad = false this._isLoad = false
this._isLoading = true this._isLoading = true
this._lastError = null
this._rewardAd.load() this._rewardAd.load()
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册