Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑磊
web-lib
Commits
65d166f7
Commit
65d166f7
authored
Nov 03, 2026
by
郑磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加直接发起内购的原生方法
parent
e8259324
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
native-api.ts
web/native-api.ts
+54
-0
No files found.
web/native-api.ts
View file @
65d166f7
...
@@ -217,3 +217,57 @@ export function openLiveGiftPanel() {
...
@@ -217,3 +217,57 @@ export function openLiveGiftPanel() {
console
.
log
(
'调用框架方法'
,
'openLiveGiftPanel'
)
console
.
log
(
'调用框架方法'
,
'openLiveGiftPanel'
)
callNativeApi
(
'openLiveGiftPanel'
)
callNativeApi
(
'openLiveGiftPanel'
)
}
}
/**
* 拉起内购的配置项
*/
export
interface
InAppPurchaseParams
{
/**
* 内购标识
*/
productIdentifier
:
string
/**
* 内购类型
*/
type
:
string
}
/**
* 内购结果数据
*/
export
interface
InAppPurchaseResult
{
/**
* 内购结果
*/
status
:
string
/**
* 内购标识
*/
productIdentifier
:
string
/**
* 后台返回的订单号
*/
orderId
:
number
}
/**
* 发起内购
* @param params 发起内购的配置项
*/
export
function
inAppPurchase
(
params
:
InAppPurchaseParams
)
{
return
new
Promise
<
InAppPurchaseResult
>
((
resolve
)
=>
{
callNativeApi
(
'openLiveGiftPanel'
,
()
=>
{})
const
onResult
=
(
result
:
InAppPurchaseResult
)
=>
{
resolve
(
result
)
// @ts-ignore
if
(
window
.
onIAPPurchaseResult
===
onResult
)
{
// @ts-ignore
delete
window
.
onIAPPurchaseResult
}
}
// @ts-ignore
window
.
onIAPPurchaseResult
=
onResult
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment