feat(container): add registerApi for H5 custom API registration#189
Merged
feat(container): add registerApi for H5 custom API registration#189
Conversation
Contributor
lbb00
commented
Mar 31, 2026
- Add apiRegistry map, registerApi() and invokeApi() to MiniApp
- Update bridge.js dispatch to use invokeApi() (registry-first, fallback to built-in)
- Add test infrastructure and 7 unit tests for the registration mechanism
Member
|
注入三方 api 将会在 星河开发计划 中实现。当前改动的方案只实现了 web 端的,不完善。 |
Contributor
Author
|
@dos1in 这确实是个临时的方案,不然 Devtools 无法模拟一些 Dimina 缺失的 wx.xxx API。没有完整方案的原因是目前不太确定 Dimina 实现的具体计划,想尽可能少的对 Dimina 仓库进行大的改动。 目前我们在 iOS 用的是 DMPContainerApi.registerMethod,Android 是 MiniApp.getInstance().registerApi |
Contributor
Author
|
还有一个 pr 在等这个 pr 合入。是为了剥离 H5 Container 中的 appList 与 appManager 的依赖,并仿照安卓那一侧实现了 for (const [name, handler] of Object.entries(devtoolsApis)) {
AppManager.registerApi(name, handler)
} |
Member
|
解决代码冲突后合入~ |
3e8ef0c to
9c504e7
Compare
- Add apiRegistry map, registerApi() and invokeApi() to MiniApp - Update bridge.js dispatch to use invokeApi() (registry-first, fallback to built-in) - Add test infrastructure and 7 unit tests for the registration mechanism
9c504e7 to
26e3091
Compare
Contributor
Author
|
@dos1in Done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.