Flutter Project
20 Amazing Flutter Open-Source Projects to Know in 2023
Reference
20 Amazing Flutter Open-Source Projects to Know in 2023
Harmony ArkTS
Harmony ArkTS
ArkTS是在TypeScript上扩展. UI是声明式, 设置属性和事件链式调用.
Decorator
@Component 自定义组件, ArkTS卡片
@Entry 入口组件, ArkTS卡片, 一个页面有且只有一个
@State 状态变量
@Builder @Component轻量实现
@BuilderParam @BuilderParam用来装饰指向@Builder方法的变量, 为自定义组件增加特定的功能. 类似slot
@Styles @Styles装饰器可以将多条样式设置提炼成一个方法
@Extend @Extend,用于扩展原生组件样式
多态样式
stateSt...
Harmony Introduce
Harmony Introduce
UI框架:
* 声明式
* 类Web
应用模型:
Feature Ability, FA
Stage
Stage模型应用程序包结构
一个应用可以包含多个Module
Module分为”Ability”和”Library”
“Ability” - 对应编译后HAP (Harmony Ability Package)
“Library” - 对应编译后HAR(Harmony Archive), 或HSP(Harmony Shared Package)
一个Module可以包含多个UIAbility组件
DevEco Studio使用ohpm把应用编译为一个或多个.hap后缀的文件. ...
JS Prototype
JS Prototype
JS 查找属性会依次查看原型, 直到找到或者原型为null为止
# 指定someObject原型
someObject.[[Prototype]]
# 读取及设置原型
Object.getPrototypeOf()
Object.setPrototypeOf()
obj.__proto__ # 非标准
__proto__ syntax
Prototype setter
A property definition of the form proto: value or “proto”: value does not create a property with the name proto. Instead, if the prov...
JS modules
JS modules
basic-modules
index.html
main.js
modules/
canvas.js
square.js
Exporting module features
export statement
can export functions, var, let, const, class. need top-level
export { name, draw, reportArea, reportPerimeter };
Importing features into your script
import { name, draw, reportArea, reportPerimeter } from "./mo...
JS Memory Management
JS Memory Management
Garbage collection
Reference-counting garbage collection
no modern JavaScript engine uses reference-counting for garbage collection anymore.
Mark-and-sweep algorithm
Configuring an engine’s memory model
node --max-old-space-size=6000 index.js
node --expose-gc --inspect index.js
Data structures aiding memory manag...
JS Concurrency
JS Concurrency
Making HTTP requests using fetch()
Accessing a user's camera or microphone using getUserMedia()
Asking a user to select files using showOpenFilePicker()
Promises
let promise = new Promise(function(resolve, reject) {
resolve("done");
reject(new Error("…")); // ignored
setTimeout(() => resolve("…")); // ignored
});
ne...
468 post articles, 59 pages.