GithubHelp home page GithubHelp logo

a145789 / smallapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yisar/smallapp

0.0 0.0 0.0 12.04 MB

๐ŸŽƒ Chinese miniapp architecture.

JavaScript 77.08% CSS 21.10% Dockerfile 0.20% EJS 1.62%

smallapp's Introduction

smallapp

smallapp is a Chinese miniapp architecture implementation.

As of now, there are over 7 million miniapps in China, Chinese people do not like to use browsers or search engines.

Musk envied WeChat and he really wanted this miniapp architecture, so I opened it up.

Docs

smallapp follows WeChat's miniapp standard, you should refer to WeChat's documentation.

WeChat miniapp docs

Syntax

<view>
    <text>{{count}}</text>
    <button bindtap="add">+</button>
</view>
Page({
    data: {
        count: 0
    },
    add: () {
        this.setData({
            count: this.data.count + 1
        })

        wx.showToast({ 
            title: 'count is added!' 
        })
    }
})

Demos

https://v.douyin.com/Ug9bwvq/

Principle

  1. compiler
smallapp build -e app.json -o /dist

This step will package the miniapp project into js files, which is double threaded. The jsx file is used for rendering threads, and the js file is used for logical threads.

  1. worker

The logical thread is responsible for running JavaScript logic, and you need to find a JavaScript runtime, such as worker.

  • Web worker
  • Cloudflare worker
  • quickjs/v8/hermes

As long as it has the standard API and communication mechanism of the worker, it can serve as the logical layer of the miniapp.

  1. Native container

Miniapps runs on a super app, such as Wechat/Alipay/Baidu and its API is provided by the native container.

smallapp's People

Contributors

a145789 avatar can-chen avatar dependabot[bot] avatar hoelshen avatar nusr avatar yisar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.