Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common APIs #179

Open
Cyanyan121 opened this issue Feb 17, 2022 · 3 comments
Open

Common APIs #179

Cyanyan121 opened this issue Feb 17, 2022 · 3 comments

Comments

@Cyanyan121
Copy link

Cyanyan121 commented Feb 17, 2022

Nowadays, different vendors have different categories, development guidelines, and implementations for developing Miniapp APIs. The cost of writing multiple sets of code for different vendors is obviously very high for developers. Therefore, it is necessary to define a standard set of APIs for Miniapp to help improve the cross-platform capability of Miniapp, improving developer efficiency.

The specification may contain:

  • Define the Miniapp Object Model to provide APIs for Miniapp;
  • Document the common set of Miniapp APIs by referring to the current specifications of Web APIs;
  • Document the usage of Miniapp APIs, such as synchronous APIs and asynchronous APIs.
@Cyanyan121
Copy link
Author

Cyanyan121 commented Feb 17, 2022

A short draft of Miniapp Common APIs is prepared for CG discussion.

Miniapp Object Model

Abstract

MAOM (Miniapp Object Model) is an object model for Miniapp that provides the JavaScript interface.
This document specifics a set of standard common APIs for Miniapp, and the implementation can help to improve the cross-platform capability of Miniapp, improving developer efficiency.

1. Introduction

1.1 Background

Miniapp is a concept of light software application based on Web technology that runs on userAgent, combined with native application technology implementations. As described in the MiniApp Standardization White Paper, the logic layer is separated from the view layer.
The Logic layer is implemented with JavaScript Worker. The Miniapp interface is rendered by mature Web technologies, and the client-side native capabilities are integrated into an interface for developers to invoke.

1.2 An Overview of MiniApp Object Model

MAOM provides rich native APIs for developers to easily and quickly invoke these APIs to complete related tasks, such as obtaining system information, local storage, payment service, etc.

1.3 Summarize of MiniApp Object Model

MAOM can be classified into three core object models: HOSTOM (Host Object Model), APPOM (App Object Model), PAGEOM (Page Object Model).

HOSTOM(Host Object Model)
HOSTOM (Host Object Model) is the host capability object model that provides a rich set of userAgent capabilities to develop Miniapp with native application experience. It provides API categories including: data storage, payment services, media, device adaptation, network communication, graphics and layout, user interaction, sensing, security and privacy, performance tuning, routing, and interface.

APPOM(App Object Model)
APPOM (App Object Model) is the application object model that provides APIs to listen to the global application lifecycle of Miniapp. Developers use the APPOM APIs to register Miniapp instances, bind the global application lifecycle event handlers, error listening and page non-existence event handlers. It provides API categories including: lifecycle event handlers, error event handlers, and page non-existence event handlers.

PAGEOM(Page Object Model)
PAGEOM (Page Object Model) is the page object model that provides APIs for listening to the lifecycle of Miniapp pages. Each page needs to register a page instance through the PAGEOM API to specify the page's initial data, lifecycle event handlers, and page event handlers. It provides API categories including: page lifecycle event handlers, page event handlers.

2. HOSTOM

2.1 Data Storage

2.2 Device Adaptation

2.3 Media

2.4 Network and Communications

2.5 Payment and Services

2.6 Graphic and Layout

2.7 User Interaction

2.8 Sensors and Local Interactions

2.9 Security and Privacy

2.10 Performance and Tuning

2.11 Router

3. APPOM

4. PAGEOM

@xfq
Copy link
Member

xfq commented Feb 18, 2022

There is some overlap between this issue and #177, maybe we can work on it together?

@Cyanyan121
Copy link
Author

Cyanyan121 commented Mar 2, 2022

There is some overlap between this issue and #177, maybe we can work on it together?

I agree. It will be great to merge these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants