Skip to content

Custom global API namespace#193

Merged
dos1in merged 4 commits intodidi:mainfrom
EchoTechFE:feat/custom-api-namespace
Apr 7, 2026
Merged

Custom global API namespace#193
dos1in merged 4 commits intodidi:mainfrom
EchoTechFE:feat/custom-api-namespace

Conversation

@lbb00
Copy link
Copy Markdown
Contributor

@lbb00 lbb00 commented Apr 3, 2026

支持用户自定义,比如 qd.foo 等同于 wx.foo

lbb00 added 4 commits March 20, 2026 21:36
Add a mechanism for host apps to register custom API namespaces so that
mini-programs can call qd.xxx() equivalently to wx.xxx().

- JS: env.js reads __diminaApiNamespaces and assigns globalApi to each name,
  with H5 fallback via Worker name
- Android: DiminaConfig.addApiNamespace(), JsCore.evaluate(), MiniApp injects
  namespaces before service.js and exposes registerApi()
- iOS: new DiminaConfig singleton, DMPApp injects namespaces in loadBundle()
- HarmonyOS: new DiminaConfig singleton, DMPApp injects in startEngineService()
- H5: jscore.js passes namespaces via Worker name property
…sting SDK entry points

- iOS: add apiNamespaces to DMPAppManager with setup() method
- HarmonyOS: add optional apiNamespaces param to DMPApp.init()
- JS: merge dd/wx and custom namespace registration into one loop
- Delete DiminaConfig.swift and DiminaConfig.ets
@dos1in dos1in merged commit 2bc3b02 into didi:main Apr 7, 2026
2 checks passed
@lbb00 lbb00 deleted the feat/custom-api-namespace branch April 7, 2026 09:36
lbb00 added a commit to EchoTechFE/dimina that referenced this pull request Apr 7, 2026
* feat: support custom global API namespace (e.g. qd.xxx)

Add a mechanism for host apps to register custom API namespaces so that
mini-programs can call qd.xxx() equivalently to wx.xxx().

- JS: env.js reads __diminaApiNamespaces and assigns globalApi to each name,
  with H5 fallback via Worker name
- Android: DiminaConfig.addApiNamespace(), JsCore.evaluate(), MiniApp injects
  namespaces before service.js and exposes registerApi()
- iOS: new DiminaConfig singleton, DMPApp injects namespaces in loadBundle()
- HarmonyOS: new DiminaConfig singleton, DMPApp injects in startEngineService()
- H5: jscore.js passes namespaces via Worker name property

* test(service): add unit tests for env.js API namespace registration

* refactor: remove standalone DiminaConfig, attach apiNamespaces to existing SDK entry points

- iOS: add apiNamespaces to DMPAppManager with setup() method
- HarmonyOS: add optional apiNamespaces param to DMPApp.init()
- JS: merge dd/wx and custom namespace registration into one loop
- Delete DiminaConfig.swift and DiminaConfig.ets

* fix(service): replace self with globalThis to pass oxlint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants