Framework
ASCF is a framework for HarmonyOS atomic service development. It depends on the ASCF runtime to load resource files compiled from ASCF source code and run atomic service projects.
The global object of ASCF APIs is defined as Harmony Atomic Service (HAS).
File types of ASCF source code:
- Layout file: .hxml
- Style file: .css
- Script file: .js
- Inline script: .hjs
Framework differences:
- Package splitting is supported. Each package cannot exceed 2 MB, and the total package size cannot exceed 10 MB. When necessary, you can apply for larger package size. As the tabbar page must be stored in the main package, it is necessary to modify the package splitting logic of the atomic service projects converted from mini programs.
- As restricted by the template, atomic services are centered on the screen by default and there is no option to enforce portrait mode. Subsequent improvement has been planned.
- The return value of constructor of an array in hjs is not a character string but a function. Special processing is recommended.
- Currently, tabBar.custom cannot be set to true. You are advised to manually call has.hideNavBar().
- When setting the globalStyle field of the navigation bar title, navigationBarTextStyle is set to white, but the title is in black. This is because white is not supported. You can change the value of navigationStyle to custom in the app.json file to enable the custom navigation bar.
- Currently, custom components do not support the getPageId method.
- The <image> component cannot be used to display local images.
- The menu bar cannot be hidden when the <video> component is used for video playback in full screen mode. Capability improvement has been planned.
Component
- Components that have been deprecated by the mini program platform are not supported, such as <cover-image> and <cover-view>. You are advised to use components that are still being maintained, such as <image> and <view>.
- Components that depend on plugin capabilities are not supported, such as <functional-page-navigator>, <channel-live>, <channel-video>, <live-player>, <live-pusher>, and <voip-room>.
API
Principles:
- APIs that have been deprecated by the mini program platform are not supported.
- If any mini program APIs are not supported by ASCF, send your request to the following email address. Huawei operations personnel will contact you within 1 to 3 working days.
Email address: atomicservice@huawei.com
Email subject: [Request for ASCF APIs]-[Atomic service name]-[App ID]-[Developer ID] (For details about how to query the app ID, see the following information.)
Email content: request in detail
Basic Information | Description |
Atomic service name | Name of the atomic service to be released on AppGallery. |
APP ID | To obtain the application ID, log in to HUAWEI Developers and choose My Projects > Settings > Regular > App > APP ID. |
Developer ID | HUAWEI ID used by you for debugging. To obtain the HUAWEI ID, log in to HUAWEI Developers and choose My Projects > Settings > Regular > Developer > Developer ID. |
Key API differences:
API | Suggestion |
has.getAccountInfoSync | App ID can be obtained from AppScope or the bundle name in app.json5. |
has.getClipboardData | This API is not supported currently due to the strict control over the clipboard permission. |
has.createInnerAudioContext | This capability is under provision. |
has.getRecorderManager | This capability is under provision. |
has.openDocument | This capability is under provision. |
has.getMenuButtonBoundingClientRect | This capability is under provision. |