nwo
stringclasses 304
values | sha
stringclasses 304
values | path
stringlengths 9
214
| language
stringclasses 1
value | identifier
stringlengths 0
49
| docstring
stringlengths 1
34.2k
| function
stringlengths 8
59.4k
| ast_function
stringlengths 71
497k
| obf_function
stringlengths 8
39.4k
| url
stringlengths 102
324
| function_sha
stringlengths 40
40
| source
stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
|
arkts
|
[Start builder_node_pool] 继承NodeController,创建可以复用的子组件
|
export class NodeItem extends NodeController {
// [StartExclude builder_node_pool]
public builder: WrappedBuilder<ESObject> | null = null;
public node: BuilderNode<ESObject> | null = null;
public data: ESObject = {};
// Sub component type, when reused, the corresponding sub component will be searched for and used based on the type
public type: string = '';
public id: number = 0;
aboutToDisappear(): void {
// Recycle components to the reuse pool when the page is destroyed
NodePool.getInstance().recycleNode(this.type, this);
}
update(data: ESObject) {
this.data = data;
this.node?.reuse(data);
}
// Create nodes
makeNode(uiContext: UIContext): FrameNode | null {
if (!this.node) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
} else {
this.update(this.data);
}
return this.node.getFrameNode();
}
// [EndExclude builder_node_pool]
// [StartExclude builder_node_pool]
prebuild(uiContext: UIContext) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class NodeItem extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // [StartExclude builder_node_pool] AST#property_declaration#Left public builder : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public node : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left BuilderNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // Sub component type, when reused, the corresponding sub component will be searched for and used based on the type AST#property_declaration#Left public type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // Recycle components to the reuse pool when the page is destroyed AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NodePool AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . recycleNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right AST#expression#Right , AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right = AST#expression#Left data AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right AST#expression#Right ?. reuse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // Create nodes AST#method_declaration#Left makeNode AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FrameNode AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . node AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BuilderNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right AST#expression#Right . build AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builder AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right AST#expression#Right . getFrameNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // [EndExclude builder_node_pool] // [StartExclude builder_node_pool] AST#method_declaration#Left prebuild AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left BuilderNode AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . node AST#member_expression#Right AST#expression#Right . build AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builder AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class NodeItem extends NodeController {
public builder: WrappedBuilder<ESObject> | null = null;
public node: BuilderNode<ESObject> | null = null;
public data: ESObject = {};
public type: string = '';
public id: number = 0;
aboutToDisappear(): void {
NodePool.getInstance().recycleNode(this.type, this);
}
update(data: ESObject) {
this.data = data;
this.node?.reuse(data);
}
makeNode(uiContext: UIContext): FrameNode | null {
if (!this.node) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
} else {
this.update(this.data);
}
return this.node.getFrameNode();
}
prebuild(uiContext: UIContext) {
this.node = new BuilderNode(uiContext);
this.node.build(this.builder, this.data);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L22-L60
|
c7e71418a517543448766809d04a3629bb38f95b
|
gitee
|
|
lentozi/DailyPlan.git
|
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
|
entry/src/main/ets/tabcontent/HomeContent.ets
|
arkts
|
onSelectedChanged
|
@Watch 选中的日期更新后重新查找日期对应的代办列表
|
onSelectedChanged() {
this.getCurrentDayTodo();
}
|
AST#method_declaration#Left onSelectedChanged AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCurrentDayTodo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onSelectedChanged() {
this.getCurrentDayTodo();
}
|
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/tabcontent/HomeContent.ets#L23-L25
|
466184e5da6c1ce9e51ee5061444c7fcb0221245
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets
|
arkts
|
ForEachItem
|
循环遍历列表
|
@Component
export struct ForEachItem {
// 需要遍历的数据数组
private dataGroup: ListConstruction[] = [];
build() {
Row() {
List({
space: LIST_SPACE
}) {
// TODO: 性能知识点:使用ForEach组件循环渲染数据
ForEach(this.dataGroup, (item: ListConstruction) => {
ListItem() {
UserItemView({ text: item });
}
}, (item: ListConstruction) => JSON.stringify(item))
}
.divider({
strokeWidth: STROKE_WIDTH,
color: $r('app.color.pinyin_divider_color'),
startMargin: $r('app.integer.pinyin_divider_start_margin'),
endMargin: $r('app.integer.pinyin_divider_end_margin')
})
}
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.pinyin_list_background'))
.borderRadius($r('app.integer.pinyin_list_radius'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ForEachItem AST#component_body#Left { // 需要遍历的数据数组 AST#property_declaration#Left private dataGroup : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListConstruction [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left LIST_SPACE AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // TODO: 性能知识点:使用ForEach组件循环渲染数据 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataGroup AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ListConstruction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left UserItemView ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ListConstruction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left STROKE_WIDTH AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_divider_start_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_divider_end_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pinyin_list_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pinyin_list_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ForEachItem {
private dataGroup: ListConstruction[] = [];
build() {
Row() {
List({
space: LIST_SPACE
}) {
ForEach(this.dataGroup, (item: ListConstruction) => {
ListItem() {
UserItemView({ text: item });
}
}, (item: ListConstruction) => JSON.stringify(item))
}
.divider({
strokeWidth: STROKE_WIDTH,
color: $r('app.color.pinyin_divider_color'),
startMargin: $r('app.integer.pinyin_divider_start_margin'),
endMargin: $r('app.integer.pinyin_divider_end_margin')
})
}
.alignItems(VerticalAlign.Center)
.backgroundColor($r('app.color.pinyin_list_background'))
.borderRadius($r('app.integer.pinyin_list_radius'))
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets#L154-L182
|
9c938bfbca74e4aa42fcff067689beb369109d59
|
gitee
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
|
arkts
|
Page begin event at the begin of web page loading.
@typedef OnPageBeginEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12
|
export declare interface OnPageBeginEvent {
/**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
url: string;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnPageBeginEvent AST#object_type#Left { /**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_member#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export declare interface OnPageBeginEvent {
url: string;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L244-L254
|
cc8cdc8000984863493fd56b5d7587ccc6dbc799
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
|
arkts
|
deleteItem
|
在指定索引位置增加一个元素
|
public deleteItem(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
}
|
AST#method_declaration#Left public deleteItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public deleteItem(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L131-L134
|
a06f9d77ebbad86e727f25fb8b7c897cb8157258
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/social/CommunityService.ets
|
arkts
|
createDefaultUser
|
创建默认用户
|
private createDefaultUser(): UserProfile {
return {
id: `user_${Date.now()}`,
username: '用户' + Math.floor(Math.random() * 10000),
displayName: '新用户',
joinDate: new Date().toISOString(),
level: 1,
points: 0,
badges: [],
isVerified: false,
isOnline: true,
lastActive: new Date().toISOString(),
statistics: {
totalPosts: 0,
totalLikes: 0,
totalComments: 0,
totalShares: 0,
totalFollowers: 0,
totalFollowing: 0,
totalBirthdays: 0,
joinDays: 0
},
preferences: {
isPublic: true,
allowMessages: true,
allowNotifications: true,
showBirthdays: true,
showLocation: false,
language: 'zh-CN'
}
};
}
|
AST#method_declaration#Left private createDefaultUser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserProfile AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` user_ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left username AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '用户' AST#expression#Right + AST#expression#Left Math AST#expression#Right AST#binary_expression#Right AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left 10000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left displayName AST#property_name#Right : AST#expression#Left '新用户' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left joinDate AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left level AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left points AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left badges AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isVerified AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isOnline AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lastActive AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left statistics AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalPosts AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalLikes AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalComments AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalShares AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalFollowers AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalFollowing AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left totalBirthdays AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left joinDays AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferences AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left isPublic AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left allowMessages AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left allowNotifications AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showBirthdays AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showLocation AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left language AST#property_name#Right : AST#expression#Left 'zh-CN' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private createDefaultUser(): UserProfile {
return {
id: `user_${Date.now()}`,
username: '用户' + Math.floor(Math.random() * 10000),
displayName: '新用户',
joinDate: new Date().toISOString(),
level: 1,
points: 0,
badges: [],
isVerified: false,
isOnline: true,
lastActive: new Date().toISOString(),
statistics: {
totalPosts: 0,
totalLikes: 0,
totalComments: 0,
totalShares: 0,
totalFollowers: 0,
totalFollowing: 0,
totalBirthdays: 0,
joinDays: 0
},
preferences: {
isPublic: true,
allowMessages: true,
allowNotifications: true,
showBirthdays: true,
showLocation: false,
language: 'zh-CN'
}
};
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L679-L710
|
2ef1d481f5aa9792da4d7502febc3a13e15ec29c
|
github
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Image/entry/src/main/ets/pages/example/ImageExample018.ets
|
arkts
|
aboutToAppear
|
默认亮度为0
|
aboutToAppear(): void {
// 获取资源管理器中的媒体资源
let img = this.getUIContext().getHostContext()?.resourceManager.getMediaByNameSync(this.imgUrl);
// 创建图片源并获取图片信息
let imageSource = image.createImageSource(img?.buffer.slice(0));
let imageInfo = imageSource.getImageInfoSync();
// 检查图片信息是否获取成功
if (imageInfo == undefined) {
console.error(TAG, 'Failed to obtain the image information.');
} else {
// 成功获取到图片信息,打印HDR状态
console.info(TAG, 'imageInfo.isHdr:' + imageInfo.isHdr);
}
imageSource?.release()
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 获取资源管理器中的媒体资源 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left img = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getHostContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. resourceManager AST#member_expression#Right AST#expression#Right . getMediaByNameSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 创建图片源并获取图片信息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageSource = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left img AST#expression#Right ?. buffer AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageSource AST#expression#Right . getImageInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 检查图片信息是否获取成功 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left imageInfo AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'Failed to obtain the image information.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 成功获取到图片信息,打印HDR状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'imageInfo.isHdr:' AST#expression#Right + AST#expression#Left imageInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right . isHdr AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imageSource AST#expression#Right ?. release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
aboutToAppear(): void {
let img = this.getUIContext().getHostContext()?.resourceManager.getMediaByNameSync(this.imgUrl);
let imageSource = image.createImageSource(img?.buffer.slice(0));
let imageInfo = imageSource.getImageInfoSync();
if (imageInfo == undefined) {
console.error(TAG, 'Failed to obtain the image information.');
} else {
console.info(TAG, 'imageInfo.isHdr:' + imageInfo.isHdr);
}
imageSource?.release()
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Image/entry/src/main/ets/pages/example/ImageExample018.ets#L28-L42
|
418630abffbc5a8377119197d7592a4bf8a98a4b
|
gitee
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
src/main/ets/ffmpeg/FFmpegManager.ets
|
arkts
|
getInstance
|
获取单例实例
|
public static getInstance(): FFmpegManager {
if (FFmpegManager.instance === null) {
FFmpegManager.instance = new FFmpegManager();
}
return FFmpegManager.instance;
}
|
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FFmpegManager AST#expression#Right . instance AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left FFmpegManager AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left FFmpegManager AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FFmpegManager AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static getInstance(): FFmpegManager {
if (FFmpegManager.instance === null) {
FFmpegManager.instance = new FFmpegManager();
}
return FFmpegManager.instance;
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L51-L56
|
12ad3af4c916e603ca782fd0028a77d34484b028
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto/src/main/ets/crypto/encryption/SM4.ets
|
arkts
|
generateSM4Key
|
生成SM4的对称密钥
@returns SM4密钥
|
static async generateSM4Key(): Promise<string> {
return CryptoUtil.generateSymKey('SM4_128');
}
|
AST#method_declaration#Left static async generateSM4Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . generateSymKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'SM4_128' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async generateSM4Key(): Promise<string> {
return CryptoUtil.generateSymKey('SM4_128');
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L30-L32
|
250a91de8136ff11cd407fad262e70fca9234e28
|
gitee
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/pages/MainPage.ets
|
arkts
|
loadAllEpisodes
|
加载所有单集(倒序排列,分页)
|
async loadAllEpisodes() {
try {
const allEps = await this.dbService.getAllEpisodes();
// 按pubDate倒序排列(最新在前)
allEps.sort((a, b) => (b.pubDate || 0) - (a.pubDate || 0));
// 分页显示
const showCount = this.episodesPage * this.episodesPageSize;
this.allEpisodes = allEps.slice(0, showCount);
this.episodesHasMore = allEps.length > showCount;
// 应用搜索过滤
this.filterEpisodes();
console.info(`[MainPage] Loaded ${this.allEpisodes.length}/${allEps.length} episodes (page ${this.episodesPage})`);
} catch (error) {
console.error('[MainPage] Failed to load episodes:', error);
}
}
|
AST#method_declaration#Left async loadAllEpisodes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left allEps = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . getAllEpisodes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 按pubDate倒序排列(最新在前) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left allEps AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . pubDate AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . pubDate AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 分页显示 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left showCount = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episodesPage AST#member_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . episodesPageSize AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allEpisodes AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left allEps AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left showCount AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episodesHasMore AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left allEps AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left showCount AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用搜索过滤 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterEpisodes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainPage] Loaded AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allEpisodes AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left allEps AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right episodes (page AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episodesPage AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[MainPage] Failed to load episodes:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async loadAllEpisodes() {
try {
const allEps = await this.dbService.getAllEpisodes();
allEps.sort((a, b) => (b.pubDate || 0) - (a.pubDate || 0));
const showCount = this.episodesPage * this.episodesPageSize;
this.allEpisodes = allEps.slice(0, showCount);
this.episodesHasMore = allEps.length > showCount;
this.filterEpisodes();
console.info(`[MainPage] Loaded ${this.allEpisodes.length}/${allEps.length} episodes (page ${this.episodesPage})`);
} catch (error) {
console.error('[MainPage] Failed to load episodes:', error);
}
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L179-L196
|
12bc1e32e90a45231836830488988fe2424ad5d5
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/settings/SettingsService.ets
|
arkts
|
validateSettings
|
验证设置对象
@param settings 设置对象
|
private validateSettings(settings: AppSettings): void {
if (!settings.theme || !settings.notification || !settings.reminder) {
throw new Error('设置数据不完整');
}
// 验证主题设置
const validThemeModes = [ThemeMode.LIGHT, ThemeMode.DARK, ThemeMode.AUTO];
if (!validThemeModes.includes(settings.theme.mode)) {
throw new Error('无效的主题模式');
}
// 验证通知设置 - 由于NotificationMethod可能未定义,暂时跳过验证
// if (settings.notification.methods.some(method => !validNotificationMethods.includes(method))) {
// throw new Error('无效的通知方式');
// }
// 验证提醒设置 - 由于ReminderFrequency可能未定义,暂时跳过验证
// const validReminderFrequencies = [ReminderFrequency.DAILY, ReminderFrequency.WEEKLY];
// if (!validReminderFrequencies.includes(settings.reminder.frequency)) {
// throw new Error('无效的提醒频率');
// }
// 验证安全设置 - 由于SecurityLevel可能未定义,暂时跳过验证
// if (settings.security && !validSecurityLevels.includes(settings.security.level)) {
// throw new Error('无效的安全级别');
// }
}
|
AST#method_declaration#Left private validateSettings AST#parameter_list#Left ( AST#parameter#Left settings : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left settings AST#expression#Right AST#unary_expression#Right AST#expression#Right . theme AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left settings AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . notification AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left settings AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . reminder AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '设置数据不完整' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 验证主题设置 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left validThemeModes = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeMode AST#expression#Right . LIGHT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeMode AST#expression#Right . DARK AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeMode AST#expression#Right . AUTO AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left validThemeModes AST#expression#Right AST#unary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left settings AST#expression#Right . theme AST#member_expression#Right AST#expression#Right . mode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '无效的主题模式' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 验证通知设置 - 由于NotificationMethod可能未定义,暂时跳过验证 // if (settings.notification.methods.some(method => !validNotificationMethods.includes(method))) { // throw new Error('无效的通知方式'); // } // 验证提醒设置 - 由于ReminderFrequency可能未定义,暂时跳过验证 // const validReminderFrequencies = [ReminderFrequency.DAILY, ReminderFrequency.WEEKLY]; // if (!validReminderFrequencies.includes(settings.reminder.frequency)) { // throw new Error('无效的提醒频率'); // } // 验证安全设置 - 由于SecurityLevel可能未定义,暂时跳过验证 // if (settings.security && !validSecurityLevels.includes(settings.security.level)) { // throw new Error('无效的安全级别'); // } } AST#block_statement#Right AST#method_declaration#Right
|
private validateSettings(settings: AppSettings): void {
if (!settings.theme || !settings.notification || !settings.reminder) {
throw new Error('设置数据不完整');
}
const validThemeModes = [ThemeMode.LIGHT, ThemeMode.DARK, ThemeMode.AUTO];
if (!validThemeModes.includes(settings.theme.mode)) {
throw new Error('无效的主题模式');
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L904-L930
|
94c99574afb53571d6ce2624d44a68248a80e221
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
|
arkts
|
initiatingUserAuthentication2
|
[EndExclude authentication_example2] [End authentication_example1]
start-authentication.md
示例2:
发起用户认证,采用认证可信等级≥ATL3的人脸 + 锁屏密码 + 指纹认证 + 认证类型相关 + 复用设备解锁最大有效时长认证,获取认证结果
|
initiatingUserAuthentication2() {
// 设置认证参数
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.AUTH_TYPE_RELEVANT,
reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION,
};
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRandomSync(len)?.data;
const authParam: userAuth.AuthParam = {
challenge: randData,
authType: [userAuth.UserAuthType.PIN, userAuth.UserAuthType.FACE, userAuth.UserAuthType.FINGERPRINT],
authTrustLevel: userAuth.AuthTrustLevel.ATL3,
reuseUnlockResult: reuseUnlockResult,
};
// 配置认证界面
const widgetParam: userAuth.WidgetParam = {
title: resourceToString($r('app.string.title')),
};
// 获取认证对象
const userAuthInstance = userAuth.getUserAuthInstance(authParam, widgetParam);
Logger.info('get userAuth instance success');
// 订阅认证结果
this.handleAuthResult(userAuthInstance, ResultIndex.EXAMPLE_2);
} catch (error) {
const err: BusinessError = error as BusinessError;
Logger.error(`auth catch error. Code is ${err?.code}, message is ${err?.message}`);
}
}
|
AST#method_declaration#Left initiatingUserAuthentication2 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置认证参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left reuseUnlockResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . ReuseUnlockResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left reuseMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . ReuseMode AST#member_expression#Right AST#expression#Right . AUTH_TYPE_RELEVANT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reuseDuration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . MAX_ALLOWABLE_REUSE_DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rand = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createRandom AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left randData : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rand AST#expression#Right ?. generateRandomSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. data AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left authParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . AuthParam AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left challenge AST#property_name#Right : AST#expression#Left randData AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left authType AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . UserAuthType AST#member_expression#Right AST#expression#Right . PIN AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . UserAuthType AST#member_expression#Right AST#expression#Right . FACE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . UserAuthType AST#member_expression#Right AST#expression#Right . FINGERPRINT AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left authTrustLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . AuthTrustLevel AST#member_expression#Right AST#expression#Right . ATL3 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reuseUnlockResult AST#property_name#Right : AST#expression#Left reuseUnlockResult AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 配置认证界面 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left widgetParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . WidgetParam AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left resourceToString AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取认证对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left userAuthInstance = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left userAuth AST#expression#Right . getUserAuthInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left authParam AST#expression#Right , AST#expression#Left widgetParam AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'get userAuth instance success' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 订阅认证结果 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleAuthResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left userAuthInstance AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ResultIndex AST#expression#Right . EXAMPLE_2 AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` auth catch error. Code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right ?. code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right ?. message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
initiatingUserAuthentication2() {
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.AUTH_TYPE_RELEVANT,
reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION,
};
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
const randData: Uint8Array = rand?.generateRandomSync(len)?.data;
const authParam: userAuth.AuthParam = {
challenge: randData,
authType: [userAuth.UserAuthType.PIN, userAuth.UserAuthType.FACE, userAuth.UserAuthType.FINGERPRINT],
authTrustLevel: userAuth.AuthTrustLevel.ATL3,
reuseUnlockResult: reuseUnlockResult,
};
const widgetParam: userAuth.WidgetParam = {
title: resourceToString($r('app.string.title')),
};
const userAuthInstance = userAuth.getUserAuthInstance(authParam, widgetParam);
Logger.info('get userAuth instance success');
this.handleAuthResult(userAuthInstance, ResultIndex.EXAMPLE_2);
} catch (error) {
const err: BusinessError = error as BusinessError;
Logger.error(`auth catch error. Code is ${err?.code}, message is ${err?.message}`);
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L213-L242
|
6fd83b523a6b6127e251beb6d37e61e50dabb359
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
|
arkts
|
onDestroy
|
弹框关闭时清除缓存数据
|
onDestroy(dialogId?: string) {
if (dialogId && dialogId.length > 0) {
const key = `${CacheHelper.CACHE_LABEL}${dialogId}`;
if (CacheHelper.has(key)) {
CacheHelper.remove(key); //清除缓存
}
}
}
|
AST#method_declaration#Left onDestroy AST#parameter_list#Left ( AST#parameter#Left dialogId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left dialogId AST#expression#Right && AST#expression#Left dialogId AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . CACHE_LABEL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left dialogId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheHelper AST#expression#Right . remove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //清除缓存 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
onDestroy(dialogId?: string) {
if (dialogId && dialogId.length > 0) {
const key = `${CacheHelper.CACHE_LABEL}${dialogId}`;
if (CacheHelper.has(key)) {
CacheHelper.remove(key);
}
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L323-L330
|
1c12d9983c6cb88368d0b126ba3d3ae40f4ac2f8
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/StrUtil.ets
|
arkts
|
replaceAll
|
替换字符串中所有匹配的正则为给定的字符串
@param str 待替换的字符串
@param pattern 要匹配的内容正则或字符串
@param replaceValue 替换的内容
@returns 返回替换后的字符串
|
static replaceAll(str: string, pattern: RegExp | string, replaceValue: string = ''): string {
return str.replaceAll(pattern, replaceValue);
}
|
AST#method_declaration#Left static replaceAll AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RegExp AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left replaceValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pattern AST#expression#Right , AST#expression#Left replaceValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static replaceAll(str: string, pattern: RegExp | string, replaceValue: string = ''): string {
return str.replaceAll(pattern, replaceValue);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L142-L144
|
9852dbcf4f9c97d5496b7c8cbe88d7b2675bbb26
|
gitee
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets
|
arkts
|
Declare CallbackParam
@typedef CallbackParam
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare CallbackParam
@typedef CallbackParam
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
export interface CallbackParam {
/**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
currentNodeId: number;
/**
* Get the parentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Get the parentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
parentNodeId?: number;
/**
* Get the childIndex.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Get the childIndex.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
childIndex?: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface CallbackParam AST#object_type#Left { /**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#type_member#Left currentNodeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Get the parentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Get the parentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#type_member#Left parentNodeId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Get the childIndex.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Get the childIndex.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#type_member#Left childIndex ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface CallbackParam {
currentNodeId: number;
parentNodeId?: number;
childIndex?: number;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets#L249-L292
|
bf0df73745bae0737786c9a81f406245c6985fda
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videoplaycomponents/VideoPlayController.ets
|
arkts
|
视频播放控制器。用于控制视频的播放暂停及播放进度。
|
export class VideoPlayController {
// 播放接口
public play = () => {
};
// 暂停接口
public pause = () => {
};
// 播放进度接口
public seek = (currentTime: number) => {
};
}
|
AST#export_declaration#Left export AST#class_declaration#Left class VideoPlayController AST#class_body#Left { // 播放接口 AST#property_declaration#Left public play = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 暂停接口 AST#property_declaration#Left public pause = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 播放进度接口 AST#property_declaration#Left public seek = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left currentTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class VideoPlayController {
public play = () => {
};
public pause = () => {
};
public seek = (currentTime: number) => {
};
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videoplaycomponents/VideoPlayController.ets#L19-L29
|
781cf94175884b3ff5940887b763a3f920b51801
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/A_ns.ets
|
arkts
|
ns
|
[End export_variable_a_ns]
|
export { ns };
|
AST#export_declaration#Left export { ns } ; AST#export_declaration#Right
|
export { ns };
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/A_ns.ets#L22-L22
|
8a8d1f27e17fb5f78a5de0362baef868374351ab
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DisplayUtil.ets
|
arkts
|
onCaptureStatusChange
|
开启屏幕截屏、投屏、录屏状态变化的监听。
@param callback 回调函数。表示设备截屏、投屏或录屏时状态发生变化。true表示设备开始投屏或者录屏,false表示结束投屏或者录屏;截屏仅返回一次true。
|
static onCaptureStatusChange(callback: Callback<boolean>) {
display.on('captureStatusChange', callback);
}
|
AST#method_declaration#Left static onCaptureStatusChange AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'captureStatusChange' AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static onCaptureStatusChange(callback: Callback<boolean>) {
display.on('captureStatusChange', callback);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L215-L217
|
f8e2b84b2dda8ca18b401f42761d22ba88df69b6
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/auth/src/main/ets/view/LoginPage.ets
|
arkts
|
buildUserAgreementSection
|
构建用户协议区域
@returns {void} 无返回值
|
@Builder
private buildUserAgreementSection(): void {
UserAgreement({
centerAlignment: true,
onUserAgreementClick: (): void => {
CommonNavigator.toUserAgreement();
},
onPrivacyPolicyClick: (): void => {
CommonNavigator.toPrivacyPolicy();
}
});
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildUserAgreementSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left UserAgreement ( AST#component_parameters#Left { AST#component_parameter#Left centerAlignment : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onUserAgreementClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonNavigator AST#expression#Right . toUserAgreement AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onPrivacyPolicyClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonNavigator AST#expression#Right . toPrivacyPolicy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
private buildUserAgreementSection(): void {
UserAgreement({
centerAlignment: true,
onUserAgreementClick: (): void => {
CommonNavigator.toUserAgreement();
},
onPrivacyPolicyClick: (): void => {
CommonNavigator.toPrivacyPolicy();
}
});
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L181-L192
|
bf82926a6bebe3a6d2e37e5e0ccaffa462c77e36
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/analytics/AnalyticsService.ets
|
arkts
|
关系分布数据接口
|
export interface RelationDistribution {
relation: string;
count: number;
percentage: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface RelationDistribution AST#object_type#Left { AST#type_member#Left relation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left percentage : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface RelationDistribution {
relation: string;
count: number;
percentage: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L29-L33
|
722a9db7cdb8ba67008ec0fc82865d09862f393c
|
github
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
advanced_ui_component/dialogv2/source/dialogv2.ets
|
arkts
|
getDividerColor
|
get divider color
@returns divider color
|
private getDividerColor(): ResourceColor {
if (!this.buttons || this.buttons.length === 0 || !DIALOG_DIVIDER_SHOW) {
return Color.Transparent;
}
if (this.buttons[0].buttonStyle === ButtonStyleMode.TEXTUAL || this.buttons[0].buttonStyle === undefined) {
if (this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === ButtonStyleMode.TEXTUAL ||
this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === undefined) {
return $r('sys.color.alert_divider_color');
}
}
return Color.Transparent;
}
|
AST#method_declaration#Left private getDividerColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left DIALOG_DIVIDER_SHOW AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . buttonStyle AST#member_expression#Right AST#expression#Right === AST#expression#Left ButtonStyleMode AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXTUAL AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . buttonStyle AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left HORIZON_BUTTON_MAX_COUNT AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . buttonStyle AST#member_expression#Right AST#expression#Right === AST#expression#Left ButtonStyleMode AST#expression#Right AST#binary_expression#Right AST#expression#Right . TEXTUAL AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . buttons AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left HORIZON_BUTTON_MAX_COUNT AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . buttonStyle AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.alert_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getDividerColor(): ResourceColor {
if (!this.buttons || this.buttons.length === 0 || !DIALOG_DIVIDER_SHOW) {
return Color.Transparent;
}
if (this.buttons[0].buttonStyle === ButtonStyleMode.TEXTUAL || this.buttons[0].buttonStyle === undefined) {
if (this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === ButtonStyleMode.TEXTUAL ||
this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === undefined) {
return $r('sys.color.alert_divider_color');
}
}
return Color.Transparent;
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1465-L1477
|
5dc95e151e61b21dc5e8d06e3988fda9c2cd6acd
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/NotificationCenterService.ets
|
arkts
|
updateConfig
|
更新配置
|
public updateConfig(newConfig: Partial<NotificationCenterConfig>): void {
if (newConfig.maxNotifications !== undefined) this.config.maxNotifications = newConfig.maxNotifications;
if (newConfig.autoDeleteAfterDays !== undefined) this.config.autoDeleteAfterDays = newConfig.autoDeleteAfterDays;
if (newConfig.groupByType !== undefined) this.config.groupByType = newConfig.groupByType;
if (newConfig.showTimestamp !== undefined) this.config.showTimestamp = newConfig.showTimestamp;
if (newConfig.enableSound !== undefined) this.config.enableSound = newConfig.enableSound;
if (newConfig.enableVibration !== undefined) this.config.enableVibration = newConfig.enableVibration;
if (newConfig.enableAutoMarkAsRead !== undefined) this.config.enableAutoMarkAsRead = newConfig.enableAutoMarkAsRead;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'[NotificationCenterService] Config updated');
}
|
AST#method_declaration#Left public updateConfig AST#parameter_list#Left ( AST#parameter#Left newConfig : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NotificationCenterConfig AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . maxNotifications AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . maxNotifications AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . maxNotifications AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . autoDeleteAfterDays AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . autoDeleteAfterDays AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . autoDeleteAfterDays AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . groupByType AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . groupByType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . groupByType AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . showTimestamp AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . showTimestamp AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . showTimestamp AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . enableSound AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . enableSound AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . enableSound AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . enableVibration AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . enableVibration AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . enableVibration AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . enableAutoMarkAsRead AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right . enableAutoMarkAsRead AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left newConfig AST#expression#Right . enableAutoMarkAsRead AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left '[NotificationCenterService] Config updated' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public updateConfig(newConfig: Partial<NotificationCenterConfig>): void {
if (newConfig.maxNotifications !== undefined) this.config.maxNotifications = newConfig.maxNotifications;
if (newConfig.autoDeleteAfterDays !== undefined) this.config.autoDeleteAfterDays = newConfig.autoDeleteAfterDays;
if (newConfig.groupByType !== undefined) this.config.groupByType = newConfig.groupByType;
if (newConfig.showTimestamp !== undefined) this.config.showTimestamp = newConfig.showTimestamp;
if (newConfig.enableSound !== undefined) this.config.enableSound = newConfig.enableSound;
if (newConfig.enableVibration !== undefined) this.config.enableVibration = newConfig.enableVibration;
if (newConfig.enableAutoMarkAsRead !== undefined) this.config.enableAutoMarkAsRead = newConfig.enableAutoMarkAsRead;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
'[NotificationCenterService] Config updated');
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L328-L339
|
1d1f7975e4280470e9d0e904f07fd48e8e3e3008
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets
|
arkts
|
setStateChangeCallback
|
状态机上报回调函数
|
async setStateChangeCallback(): Promise<void> {
this.avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
logger.info('stateChange callback function is triggered,state is:' + state + ',reason is :' + reason);
switch (state) {
// 闲置状态
case 'idle':
// 调用release接口销毁实例对象
this.release();
logger.info('state idle called');
break;
// 资源初始化,avplayer设置播放源后触发该状态上报
case 'initialized':
logger.info('state initialized called');
this.isLoadingVideo = false; // 视频未加载完成
this.isLoading = true; // 加载动画继续加载
this.setSurfaceID(); // 设置显示画面,当播放的资源为纯音频时无需设置
this.avPlayer.prepare(); // 进入准备状态
break;
// 已准备状态
case 'prepared':
logger.info('state prepared called');
|
AST#method_declaration#Left async setStateChangeCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' AST#expression#Right , AST#ERROR#Left async AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reason : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . StateChangeReason AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'stateChange callback function is triggered,state is:' AST#expression#Right + AST#expression#Left state AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ',reason is :' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left reason AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left state AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { // 闲置状态 AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 'idle' AST#property_name#Right : // 调用release接口销毁实例对象 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . release AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'state idle called' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right // 资源初始化,avplayer设置播放源后触发该状态上报 AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'initialized' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#qualified_type#Left logger . info AST#qualified_type#Right ( AST#ERROR#Right AST#expression#Left 'state initialized called' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoadingVideo AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 视频未加载完成 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 加载动画继续加载 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setSurfaceID AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 设置显示画面,当播放的资源为纯音频时无需设置 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . prepare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 进入准备状态 AST#expression_statement#Left AST#expression#Left break AST#expression#Right ; AST#expression_statement#Right // 已准备状态 AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 'prepared' AST#expression#Right AST#expression_statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left logger . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( 'state prepared called' ) AST#ERROR#Right ; AST#method_declaration#Right
|
async setStateChangeCallback(): Promise<void> {
this.avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
logger.info('stateChange callback function is triggered,state is:' + state + ',reason is :' + reason);
switch (state) {
case 'idle':
this.release();
logger.info('state idle called');
break;
case 'initialized':
logger.info('state initialized called');
this.isLoadingVideo = false;
this.isLoading = true;
this.setSurfaceID();
this.avPlayer.prepare();
break;
case 'prepared':
logger.info('state prepared called');
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L213-L233
|
7b2f9d004548c801b6cfa7bfe645d368f61ab6b0
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.ToolBarV2.d.ets
|
arkts
|
padding
|
Sets the left and right padding of the toolbarV2.
@param { LengthMetrics } padding - left and right padding.
@returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18
|
padding(padding: LengthMetrics): ToolBarV2Modifier;
|
AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left padding : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarV2Modifier AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
padding(padding: LengthMetrics): ToolBarV2Modifier;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L579-L579
|
3efc1f7ab272039675f69fbf171cca1f8046b0cb
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets
|
arkts
|
deleteSelected
|
Delete the selected item and exit the editing mode.
|
deleteSelected() {
DataModel.deleteData(this.selectArray);
this.targetData = DataModel.getData();
this.overAllProgressChanged = !this.overAllProgressChanged;
this.isEditMode = false;
}
|
AST#method_declaration#Left deleteSelected AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DataModel AST#expression#Right . deleteData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectArray AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetData AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DataModel AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . overAllProgressChanged AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . overAllProgressChanged AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEditMode AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
deleteSelected() {
DataModel.deleteData(this.selectArray);
this.targetData = DataModel.getData();
this.overAllProgressChanged = !this.overAllProgressChanged;
this.isEditMode = false;
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets#L127-L132
|
b4f39a522fdf85ac4b07fff6459bbff074103d15
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/login/LoginView.ets
|
arkts
|
checkAggree
|
检查是否同意协议
|
private checkAggree(): boolean {
if (!this.isAgree) {
this.shakeCheckAgree()
Toast.showMessage($r('app.string.login_agree_tip'))
return false;
}
return true;
}
|
AST#method_declaration#Left private checkAggree AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isAgree AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shakeCheckAgree AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Toast AST#expression#Right . showMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.login_agree_tip' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private checkAggree(): boolean {
if (!this.isAgree) {
this.shakeCheckAgree()
Toast.showMessage($r('app.string.login_agree_tip'))
return false;
}
return true;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LoginView.ets#L324-L331
|
6934e052832f9e8f6929f878ebf1f6db38b5b644
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
|
arkts
|
transitionFromDown
|
底部弹出动画
@param duration 动画时间
@returns
|
static transitionFromDown(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ delay: duration, duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration }))
)
}
|
AST#method_declaration#Left static transitionFromDown AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TransitionEffect AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . asymmetric AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . combine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . combine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left duration AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static transitionFromDown(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ delay: duration, duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration }))
)
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets#L36-L43
|
41f5424815235ead950b04efb74624f872c65799
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/an0n-chat-lib/0.1.5/package/build/postinstall.ets
|
arkts
|
exit
|
模拟process.exit()
|
function exit(code: number): void {
// 使用ArkTS应用管理API终止应用
}
|
AST#function_declaration#Left function exit AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 使用ArkTS应用管理API终止应用 } AST#block_statement#Right AST#function_declaration#Right
|
function exit(code: number): void {
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/postinstall.ets#L23-L25
|
edcb66a98a4a5ab8c9e56e457ee8bc72ab8053d9
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets
|
arkts
|
setPositionXY
|
设置坐标
@param { RaisedCircleSetPostionXYType } obj
|
setPositionXY(position: RaisedCircleSetPostionXYType): void {
if (position.x || position.x === 0) {
this.oldPositionX = this.positionX;
this.positionX = position.x;
}
if (position.y || position.y === 0) {
this.oldPositionY = this.positionY
this.positionY = position.y;
}
}
|
AST#method_declaration#Left setPositionXY AST#parameter_list#Left ( AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left RaisedCircleSetPostionXYType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left position AST#expression#Right . x AST#member_expression#Right AST#expression#Right || AST#expression#Left position AST#expression#Right AST#binary_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldPositionX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . positionX AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . positionX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left position AST#expression#Right . x AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left position AST#expression#Right . y AST#member_expression#Right AST#expression#Right || AST#expression#Left position AST#expression#Right AST#binary_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . oldPositionY AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . positionY AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . positionY AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left position AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
setPositionXY(position: RaisedCircleSetPostionXYType): void {
if (position.x || position.x === 0) {
this.oldPositionX = this.positionX;
this.positionX = position.x;
}
if (position.y || position.y === 0) {
this.oldPositionY = this.positionY
this.positionY = position.y;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L139-L148
|
92c23f7f643976217a3e3697834301ca1b1b16f6
|
gitee
|
openharmony/multimedia_camera_framework
|
9873dd191f59efda885bc06897acf9b0660de8f2
|
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
|
arkts
|
onSessionErrorChange
|
监听捕获会话错误变化
@param session - 相机捕获会话对象
@returns 无返回值
|
onSessionErrorChange(session: camera.PhotoSession | camera.VideoSession): void {
try {
session.on('error', (captureSessionError: BusinessError): void => {
Logger.info(TAG,
'onCaptureSessionErrorChange captureSession fail: ' + JSON.stringify(captureSessionError.code));
});
} catch (error) {
Logger.error(TAG, 'onCaptureSessionErrorChange error');
}
}
|
AST#method_declaration#Left onSessionErrorChange AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . PhotoSession AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left camera . VideoSession AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left session AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left captureSessionError : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'onCaptureSessionErrorChange captureSession fail: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left captureSessionError AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'onCaptureSessionErrorChange error' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
onSessionErrorChange(session: camera.PhotoSession | camera.VideoSession): void {
try {
session.on('error', (captureSessionError: BusinessError): void => {
Logger.info(TAG,
'onCaptureSessionErrorChange captureSession fail: ' + JSON.stringify(captureSessionError.code));
});
} catch (error) {
Logger.error(TAG, 'onCaptureSessionErrorChange error');
}
}
|
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L690-L699
|
f1614717e56ed6dc52b36689be34ded45a0659b1
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/rssSourcesUtils.ets
|
arkts
|
getRssSourcesGroup
|
获取订阅分组
|
async getRssSourcesGroup(){
let rssSourcesGroup = await rssSourceGroupDao.search();
//根据排序顺序存储到string[]
let rssSourcesGroupName:string[] = [];
for(let i=0;i<rssSourcesGroup.length;i++){
rssSourcesGroupName.push(rssSourcesGroup[i].rssGroupName)
}
return rssSourcesGroupName
}
|
AST#method_declaration#Left async getRssSourcesGroup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rssSourcesGroup = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left rssSourceGroupDao AST#expression#Right AST#await_expression#Right AST#expression#Right . search AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //根据排序顺序存储到string[] AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rssSourcesGroupName : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left rssSourcesGroup AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rssSourcesGroupName AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left rssSourcesGroup AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . rssGroupName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left rssSourcesGroupName AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getRssSourcesGroup(){
let rssSourcesGroup = await rssSourceGroupDao.search();
let rssSourcesGroupName:string[] = [];
for(let i=0;i<rssSourcesGroup.length;i++){
rssSourcesGroupName.push(rssSourcesGroup[i].rssGroupName)
}
return rssSourcesGroupName
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/rssSourcesUtils.ets#L43-L51
|
0f70d6756c96328b34c9ed8faebc652371f1f73d
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
|
arkts
|
isDbOpenable
|
========================================================== 判断数据库能否打开(取第一条记录检查) ==========================================================
|
async isDbOpenable(): Promise<boolean> {
return (await this.getBaseWordById(1)) !== null;
}
|
AST#method_declaration#Left async isDbOpenable AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getBaseWordById AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async isDbOpenable(): Promise<boolean> {
return (await this.getBaseWordById(1)) !== null;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L71-L73
|
8b1ae24ef6fd3797919c7a4cfe377aa63168f4e7
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/shortcut/ShortcutManager.ets
|
arkts
|
disableShortcut
|
禁用快捷方式
|
async disableShortcut(shortcutId: string): Promise<void> {
try {
await shortcutManager.disableShortcut(shortcutId);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Shortcut disabled: ${shortcutId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to disable shortcut: ${error}`);
}
}
|
AST#method_declaration#Left async disableShortcut AST#parameter_list#Left ( AST#parameter#Left shortcutId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left shortcutManager AST#expression#Right AST#await_expression#Right AST#expression#Right . disableShortcut AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shortcutId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Shortcut disabled: AST#template_substitution#Left $ { AST#expression#Left shortcutId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to disable shortcut: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async disableShortcut(shortcutId: string): Promise<void> {
try {
await shortcutManager.disableShortcut(shortcutId);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Shortcut disabled: ${shortcutId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to disable shortcut: ${error}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L308-L315
|
9392d272632abc5c3f5ad9f163437f38eca18e6f
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
|
arkts
|
getWordsByIds
|
MARK: - Words from wordIds /获取指定[wordIds]的Words
|
getWordsByIds(wordIds: number[]): WordUser[] {
//过滤掉deleted状态的words
//使用SearchManager.shared.getAliveWords()获取所有活跃单词
const aliveWords = SearchManager.shared.getAliveWords();
//使用Set来提高查找效率
const wordIdSet = new Set(wordIds);
//过滤出包含在wordIds中的单词
return aliveWords.filter(word => wordIdSet.has(word.idx ?? 0));
}
|
AST#method_declaration#Left getWordsByIds AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //过滤掉deleted状态的words //使用SearchManager.shared.getAliveWords()获取所有活跃单词 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left aliveWords = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SearchManager AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . getAliveWords AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //使用Set来提高查找效率 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wordIdSet = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wordIds AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //过滤出包含在wordIds中的单词 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left aliveWords AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left word => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wordIdSet AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . idx AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getWordsByIds(wordIds: number[]): WordUser[] {
const aliveWords = SearchManager.shared.getAliveWords();
const wordIdSet = new Set(wordIds);
return aliveWords.filter(word => wordIdSet.has(word.idx ?? 0));
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L381-L391
|
d524158e60bef0ed0a64040aa8b5d5270e1a0ca7
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
route for secondPage
|
export const SECOND_PAGE: string = 'pages/Second';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SECOND_PAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/Second' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const SECOND_PAGE: string = 'pages/Second';
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L19
|
cc0cfff41071322f8f64ae388f813ac6b60cf024
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets
|
arkts
|
themeItemBuilder
|
构建个性主题下列表元素
|
@Builder
themeItemBuilder(item: ThemeItem, index: number) {
Column({space: 8}) {
Column() {
if (this.activeIndex == index) {
Text('使用中')
.fontSize(9)
.fontColor('#fff')
.backgroundColor('#ef4444')
.textAlign(TextAlign.Center)
.lineHeight(14)
.width(39)
.height(14)
.borderRadius({
topRight: 8,
bottomLeft: 8
})
.position({right: 0, top: 0})
}
}
.width(154)
.height(77)
.borderRadius(8)
.backgroundColor(item.mainColor)
Text(item.text)
.fontSize(14)
.height(22)
.lineHeight(22)
.width('100%')
}
.width(154)
.height(107)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right themeItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ThemeItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeIndex AST#member_expression#Right AST#expression#Right == AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '使用中' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 9 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#fff' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ef4444' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 39 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 154 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 77 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . mainColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . text AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 154 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 107 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
themeItemBuilder(item: ThemeItem, index: number) {
Column({space: 8}) {
Column() {
if (this.activeIndex == index) {
Text('使用中')
.fontSize(9)
.fontColor('#fff')
.backgroundColor('#ef4444')
.textAlign(TextAlign.Center)
.lineHeight(14)
.width(39)
.height(14)
.borderRadius({
topRight: 8,
bottomLeft: 8
})
.position({right: 0, top: 0})
}
}
.width(154)
.height(77)
.borderRadius(8)
.backgroundColor(item.mainColor)
Text(item.text)
.fontSize(14)
.height(22)
.lineHeight(22)
.width('100%')
}
.width(154)
.height(107)
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets#L73-L106
|
0b8dfdf76e63260b69005284a56ec5caf63729ba
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets
|
arkts
|
Numbers.ets
|
export const one : number = 1;
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left one : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const one : number = 1;
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets#L57-L57
|
8201300d28002c456a67dcfa2b86f9155d8cd6df
|
gitee
|
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/viewmodel/TaskViewModel.ets
|
arkts
|
getPendingTasks
|
获取未完成任务
|
getPendingTasks(): TaskItem[] {
return this.tasks.filter(task => !task.completed);
}
|
AST#method_declaration#Left getPendingTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left task => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left task AST#expression#Right AST#unary_expression#Right AST#expression#Right . completed AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getPendingTasks(): TaskItem[] {
return this.tasks.filter(task => !task.completed);
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L463-L465
|
b2ed75acc984f9dca7d52e39c8234f2a51e0a867
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Media/AVPlayer/AVPlayerArkTSURL/entry/src/main/ets/pages/Index.ets
|
arkts
|
setAVPlayerCallback
|
注册avplayer回调函数
|
async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void, vType?: number): Promise<void> {
// seek操作结果回调函数
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init!`);
return;
}
this.avPlayer.on('seekDone', (seekDoneTime) => {
console.info(`${this.tag}: setAVPlayerCallback AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
});
this.avPlayer.on('speedDone', (speed) => {
console.info(`${this.tag}: setAVPlayerCallback AVPlayer speedDone, speed is ${speed}`);
});
// error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程
this.avPlayer.on('error', (err) => {
console.error(`${this.tag}: setAVPlayerCallback Invoke avPlayer failed ${JSON.stringify(err)}`);
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init on error`);
return;
}
this.avPlayer.reset();
});
// 状态机变化回调函数
this.avPlayer.on('stateChange', async (state, reason) => {
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init on state change`);
return;
}
switch (state) {
case 'idle': // 成功调用reset接口后触发该状态机上报
console.info(`${this.tag}: setAVPlayerCallback AVPlayer state idle called.`);
break;
case 'initialized': // avplayer 设置播放源后触发该状态上报
console.info(`${this.tag}: setAVPlayerCallback AVPlayer state initialized called.`);
if (this.surfaceId) {
this.avPlayer.surfaceId = this.surfaceId; // 设置显示画面,当播放的资源为纯音频时无需设置
console.info(`${this.tag}: setAVPlayerCallback this.avPlayer.surfaceId = ${this.avPlayer.surfaceId}`);
this.avPlayer.prepare();
}
break;
case 'prepared': // prepare调用成功后上报该状态机
console.info(`${this.tag}
|
AST#method_declaration#Left async setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left vType ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right { // seek操作结果回调函数 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : avPlayer has not init! ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'seekDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left seekDoneTime AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : setAVPlayerCallback AVPlayer seek succeeded, seek time is AST#template_substitution#Left $ { AST#expression#Left seekDoneTime AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'speedDone' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left speed AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : setAVPlayerCallback AVPlayer speedDone, speed is AST#template_substitution#Left $ { AST#expression#Left speed AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : setAVPlayerCallback Invoke avPlayer failed AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : avPlayer has not init on error ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 状态机变化回调函数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'stateChange' AST#expression#Right , AST#ERROR#Left async AST#parameter_list#Left ( AST#parameter#Left state AST#parameter#Right , AST#parameter#Left reason AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right == AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : avPlayer has not init on state change ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left state AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 'idle' AST#property_name#Right : // 成功调用reset接口后触发该状态机上报 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : setAVPlayerCallback AVPlayer state idle called. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'initialized' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : // avplayer 设置播放源后触发该状态上报 AST#qualified_type#Left console . info AST#qualified_type#Right ( AST#ERROR#Right AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : setAVPlayerCallback AVPlayer state initialized called. ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . surfaceId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . surfaceId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . surfaceId AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置显示画面,当播放的资源为纯音频时无需设置 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : setAVPlayerCallback this.avPlayer.surfaceId = AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . surfaceId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avPlayer AST#member_expression#Right AST#expression#Right . prepare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'prepared' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : // prepare调用成功后上报该状态机 AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left console . info AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( ` $ AST#ERROR#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void, vType?: number): Promise<void> {
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init!`);
return;
}
this.avPlayer.on('seekDone', (seekDoneTime) => {
console.info(`${this.tag}: setAVPlayerCallback AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
});
this.avPlayer.on('speedDone', (speed) => {
console.info(`${this.tag}: setAVPlayerCallback AVPlayer speedDone, speed is ${speed}`);
});
this.avPlayer.on('error', (err) => {
console.error(`${this.tag}: setAVPlayerCallback Invoke avPlayer failed ${JSON.stringify(err)}`);
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init on error`);
return;
}
this.avPlayer.reset();
});
this.avPlayer.on('stateChange', async (state, reason) => {
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init on state change`);
return;
}
switch (state) {
case 'idle':
console.info(`${this.tag}: setAVPlayerCallback AVPlayer state idle called.`);
break;
case 'initialized':
console.info(`${this.tag}: setAVPlayerCallback AVPlayer state initialized called.`);
if (this.surfaceId) {
this.avPlayer.surfaceId = this.surfaceId;
console.info(`${this.tag}: setAVPlayerCallback this.avPlayer.surfaceId = ${this.avPlayer.surfaceId}`);
this.avPlayer.prepare();
}
break;
case 'prepared':
console.info(`${this.tag}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVPlayer/AVPlayerArkTSURL/entry/src/main/ets/pages/Index.ets#L267-L307
|
929cffa67cbc5c59a4364d74c8203dad43a3818a
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DisplayUtil.ets
|
arkts
|
getHeight
|
获取设备的屏幕高度,单位为px。
@returns
|
static getHeight(): number {
return DisplayUtil.getDefaultDisplaySync().height;
}
|
AST#method_declaration#Left static getHeight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DisplayUtil AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getHeight(): number {
return DisplayUtil.getDefaultDisplaySync().height;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L71-L73
|
52e415d0bdd2be038fa0677a4fb49e4ed7c9a4ff
|
gitee
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
|
arkts
|
Defines toolBar symbolGlyph options.
@interface ToolBarSymbolGlyphOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13
|
export interface ToolBarSymbolGlyphOptions {
/**
* Modifier of toolbar's normal symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
normal?: SymbolGlyphModifier;
/**
* Modifier of toolbar's activated symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
activated?: SymbolGlyphModifier;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolBarSymbolGlyphOptions AST#object_type#Left { /**
* Modifier of toolbar's normal symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#type_member#Left normal ? : AST#type_annotation#Left AST#primary_type#Left SymbolGlyphModifier AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Modifier of toolbar's activated symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#type_member#Left activated ? : AST#type_annotation#Left AST#primary_type#Left SymbolGlyphModifier AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface ToolBarSymbolGlyphOptions {
normal?: SymbolGlyphModifier;
activated?: SymbolGlyphModifier;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L80-L99
|
3a31ba8176418feb35ecf464afd0cab97f609230
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets
|
arkts
|
getVp
|
Obtains the screen horizontal adaptation vp.
|
static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
}
|
AST#method_declaration#Left static getVp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left beforeVp = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . adaptDimension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left beforeVp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets#L46-L49
|
1c26e02e8f9b4cb45571b2de4a9c54261e76193a
|
gitee
|
liuchao0739/arkTS_universal_starter.git
|
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
|
entry/src/main/ets/core/storage/StorageManager.ets
|
arkts
|
setContext
|
设置 Context(需要在应用启动时调用)
|
setContext(context: common.UIAbilityContext): void {
this.context = context;
this.init();
}
|
AST#method_declaration#Left setContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right = AST#expression#Left context AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
setContext(context: common.UIAbilityContext): void {
this.context = context;
this.init();
}
|
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L29-L32
|
85677b608d8243867dd2c40b8fc56e3bff048b86
|
github
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/builder/PlayerSettingBuilder.ets
|
arkts
|
CommonSettingView
|
常用设置底部弹窗视图
|
@Component
export struct CommonSettingView {
public config?:VHPlayerConfig;
scroller: Scroller = new Scroller();
getSecondSectionActionItems():ActionItem[]{
let actionItems:ActionItem[] =
[{ id: '1001', title: '弹幕', subTitle: $r('app.media.barrage') ,switchType:true,enable:this.config?.basic?.barrage_button == 1 ? true : false}]
return actionItems;
}
build() {
Column() {
RelativeContainer() {
Text('播放器设置')
.fontSize(16)
.fontColor(Color.Black)
.fontWeight(FontWeight.Bold)
.alignRules({
middle: { anchor: '__container__', align: HorizontalAlign.Center },
center: { anchor: '__container__', align: VerticalAlign.Center }
})
Image($r('app.media.close'))
.width(14)
.height(14)
.alignRules({
middle: { anchor: '__container__', align: HorizontalAlign.End },
center: { anchor: '__container__', align: VerticalAlign.Center }
})
.offset({
x: -20
})
.onClick(() => {
PromptActionClass.closeDialog();
})
.id('close_image')
}.width('100%')
.height(48)
Scroll(this.scroller){
Column(){
ActionSectionView({
actionItems: this.getSecondSectionActionItems()
})
}
// .padding({ bottom: 10})
.width('100%')
.backgroundColor(Color.White)
.borderRadius({
topLeft: 8,
topRight: 8
})
.height('80%')
}
.width('90%')
.scrollable(ScrollDirection.Vertical) // 滚动方向为垂直方向
// TODO:知识点:使用constraintSize方法可以设置约束尺寸,组件布局时,进行尺寸范围限制。这里设置Scroll组件的高度限制。
.constraintSize({maxHeight: 400})
.backgroundColor(Color.White)
.borderRadius({
topLeft: 8,
topRight: 8
})
}
.borderRadius({
topLeft: 8,
topRight: 8
})
.width('100%')
.backgroundColor(0xF5F5F5)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonSettingView AST#component_body#Left { AST#property_declaration#Left public config ? : AST#type_annotation#Left AST#primary_type#Left VHPlayerConfig AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left getSecondSectionActionItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ActionItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left actionItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ActionItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '1001' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left '弹幕' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.barrage' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left switchType AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enable AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . config AST#member_expression#Right AST#expression#Right ?. basic AST#member_expression#Right AST#expression#Right ?. barrage_button AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left actionItems AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '播放器设置' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left middle AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left center AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.close' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left middle AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left center AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 20 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PromptActionClass AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'close_image' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ActionSectionView ( AST#component_parameters#Left { AST#component_parameter#Left actionItems : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSecondSectionActionItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // .padding({ bottom: 10}) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) // 滚动方向为垂直方向 // TODO:知识点:使用constraintSize方法可以设置约束尺寸,组件布局时,进行尺寸范围限制。这里设置Scroll组件的高度限制。 AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left maxHeight AST#property_name#Right : AST#expression#Left 400 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left topLeft AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left topRight AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xF5F5F5 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CommonSettingView {
public config?:VHPlayerConfig;
scroller: Scroller = new Scroller();
getSecondSectionActionItems():ActionItem[]{
let actionItems:ActionItem[] =
[{ id: '1001', title: '弹幕', subTitle: $r('app.media.barrage') ,switchType:true,enable:this.config?.basic?.barrage_button == 1 ? true : false}]
return actionItems;
}
build() {
Column() {
RelativeContainer() {
Text('播放器设置')
.fontSize(16)
.fontColor(Color.Black)
.fontWeight(FontWeight.Bold)
.alignRules({
middle: { anchor: '__container__', align: HorizontalAlign.Center },
center: { anchor: '__container__', align: VerticalAlign.Center }
})
Image($r('app.media.close'))
.width(14)
.height(14)
.alignRules({
middle: { anchor: '__container__', align: HorizontalAlign.End },
center: { anchor: '__container__', align: VerticalAlign.Center }
})
.offset({
x: -20
})
.onClick(() => {
PromptActionClass.closeDialog();
})
.id('close_image')
}.width('100%')
.height(48)
Scroll(this.scroller){
Column(){
ActionSectionView({
actionItems: this.getSecondSectionActionItems()
})
}
.width('100%')
.backgroundColor(Color.White)
.borderRadius({
topLeft: 8,
topRight: 8
})
.height('80%')
}
.width('90%')
.scrollable(ScrollDirection.Vertical)
.constraintSize({maxHeight: 400})
.backgroundColor(Color.White)
.borderRadius({
topLeft: 8,
topRight: 8
})
}
.borderRadius({
topLeft: 8,
topRight: 8
})
.width('100%')
.backgroundColor(0xF5F5F5)
}
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L137-L210
|
b160f911c3970b0860fc964238f552bf0618751a
|
gitee
|
openharmony-tpc-incubate/photo-deal-demo
|
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
|
library/src/main/ets/components/PaletteComponent.ets
|
arkts
|
画板控制器
|
export interface PaletteController {
refreshScale: (scale: number) => void;
refreshColor: (color: string) => void;
refreshBrushSize: (size: number) => void;
undo: (data: PaletteData) => void;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface PaletteController AST#object_type#Left { AST#type_member#Left refreshScale : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left refreshColor : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left refreshBrushSize : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left undo : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left PaletteData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface PaletteController {
refreshScale: (scale: number) => void;
refreshColor: (color: string) => void;
refreshBrushSize: (size: number) => void;
undo: (data: PaletteData) => void;
}
|
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/PaletteComponent.ets#L25-L30
|
a01d273ec9985ee1b6cf0081d3f79b6a720bf08c
|
gitee
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets
|
arkts
|
/ 初始化时传入 PrefName
|
constructor(prefName: string) {
this.prefName = prefName;
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . prefName AST#member_expression#Right = AST#expression#Left prefName AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(prefName: string) {
this.prefName = prefName;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets#L14-L16
|
dca3ed862524aea1bea5c1f032c1173c8d5a32e6
|
github
|
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/function_call/function_var/function_var_001_T.ets
|
arkts
|
Introduction 变量函数
|
export function function_var_001_T(taint_src : string){
let f = taint.Sink;
f(taint_src);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function function_var_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left f = AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left f AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function function_var_001_T(taint_src : string){
let f = taint.Sink;
f(taint_src);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_var/function_var_001_T.ets#L6-L9
|
8020912cc0ad1abd22a0851da351b6064c2d71f0
|
github
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
|
arkts
|
load_string
|
Loads a string as a key combination, OVERWRITING whatever this combination was.
@param combination A string, containing the keys.
e.g. 'a ctrl shift'
|
load_string(combination: string) {
if (combination == '') {
return;
}
let keys_split = combination.split(' ');
this.load_string_array(keys_split);
}
|
AST#method_declaration#Left load_string AST#parameter_list#Left ( AST#parameter#Left combination : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left combination AST#expression#Right == AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keys_split = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left combination AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ' ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . load_string_array AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keys_split AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
load_string(combination: string) {
if (combination == '') {
return;
}
let keys_split = combination.split(' ');
this.load_string_array(keys_split);
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L228-L234
|
38ea14725a91c2eb4c9923613361f73fc7b9763c
|
gitee
|
kumaleap/ArkSwipeDeck.git
|
5afa77b9b2a2a531595d31f895c54a3371e4249a
|
library/src/main/ets/utils/GestureUtils.ets
|
arkts
|
applyResistance
|
应用阻力效果
@param delta - 原始位移
@param resistance - 阻力系数
@returns 应用阻力后的位移
|
static applyResistance(delta: number, resistance: number): number {
return delta * resistance;
}
|
AST#method_declaration#Left static applyResistance AST#parameter_list#Left ( AST#parameter#Left delta : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resistance : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left delta AST#expression#Right * AST#expression#Left resistance AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static applyResistance(delta: number, resistance: number): number {
return delta * resistance;
}
|
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L223-L225
|
8fb9e9090f6e3ace4091b7326ab0e558fda99c07
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/view/CustomKeyboardToH5.ets
|
arkts
|
CustomKeyboardToH5
|
Divider压缩比例
实现步骤:
1. 构建一个 Browser 对象,集成浏览器的方法。创建一个自定义组件 TabletTitle,构成浏览器的工具栏。
2. 自定义键盘传入js对象 WebKeyboardObj, 构建两个函数:点击登录按钮事件和输入法弹窗弹出事件。其中输入法弹出事件中使用CustomDialog修饰的组件,打开自定义弹窗。
3. 将webKeyboardObj对象通过webController.registerJavaScriptProxy注册到h5页面中,使页面中可以调用arkTS的方法。
4. 构建一个h5页面,在js层中调用注册进入的arkTS方法。
|
@Component
export struct CustomKeyboardToH5 {
@State browser: Browser = new Browser(); // 浏览器对象
build() {
Column() {
TabletTitle({ browser: $browser })
Progress({ value: this.browser.progress, total: PROGRESS_TOTAL })
.color($r('app.color.custom_keyboard_to_h5_progress_color'))
.visibility(this.browser.hideProgress ? Visibility.None : Visibility.Visible)
Divider()
.color($r('app.color.custom_keyboard_to_h5_divider_color'))
.width($r('app.string.custom_keyboard_to_h5_layout_100'))
.flexShrink(FLEX_SHRINK_NUMBER)
WebTab({ browser: $browser })
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomKeyboardToH5 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right browser : AST#type_annotation#Left AST#primary_type#Left Browser AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Browser AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 浏览器对象 AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabletTitle ( AST#component_parameters#Left { AST#component_parameter#Left browser : AST#expression#Left $browser AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . browser AST#member_expression#Right AST#expression#Right . progress AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left PROGRESS_TOTAL AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_keyboard_to_h5_progress_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . browser AST#member_expression#Right AST#expression#Right . hideProgress AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . None AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.custom_keyboard_to_h5_divider_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_keyboard_to_h5_layout_100' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . flexShrink ( AST#expression#Left FLEX_SHRINK_NUMBER AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left WebTab ( AST#component_parameters#Left { AST#component_parameter#Left browser : AST#expression#Left $browser AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CustomKeyboardToH5 {
@State browser: Browser = new Browser();
build() {
Column() {
TabletTitle({ browser: $browser })
Progress({ value: this.browser.progress, total: PROGRESS_TOTAL })
.color($r('app.color.custom_keyboard_to_h5_progress_color'))
.visibility(this.browser.hideProgress ? Visibility.None : Visibility.Visible)
Divider()
.color($r('app.color.custom_keyboard_to_h5_divider_color'))
.width($r('app.string.custom_keyboard_to_h5_layout_100'))
.flexShrink(FLEX_SHRINK_NUMBER)
WebTab({ browser: $browser })
}
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/view/CustomKeyboardToH5.ets#L30-L47
|
47aee4d07f0f7164bb99470ff21f057368f4cb36
|
gitee
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/pages/user/settings.ets
|
arkts
|
saveDefaultSite
|
保存默认站点设置
|
private async saveDefaultSite(isT: boolean) {
try {
await setDefaultSite(isT);
this.defaultSiteT = isT;
} catch (error) {
console.error("保存默认站点设置失败:", error);
}
}
|
AST#method_declaration#Left private async saveDefaultSite AST#parameter_list#Left ( AST#parameter#Left isT : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left setDefaultSite AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left isT AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . defaultSiteT AST#member_expression#Right = AST#expression#Left isT AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "保存默认站点设置失败:" AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async saveDefaultSite(isT: boolean) {
try {
await setDefaultSite(isT);
this.defaultSiteT = isT;
} catch (error) {
console.error("保存默认站点设置失败:", error);
}
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L138-L145
|
6f5101cba51e59f475575e2fca107615d7ecc3de
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_defaults.ets
|
arkts
|
Default animation params.
@returns An AnimateParam, reading the arguments from app settings.
|
export function animation_default() {
let animation_damping_coefficient = AppStorage.get('animation_damping_coefficient') as number;
let animation_response = AppStorage.get('animation_response') as number;
let spring = Curves.springMotion(animation_response / 100, (100 - animation_damping_coefficient) / 100);
let ap: AnimateParam = { curve: spring };
return ap;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function animation_default AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animation_damping_coefficient = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_damping_coefficient' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animation_response = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_response' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left spring = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Curves AST#expression#Right . springMotion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left animation_response AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 100 AST#expression#Right - AST#expression#Left animation_damping_coefficient AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ap : AST#type_annotation#Left AST#primary_type#Left AnimateParam AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left spring AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left ap AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function animation_default() {
let animation_damping_coefficient = AppStorage.get('animation_damping_coefficient') as number;
let animation_response = AppStorage.get('animation_response') as number;
let spring = Curves.springMotion(animation_response / 100, (100 - animation_damping_coefficient) / 100);
let ap: AnimateParam = { curve: spring };
return ap;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L65-L71
|
b4249288d6043a53ed5bb9241f466d843d7aae33
|
gitee
|
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/4equest/6.9.2/package/index.ets
|
arkts
|
应用约束60:使用ES模块导出语法代替CommonJS
|
export default escapeUtils;
|
AST#export_declaration#Left export default AST#expression#Left escapeUtils AST#expression#Right ; AST#export_declaration#Right
|
export default escapeUtils;
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/4equest/6.9.2/package/index.ets#L30-L30
|
7138ffe25768df20bd2aacc4526f13f4a943f949
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets
|
arkts
|
deleteData
|
在指定索引位置移除一个元素
|
public deleteData(index: number): void {
this.originDataArray.splice(index, 1);
this.notifyDataReload();
}
|
AST#method_declaration#Left public deleteData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataReload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public deleteData(index: number): void {
this.originDataArray.splice(index, 1);
this.notifyDataReload();
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets#L52-L55
|
aca4f392925a88883fa783ad098675b3813ec8ca
|
gitee
|
ashcha0/line-inspection-terminal-frontend_arkts.git
|
c82616097e8a3b257b7b01e75b6b83ce428b518c
|
entry/src/main/ets/utils/HttpUtil.ets
|
arkts
|
HTTP工具类
|
export class HttpUtil {
private static readonly BASE_URL = AppConstants.API_BASE_URL;
private static readonly TIMEOUT = AppConstants.REQUEST_TIMEOUT;
/**
* 发送HTTP请求
* @param url 请求URL
* @param config 请求配置
* @returns Promise<HttpResponse>
*/
static async request<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const httpRequest = http.createHttp();
try {
const fullUrl = url.startsWith('http') ? url : `${HttpUtil.BASE_URL}${url}`;
console.info(`[HttpUtil] 发起请求: ${fullUrl}`);
// 合并headers
const mergedHeaders: Record<string, string> = {
'Content-Type': 'application/json'
};
// 添加自定义headers
if (config.headers) {
const customHeaderKeys = Object.keys(config.headers);
for (let i = 0; i < customHeaderKeys.length; i++) {
const key = customHeaderKeys[i];
mergedHeaders[key] = config.headers[key];
}
}
const requestOptions: http.HttpRequestOptions = {
method: config.method || http.RequestMethod.GET,
header: mergedHeaders,
connectTimeout: config.timeout || HttpUtil.TIMEOUT,
readTimeout: config.timeout || HttpUtil.TIMEOUT,
extraData: config.data ? JSON.stringify(config.data) : undefined
};
console.info(`[HttpUtil] 请求配置:`, JSON.stringify(requestOptions));
const response = await httpRequest.request(fullUrl, requestOptions);
console.info(`[HttpUtil] 响应状态码: ${response.responseCode}`);
console.info(`[HttpUtil] 响应内容: ${response.result}`);
if (response.responseCode === 200) {
try {
const rawResult: Object = JSON.parse(response.result as string);
console.info(`[HttpUtil] 原始响应数据:`, JSON.stringify(rawResult));
// 检查是否是标准的HttpResponse格式
if (rawResult && typeof rawResult === 'object') {
const resultObj = rawResult as Record<string, Object>;
if (resultObj.code !== undefined && resultObj.msg !== undefined) {
// 标准格式,直接返回
const result = rawResult as HttpResponse<T>;
console.info(`[HttpUtil] 标准格式响应:`, JSON.stringify(result));
return result;
} else {
// 非标准格式,包装成HttpResponse
const wrappedResult: HttpResponse<T> = {
code: 200,
msg: 'success',
data: rawResult as T
};
console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult));
return wrappedResult;
}
} else {
// 非对象类型,包装成HttpResponse
const wrappedResult: HttpResponse<T> = {
code: 200,
msg: 'success',
data: rawResult as T
};
console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult));
return wrappedResult;
}
} catch (parseError) {
console.error(`[HttpUtil] JSON解析失败:`, parseError);
return {
code: -1,
msg: 'JSON解析失败',
data: undefined
};
}
} else {
console.warn(`[HttpUtil] HTTP错误: ${response.responseCode}`);
return {
code: response.responseCode,
msg: `HTTP ${response.responseCode}`,
data: undefined
};
}
} catch (error) {
console.error('[HttpUtil] HTTP请求失败:', error);
return {
code: -1,
msg: '网络请求失败',
data: undefined
};
} finally {
httpRequest.destroy();
}
}
/**
* GET请求
*/
static get<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const getConfig: RequestConfig = {
method: http.RequestMethod.GET,
headers: config.headers,
timeout: config.timeout,
data: config.data
};
return HttpUtil.request<T>(url, getConfig);
}
/**
* POST请求
*/
static post<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const postConfig: RequestConfig = {
method: http.RequestMethod.POST,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, postConfig);
}
/**
* PUT请求
*/
static put<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const putConfig: RequestConfig = {
method: http.RequestMethod.PUT,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, putConfig);
}
/**
* DELETE请求
*/
static delete<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const deleteConfig: RequestConfig = {
method: http.RequestMethod.DELETE,
headers: config.headers,
timeout: config.timeout,
data: config.data
};
return HttpUtil.request<T>(url, deleteConfig);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class HttpUtil AST#class_body#Left { AST#property_declaration#Left private static readonly BASE_URL = AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . API_BASE_URL AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private static readonly TIMEOUT = AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . REQUEST_TIMEOUT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 发送HTTP请求
* @param url 请求URL
* @param config 请求配置
* @returns Promise<HttpResponse>
*/ AST#method_declaration#Left static async request AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fullUrl = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left url AST#expression#Right . startsWith AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'http' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left ? AST#ERROR#Left url : AST#ERROR#Right AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . BASE_URL AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left url AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 发起请求: AST#template_substitution#Left $ { AST#expression#Left fullUrl AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 合并headers AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mergedHeaders : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'Content-Type' AST#property_name#Right : AST#expression#Left 'application/json' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 添加自定义headers AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left customHeaderKeys = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Object AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left customHeaderKeys AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#subscript_expression#Left AST#expression#Left customHeaderKeys AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left mergedHeaders AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = config AST#ERROR#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left key AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left requestOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpRequestOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . method AST#member_expression#Right AST#expression#Right || AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left mergedHeaders AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right || AST#expression#Left HttpUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . TIMEOUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right || AST#expression#Left HttpUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . TIMEOUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left undefined AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 请求配置: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left requestOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left response = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left httpRequest AST#expression#Right AST#await_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fullUrl AST#expression#Right , AST#expression#Left requestOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 响应状态码: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 响应内容: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right === AST#expression#Left 200 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rawResult : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 原始响应数据: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rawResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 检查是否是标准的HttpResponse格式 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left rawResult AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left rawResult AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'object' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resultObj = AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultObj AST#expression#Right . code AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left resultObj AST#expression#Right AST#binary_expression#Right AST#expression#Right . msg AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 标准格式,直接返回 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 标准格式响应: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 非标准格式,包装成HttpResponse AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wrappedResult : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left 'success' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 包装后的响应: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wrappedResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left wrappedResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 非对象类型,包装成HttpResponse AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left wrappedResult : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left 200 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left 'success' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left rawResult AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] 包装后的响应: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wrappedResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left wrappedResult AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( parseError ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] JSON解析失败: ` AST#template_literal#Right AST#expression#Right , AST#expression#Left parseError AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left 'JSON解析失败' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HttpUtil] HTTP错误: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` HTTP AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[HttpUtil] HTTP请求失败:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left '网络请求失败' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . destroy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* GET请求
*/ AST#method_declaration#Left static get AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left getConfig : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left getConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* POST请求
*/ AST#method_declaration#Left static post AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left postConfig : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left data AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left postConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* PUT请求
*/ AST#method_declaration#Left static put AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left putConfig : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . PUT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left data AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left putConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* DELETE请求
*/ AST#method_declaration#Left static delete AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left deleteConfig : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . DELETE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left deleteConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class HttpUtil {
private static readonly BASE_URL = AppConstants.API_BASE_URL;
private static readonly TIMEOUT = AppConstants.REQUEST_TIMEOUT;
static async request<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const httpRequest = http.createHttp();
try {
const fullUrl = url.startsWith('http') ? url : `${HttpUtil.BASE_URL}${url}`;
console.info(`[HttpUtil] 发起请求: ${fullUrl}`);
const mergedHeaders: Record<string, string> = {
'Content-Type': 'application/json'
};
if (config.headers) {
const customHeaderKeys = Object.keys(config.headers);
for (let i = 0; i < customHeaderKeys.length; i++) {
const key = customHeaderKeys[i];
mergedHeaders[key] = config.headers[key];
}
}
const requestOptions: http.HttpRequestOptions = {
method: config.method || http.RequestMethod.GET,
header: mergedHeaders,
connectTimeout: config.timeout || HttpUtil.TIMEOUT,
readTimeout: config.timeout || HttpUtil.TIMEOUT,
extraData: config.data ? JSON.stringify(config.data) : undefined
};
console.info(`[HttpUtil] 请求配置:`, JSON.stringify(requestOptions));
const response = await httpRequest.request(fullUrl, requestOptions);
console.info(`[HttpUtil] 响应状态码: ${response.responseCode}`);
console.info(`[HttpUtil] 响应内容: ${response.result}`);
if (response.responseCode === 200) {
try {
const rawResult: Object = JSON.parse(response.result as string);
console.info(`[HttpUtil] 原始响应数据:`, JSON.stringify(rawResult));
if (rawResult && typeof rawResult === 'object') {
const resultObj = rawResult as Record<string, Object>;
if (resultObj.code !== undefined && resultObj.msg !== undefined) {
const result = rawResult as HttpResponse<T>;
console.info(`[HttpUtil] 标准格式响应:`, JSON.stringify(result));
return result;
} else {
const wrappedResult: HttpResponse<T> = {
code: 200,
msg: 'success',
data: rawResult as T
};
console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult));
return wrappedResult;
}
} else {
const wrappedResult: HttpResponse<T> = {
code: 200,
msg: 'success',
data: rawResult as T
};
console.info(`[HttpUtil] 包装后的响应:`, JSON.stringify(wrappedResult));
return wrappedResult;
}
} catch (parseError) {
console.error(`[HttpUtil] JSON解析失败:`, parseError);
return {
code: -1,
msg: 'JSON解析失败',
data: undefined
};
}
} else {
console.warn(`[HttpUtil] HTTP错误: ${response.responseCode}`);
return {
code: response.responseCode,
msg: `HTTP ${response.responseCode}`,
data: undefined
};
}
} catch (error) {
console.error('[HttpUtil] HTTP请求失败:', error);
return {
code: -1,
msg: '网络请求失败',
data: undefined
};
} finally {
httpRequest.destroy();
}
}
static get<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const getConfig: RequestConfig = {
method: http.RequestMethod.GET,
headers: config.headers,
timeout: config.timeout,
data: config.data
};
return HttpUtil.request<T>(url, getConfig);
}
static post<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const postConfig: RequestConfig = {
method: http.RequestMethod.POST,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, postConfig);
}
static put<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const putConfig: RequestConfig = {
method: http.RequestMethod.PUT,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, putConfig);
}
static delete<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const deleteConfig: RequestConfig = {
method: http.RequestMethod.DELETE,
headers: config.headers,
timeout: config.timeout,
data: config.data
};
return HttpUtil.request<T>(url, deleteConfig);
}
}
|
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L20-L177
|
8bffa5b5619338bbfca0a2ade31c69f35b519059
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets
|
arkts
|
The percentage of 20.
|
export const PERCENTAGE_20 = '20%';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PERCENTAGE_20 = AST#expression#Left '20%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const PERCENTAGE_20 = '20%';
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L45-L45
|
0ba9e10503cff2ff766e89d5f2ec5b98a56eeb2d
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
CanvasDraw/entry/src/main/ets/pages/Index.ets
|
arkts
|
startDraw
|
Generate a list of 1000 random positions between 0 and 1, and draw circles at the corresponding positions.
|
startDraw(): void {
this.pointsToDraw = [];
for (let index = 0; index < 1000; index++) {
this.pointsToDraw.push([Math.random(), Math.random()]);
}
}
|
AST#method_declaration#Left startDraw AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pointsToDraw AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pointsToDraw AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
startDraw(): void {
this.pointsToDraw = [];
for (let index = 0; index < 1000; index++) {
this.pointsToDraw.push([Math.random(), Math.random()]);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/CanvasDraw/entry/src/main/ets/pages/Index.ets#L32-L37
|
7cea23665ef80a623afbeb9fc6961d4d8e59d901
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider22.ets
|
arkts
|
buildSlider22
|
Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Builder function buildSlider22(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10)
.enabled(config.value<config.max)
Button('减少').onClick(() => {
config.value=config.value-config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10)
.enabled(config.value>config.min)
Slider({
value: config.value,
min: config.min,
max: config.max,
step:config.step,
})
.width(config.max)
.visibility((config.contentModifier as MySliderStyle22).showSlider?Visibility.Visible:Visibility.Hidden)
.showSteps(true)
.onChange((value: number, mode: SliderChangeMode) => {
config.triggerChange(value, mode)
})
Text('当前状态:'+ ((config.contentModifier as MySliderStyle22).sliderChangeMode==0?'Begin'
:((config.contentModifier as MySliderStyle22).sliderChangeMode==1?'Moving'
:((config.contentModifier as MySliderStyle22).sliderChangeMode==2?'End'
:((config.contentModifier as MySliderStyle22).sliderChangeMode==3?'Click':'无')))))
.fontSize(10)
Text('进度值:'+ config.value)
.fontSize(10)
Text('最小值:'+ config.min)
.fontSize(10)
Text('最大值:'+ config.max)
.fontSize(10)
Text('步长:'+ config.step)
.fontSize(10)
}
.width('80%')
}
.width('100%')
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider22 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 30 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '增加' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . step AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . triggerChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SliderChangeMode AST#expression#Right . Click AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 25 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right < AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . max AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '减少' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right - AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . step AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . triggerChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SliderChangeMode AST#expression#Right . Click AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 25 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right > AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . min AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Slider ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . value AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left min : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left max : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . max AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left step : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . step AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . max AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . contentModifier AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MySliderStyle22 AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . showSlider AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . showSteps ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . triggerChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left mode AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '当前状态:' AST#expression#Right + AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . contentModifier AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MySliderStyle22 AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . sliderChangeMode AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'Begin' AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . contentModifier AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MySliderStyle22 AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . sliderChangeMode AST#member_expression#Right AST#expression#Right == AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'Moving' AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . contentModifier AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MySliderStyle22 AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . sliderChangeMode AST#member_expression#Right AST#expression#Right == AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'End' AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . contentModifier AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left MySliderStyle22 AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . sliderChangeMode AST#member_expression#Right AST#expression#Right == AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 'Click' AST#expression#Right : AST#expression#Left '无' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '进度值:' AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '最小值:' AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . min AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '最大值:' AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . max AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '步长:' AST#expression#Right + AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . step AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_function_declaration#Right
|
@Builder function buildSlider22(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10)
.enabled(config.value<config.max)
Button('减少').onClick(() => {
config.value=config.value-config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10)
.enabled(config.value>config.min)
Slider({
value: config.value,
min: config.min,
max: config.max,
step:config.step,
})
.width(config.max)
.visibility((config.contentModifier as MySliderStyle22).showSlider?Visibility.Visible:Visibility.Hidden)
.showSteps(true)
.onChange((value: number, mode: SliderChangeMode) => {
config.triggerChange(value, mode)
})
Text('当前状态:'+ ((config.contentModifier as MySliderStyle22).sliderChangeMode==0?'Begin'
:((config.contentModifier as MySliderStyle22).sliderChangeMode==1?'Moving'
:((config.contentModifier as MySliderStyle22).sliderChangeMode==2?'End'
:((config.contentModifier as MySliderStyle22).sliderChangeMode==3?'Click':'无')))))
.fontSize(10)
Text('进度值:'+ config.value)
.fontSize(10)
Text('最小值:'+ config.min)
.fontSize(10)
Text('最大值:'+ config.max)
.fontSize(10)
Text('步长:'+ config.step)
.fontSize(10)
}
.width('80%')
}
.width('100%')
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider22.ets#L16-L67
|
59a569c3b42826b87d4f18f7a07ffee17e5e6140
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/SoundEffect/SEManager.ets
|
arkts
|
isSoundLoaded
|
检查音效是否已加载
@param type 音效类型
|
public isSoundLoaded(type: SEType): boolean {
return this.soundMap.has(type) && this.soundMap.get(type)! > 0;
}
|
AST#method_declaration#Left public isSoundLoaded AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left SEType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . soundMap AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . soundMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public isSoundLoaded(type: SEType): boolean {
return this.soundMap.has(type) && this.soundMap.get(type)! > 0;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L155-L157
|
70a043204bd1b9bc61f3300bdb20a2a88940a9ae
|
github
|
huangwei021230/HarmonyFlow.git
|
427f918873b0c9efdc975ff4889726b1bfccc546
|
entry/src/main/ets/lib/Pointer.ets
|
arkts
|
get
|
Returns true if this pointer is not used and inactive, false otherwise.
|
get isNotUsed(): boolean {
return !this.isUsed;
}
|
AST#method_declaration#Left get AST#ERROR#Left isNotUsed AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isUsed AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
get isNotUsed(): boolean {
return !this.isUsed;
}
|
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L174-L176
|
0d016ca1c84e63f86a8f3891e9ee657d355b691e
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Performance/PerformanceLibrary/feature/staticImport/src/main/ets/model/GoodsModel.ets
|
arkts
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class GoodResponse {
code: number = 0
data: Records = new Records()
error: string = ''
}
|
AST#export_declaration#Left export AST#class_declaration#Left class GoodResponse AST#class_body#Left { AST#property_declaration#Left code AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right data : AST#type_annotation#Left AST#primary_type#Left Records AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Records AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right error AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class GoodResponse {
code: number = 0
data: Records = new Records()
error: string = ''
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/staticImport/src/main/ets/model/GoodsModel.ets#L16-L20
|
09aeee107f38b7f34fd7f59fac0f6eb04d93035d
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ComponentReuse/entry/src/main/ets/pages/Index.ets
|
arkts
|
[EndExclude example]
|
build() {
Column() {
// [StartExclude example]
Navigation(this.pageInfos) {
List({ space: this.LIST_SPACE }) {
ForEach(this.navDestinationData, (item: NavDestinationItem) => {
ListItem() {
Button(item.detail)
.width(Constants.LAYOUT_MAX)
.height(40)
.borderRadius(20)
.fontSize(16)
.fontColor(Color.White)
.fontWeight(500)
.onClick(() => {
this.pageInfos.pushPathByName(item.id, '');
})
}
}, (item: NavDestinationItem) => JSON.stringify(item))
}
.scrollBar(BarState.Off)
.width('90%')
.height('40%')
.margin({ top: 432 })
}
.mode(NavigationMode.Stack)
.title({
builder: this.mainPageTitle(),
height: 112
})
.navDestination(this.PagesMap)
// [EndExclude example]
if (this.switch) {
// 3.layout the component and set reuse id
ReusableComponent({ text: this.typeStr })
.reuseId(this.typeStr)
}
}
// [StartExclude example]
.height(Constants.LAYOUT_MAX)
.width(Constants.LAYOUT_MAX)
.backgroundColor('#F1F3F5')
.padding({ top: this.getUIContext().px2vp(this.topRectHeight) })
// [EndExclude example]
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // [StartExclude example] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Navigation ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageInfos AST#member_expression#Right AST#expression#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . LIST_SPACE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . navDestinationData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left NavDestinationItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . detail AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LAYOUT_MAX AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 500 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageInfos AST#member_expression#Right AST#expression#Right . pushPathByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left NavDestinationItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 432 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . mode ( AST#expression#Left AST#member_expression#Left AST#expression#Left NavigationMode AST#expression#Right . Stack AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mainPageTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 112 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . navDestination ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . PagesMap AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude example] AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . switch AST#member_expression#Right AST#expression#Right ) { // 3.layout the component and set reuse id AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReusableComponent ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . typeStr AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . reuseId ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . typeStr AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right // [StartExclude example] AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LAYOUT_MAX AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . LAYOUT_MAX AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F1F3F5' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . px2vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . topRectHeight AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [EndExclude example] } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
Navigation(this.pageInfos) {
List({ space: this.LIST_SPACE }) {
ForEach(this.navDestinationData, (item: NavDestinationItem) => {
ListItem() {
Button(item.detail)
.width(Constants.LAYOUT_MAX)
.height(40)
.borderRadius(20)
.fontSize(16)
.fontColor(Color.White)
.fontWeight(500)
.onClick(() => {
this.pageInfos.pushPathByName(item.id, '');
})
}
}, (item: NavDestinationItem) => JSON.stringify(item))
}
.scrollBar(BarState.Off)
.width('90%')
.height('40%')
.margin({ top: 432 })
}
.mode(NavigationMode.Stack)
.title({
builder: this.mainPageTitle(),
height: 112
})
.navDestination(this.PagesMap)
if (this.switch) {
ReusableComponent({ text: this.typeStr })
.reuseId(this.typeStr)
}
}
.height(Constants.LAYOUT_MAX)
.width(Constants.LAYOUT_MAX)
.backgroundColor('#F1F3F5')
.padding({ top: this.getUIContext().px2vp(this.topRectHeight) })
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/pages/Index.ets#L39-L83
|
6285645de010c08c267e163bc12c1619dc5769eb
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
VideoPlayerSample/entry/src/main/ets/view/VideoSide.ets
|
arkts
|
changeLikeCount
|
The callback function for the click event of the like button.
@param isAdd
|
private changeLikeCount(isAdd: boolean): void {
let likeCountNum: number = Number(this.item.likeCount);
if (isAdd) {
likeCountNum++;
} else {
likeCountNum--;
}
this.item.likeCount = '' + likeCountNum;
this.getUIContext().animateTo({ duration: Const.DURATION, curve: Curve.EaseInOut }, () => {
this.isLike = !this.isLike;
})
}
|
AST#method_declaration#Left private changeLikeCount AST#parameter_list#Left ( AST#parameter#Left isAdd : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left likeCountNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . likeCount AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isAdd AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left likeCountNum AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left likeCountNum AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . likeCount AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left '' AST#expression#Right + AST#expression#Left likeCountNum AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLike AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isLike AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private changeLikeCount(isAdd: boolean): void {
let likeCountNum: number = Number(this.item.likeCount);
if (isAdd) {
likeCountNum++;
} else {
likeCountNum--;
}
this.item.likeCount = '' + likeCountNum;
this.getUIContext().animateTo({ duration: Const.DURATION, curve: Curve.EaseInOut }, () => {
this.isLike = !this.isLike;
})
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/view/VideoSide.ets#L30-L41
|
1a35a955d95973debe1ca78905ce4f3fd20cb3be
|
gitee
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
Q1/Animation/entry/src/main/ets/pages/ForEachTransition.ets
|
arkts
|
fet_text
|
诗词文本样式
|
@Extend(Text) function fet_text() {
.width(300)
.height(60)
.fontSize(18)
.margin({ top: 3 })
.backgroundColor(Color.Pink)
.textAlign(TextAlign.Center)
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fet_text AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
|
@Extend(Text) function fet_text() {
.width(300)
.height(60)
.fontSize(18)
.margin({ top: 3 })
.backgroundColor(Color.Pink)
.textAlign(TextAlign.Center)
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/Animation/entry/src/main/ets/pages/ForEachTransition.ets#L59-L66
|
b0d71d19dbfd44975c5f5466b6b95bc32468bc0f
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets
|
arkts
|
getXMax
|
returns the maximum x-value this DataSet holds
@return
|
getXMax(): number {
return 0;
}
|
AST#method_declaration#Left getXMax AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getXMax(): number {
return 0;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets#L483-L485
|
725d3dea4b8858e7810b2e6b9951cfefcfdaee31
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/iab/huawei/utils/IapDataModel.ets
|
arkts
|
Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
|
export interface PurchaseData {
type: number;
jwsPurchaseOrder?: string;
jwsSubscriptionStatus?: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface PurchaseData AST#object_type#Left { AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left jwsPurchaseOrder ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left jwsSubscriptionStatus ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface PurchaseData {
type: number;
jwsPurchaseOrder?: string;
jwsSubscriptionStatus?: string;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/utils/IapDataModel.ets#L5-L9
|
3fad7e3bc73ae4923b8ef9b2100d4eb55132f093
|
github
|
|
weboose/jellyfin-sdk-arkts.git
|
826b1dabd29c5d4702d3d4a31e358114fb5b7c91
|
entry/src/main/ets/viewmodel/OptionsViewModel.ets
|
arkts
|
validate
|
检测是否参数有效
|
validate(){
if(!this.server || this.server === ''){
return false;
}
if(!this.username || this.username === ''){
return false;
}
if(!this.password || this.password === ''){
return false;
}
if(!this.serverVersion || this.serverVersion === ''){
return false;
}
return true;
}
|
AST#method_declaration#Left validate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . server AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . server AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . username AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . username AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . password AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . password AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . serverVersion AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . serverVersion AST#member_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
validate(){
if(!this.server || this.server === ''){
return false;
}
if(!this.username || this.username === ''){
return false;
}
if(!this.password || this.password === ''){
return false;
}
if(!this.serverVersion || this.serverVersion === ''){
return false;
}
return true;
}
|
https://github.com/weboose/jellyfin-sdk-arkts.git/blob/826b1dabd29c5d4702d3d4a31e358114fb5b7c91/entry/src/main/ets/viewmodel/OptionsViewModel.ets#L16-L31
|
18aa418824f84cdd82c1a4940eae9d4077e1cd69
|
github
|
851432669/Smart-Home-ArkTs-Hi3861.git
|
0451f85f072ed3281cc23d9cdc2843d79f60f975
|
entry/src/main/ets/pages/SplashPage.ets
|
arkts
|
aboutToAppear
|
新增状态,用于控制导航
|
aboutToAppear() {
// 立即开始预加载天气数据
this.preloadData();
// 图片动画
animateTo({
duration: 1000,
curve: Curve.EaseOut,
}, () => {
this.logoScale = 1
this.logoOpacity = 1
})
// 文字动画,延迟500ms开始
setTimeout(() => {
animateTo({
duration: 800,
curve: Curve.EaseOut,
}, () => {
this.textOpacity = 1
this.textScale = 1
})
// 应用名称动画,延迟300ms
setTimeout(() => {
animateTo({
duration: 600,
curve: Curve.EaseOut,
}, () => {
this.appNameOpacity = 1
})
}, 300)
}, 500)
// 动态点的动画
this.animationTimerId = setInterval(() => {
this.dotCount = (this.dotCount + 1) % 4
}, 500)
// 至少等待3秒钟,但不直接跳转,由数据加载完成来触发
this.timerId = setTimeout(() => {
// 如果数据已加载完成,则立即跳转
if (this.isDataLoaded) {
this.navigateToIndex();
} else {
// 如果数据还没加载完成,记录可以跳转的标记,等待数据加载
this.canNavigate = true;
}
}, 3000)
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 立即开始预加载天气数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preloadData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 图片动画 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logoScale AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logoOpacity AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 文字动画,延迟500ms开始 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 800 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textOpacity AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textScale AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 应用名称动画,延迟300ms AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 600 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appNameOpacity AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 300 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 动态点的动画 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationTimerId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dotCount AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dotCount AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 500 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 至少等待3秒钟,但不直接跳转,由数据加载完成来触发 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timerId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 如果数据已加载完成,则立即跳转 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDataLoaded AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . navigateToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 如果数据还没加载完成,记录可以跳转的标记,等待数据加载 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canNavigate AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 3000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
aboutToAppear() {
this.preloadData();
animateTo({
duration: 1000,
curve: Curve.EaseOut,
}, () => {
this.logoScale = 1
this.logoOpacity = 1
})
setTimeout(() => {
animateTo({
duration: 800,
curve: Curve.EaseOut,
}, () => {
this.textOpacity = 1
this.textScale = 1
})
setTimeout(() => {
animateTo({
duration: 600,
curve: Curve.EaseOut,
}, () => {
this.appNameOpacity = 1
})
}, 300)
}, 500)
this.animationTimerId = setInterval(() => {
this.dotCount = (this.dotCount + 1) % 4
}, 500)
this.timerId = setTimeout(() => {
if (this.isDataLoaded) {
this.navigateToIndex();
} else {
this.canNavigate = true;
}
}, 3000)
}
|
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/SplashPage.ets#L18-L67
|
6bf6ec6d618af365d6b266077ec88516b4ed1aeb
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/SimpleBirthdayApp.ets
|
arkts
|
aboutToAppear
|
页面生命周期 - 页面即将出现
|
async aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToAppear - starting');
console.log('[SimpleBirthdayApp] Page aboutToAppear called');
try {
await this.initializePage();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToAppear - completed successfully');
console.log('[SimpleBirthdayApp] Page initialization completed');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `SimpleBirthdayApp page aboutToAppear - error: ${error}`);
console.error('[SimpleBirthdayApp] Page initialization error:', error);
}
}
|
AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'SimpleBirthdayApp page aboutToAppear - starting' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SimpleBirthdayApp] Page aboutToAppear called' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . initializePage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'SimpleBirthdayApp page aboutToAppear - completed successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SimpleBirthdayApp] Page initialization completed' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` SimpleBirthdayApp page aboutToAppear - error: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[SimpleBirthdayApp] Page initialization error:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToAppear - starting');
console.log('[SimpleBirthdayApp] Page aboutToAppear called');
try {
await this.initializePage();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToAppear - completed successfully');
console.log('[SimpleBirthdayApp] Page initialization completed');
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `SimpleBirthdayApp page aboutToAppear - error: ${error}`);
console.error('[SimpleBirthdayApp] Page initialization error:', error);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L62-L73
|
cc336c2eab526159c71b40758ceaee3d0cead439
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/FileUtility.ets
|
arkts
|
createFolderIfNeeds
|
创建目录(递归)
|
static createFolderIfNeeds(path: string): void {
try {
if (!fs.accessSync(path)) {
fs.mkdirSync(path, true);
}
} catch (e) {
console.error(`创建目录失败: ${JSON.stringify(e)}`);
}
}
|
AST#method_declaration#Left static createFolderIfNeeds AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left fs AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 创建目录失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static createFolderIfNeeds(path: string): void {
try {
if (!fs.accessSync(path)) {
fs.mkdirSync(path, true);
}
} catch (e) {
console.error(`创建目录失败: ${JSON.stringify(e)}`);
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L183-L192
|
8ed3ed25855ad0072a685c0d7b0aeafc692f231a
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
|
arkts
|
generateYearMapping
|
生成指定年份的完整映射数据
|
async generateYearMapping(year: number): Promise<YearMappingData> {
if (this.mappingCache.has(year)) {
return this.mappingCache.get(year)!;
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[LunarSolarMapping] Generating mapping for year ${year}`);
const yearData: YearMappingData = {
year,
mappings: new Map(),
solarToLunar: new Map()
};
// 遍历这一年的每一天,建立映射关系
const startDate = new Date(year, 0, 1);
const endDate = new Date(year + 1, 0, 1);
const totalDays = Math.floor((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));
for (let dayOffset = 0; dayOffset < totalDays; dayOffset++) {
const currentDate = new Date(year, 0, 1 + dayOffset);
const solarMonth = currentDate.getMonth() + 1;
const solarDay = currentDate.getDate();
try {
// 公历转农历
const lunarDate = LunarCalendar.solarToLunar(year, solarMonth, solarDay);
if (lunarDate) {
const mapping: LunarSolarMapping = {
lunarYear: lunarDate.year,
lunarMonth: lunarDate.month,
lunarDay: lunarDate.day,
isLeapMonth: lunarDate.isLeapMonth,
solarYear: year,
solarMonth: solarMonth,
solarDay: solarDay,
dayOfYear: dayOffset + 1,
weekDay: currentDate.getDay(),
description: `农历${lunarDate.monthName}${lunarDate.dayName}`
};
// 农历到公历映射 (key: "M-D")
const lunarKey = `${lunarDate.month}-${lunarDate.day}`;
if (!yearData.mappings.has(lunarKey) || !lunarDate.isLeapMonth) {
yearData.mappings.set(lunarKey, mapping);
}
// 公历到农历映射 (key: "M-D")
const solarKey = `${solarMonth}-${solarDay}`;
yearData.solarToLunar.set(solarKey, mapping);
}
} catch (error) {
// 跳过转换失败的日期
hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[LunarSolarMapping] Failed to convert ${year}-${solarMonth}-${solarDay}: ${error}`);
}
}
this.mappingCache.set(year, yearData);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[LunarSolarMapping] Generated ${yearData.mappings.size} lunar mappings and ${yearData.solarToLunar.size} solar mappings for year ${year}`);
return yearData;
}
|
AST#method_declaration#Left async generateYearMapping AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left YearMappingData AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mappingCache AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mappingCache AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [LunarSolarMapping] Generating mapping for year AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left yearData : AST#type_annotation#Left AST#primary_type#Left YearMappingData AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left year AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left mappings AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left solarToLunar AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 遍历这一年的每一天,建立映射关系 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left startDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left endDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left year AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left totalDays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left endDate AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left startDate AST#expression#Right AST#binary_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 1000 AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left dayOffset = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left dayOffset AST#expression#Right < AST#expression#Left totalDays AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left dayOffset AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right + AST#expression#Left dayOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left solarMonth = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentDate AST#expression#Right . getMonth AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left solarDay = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentDate AST#expression#Right . getDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 公历转农历 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lunarDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarCalendar AST#expression#Right . solarToLunar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left solarMonth AST#expression#Right , AST#expression#Left solarDay AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left lunarDate AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mapping : AST#type_annotation#Left AST#primary_type#Left LunarSolarMapping AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left lunarYear AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . year AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunarMonth AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . month AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lunarDay AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . day AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isLeapMonth AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . isLeapMonth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left solarYear AST#property_name#Right : AST#expression#Left year AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left solarMonth AST#property_name#Right : AST#expression#Left solarMonth AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left solarDay AST#property_name#Right : AST#expression#Left solarDay AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dayOfYear AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left dayOffset AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weekDay AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentDate AST#expression#Right . getDay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 农历 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . monthName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . dayName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 农历到公历映射 (key: "M-D") AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lunarKey = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . month AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left lunarDate AST#expression#Right . day AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left yearData AST#expression#Right AST#unary_expression#Right AST#expression#Right . mappings AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lunarKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left lunarDate AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isLeapMonth AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left yearData AST#expression#Right . mappings AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left lunarKey AST#expression#Right , AST#expression#Left mapping AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 公历到农历映射 (key: "M-D") AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left solarKey = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left solarMonth AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left solarDay AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left yearData AST#expression#Right . solarToLunar AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left solarKey AST#expression#Right , AST#expression#Left mapping AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { // 跳过转换失败的日期 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [LunarSolarMapping] Failed to convert AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left solarMonth AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left solarDay AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mappingCache AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left year AST#expression#Right , AST#expression#Left yearData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` [LunarSolarMapping] Generated AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left yearData AST#expression#Right . mappings AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right lunar mappings and AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left yearData AST#expression#Right . solarToLunar AST#member_expression#Right AST#expression#Right . size AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right solar mappings for year AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left yearData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async generateYearMapping(year: number): Promise<YearMappingData> {
if (this.mappingCache.has(year)) {
return this.mappingCache.get(year)!;
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[LunarSolarMapping] Generating mapping for year ${year}`);
const yearData: YearMappingData = {
year,
mappings: new Map(),
solarToLunar: new Map()
};
const startDate = new Date(year, 0, 1);
const endDate = new Date(year + 1, 0, 1);
const totalDays = Math.floor((endDate.getTime() - startDate.getTime()) / (1000 * 60 * 60 * 24));
for (let dayOffset = 0; dayOffset < totalDays; dayOffset++) {
const currentDate = new Date(year, 0, 1 + dayOffset);
const solarMonth = currentDate.getMonth() + 1;
const solarDay = currentDate.getDate();
try {
const lunarDate = LunarCalendar.solarToLunar(year, solarMonth, solarDay);
if (lunarDate) {
const mapping: LunarSolarMapping = {
lunarYear: lunarDate.year,
lunarMonth: lunarDate.month,
lunarDay: lunarDate.day,
isLeapMonth: lunarDate.isLeapMonth,
solarYear: year,
solarMonth: solarMonth,
solarDay: solarDay,
dayOfYear: dayOffset + 1,
weekDay: currentDate.getDay(),
description: `农历${lunarDate.monthName}${lunarDate.dayName}`
};
const lunarKey = `${lunarDate.month}-${lunarDate.day}`;
if (!yearData.mappings.has(lunarKey) || !lunarDate.isLeapMonth) {
yearData.mappings.set(lunarKey, mapping);
}
const solarKey = `${solarMonth}-${solarDay}`;
yearData.solarToLunar.set(solarKey, mapping);
}
} catch (error) {
hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[LunarSolarMapping] Failed to convert ${year}-${solarMonth}-${solarDay}: ${error}`);
}
}
this.mappingCache.set(year, yearData);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`[LunarSolarMapping] Generated ${yearData.mappings.size} lunar mappings and ${yearData.solarToLunar.size} solar mappings for year ${year}`);
return yearData;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L90-L152
|
3327c90085e1a2102f9c6d842bf413b6224f2a30
|
github
|
iichen-bycode/ArkTsWanandroid.git
|
ad128756a6c703d9a72cf7f6da128c27fc63bd00
|
entry/src/main/ets/http/api.ets
|
arkts
|
收藏列表
@param date
@returns
|
export function getCollectList(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `lg/collect/list/${page}/json`,
showLoading:true
})
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getCollectList AST#parameter_list#Left ( AST#parameter#Left page : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axiosClient AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left HomeArticleModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` lg/collect/list/ AST#template_substitution#Left $ { AST#expression#Left page AST#expression#Right } AST#template_substitution#Right /json ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showLoading AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getCollectList(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `lg/collect/list/${page}/json`,
showLoading:true
})
}
|
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L313-L318
|
611f116a65f6374e021030f744586a47c7ead27a
|
github
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/charts/PieChartModel.ets
|
arkts
|
getCenterTextRadiusPercent
|
the rectangular radius of the bounding box for the center text, as a percentage of the pie
hole
default 1.f (100%)
|
public getCenterTextRadiusPercent(): number {
return this.mCenterTextRadiusPercent;
}
|
AST#method_declaration#Left public getCenterTextRadiusPercent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCenterTextRadiusPercent AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getCenterTextRadiusPercent(): number {
return this.mCenterTextRadiusPercent;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L799-L801
|
3a35a46ac03adc7927bbaebb04c18a1434125bc8
|
gitee
|
CQULeaf/HarmonyOS-App-Development.git
|
91f6ab13be3dbf83f6c1c4d2958673f15faefe46
|
Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets
|
arkts
|
setListener
|
设置回调
|
private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => {
}) {
// 创建回调对象
let setListener: speechRecognizer.RecognitionListener = {
// 开始识别成功回调
onStart(sessionId: string, eventMessage: string) {
console.log('识别开始', sessionId, eventMessage);
},
// 事件回调
onEvent(sessionId: string, eventCode: number, eventMessage: string) {
},
// 识别结果回调,包括中间结果和最终结果
onResult(sessionId: string, result: speechRecognizer.SpeechRecognitionResult) {
console.log('识别结果', result);
SpeechRecognizerManager.speechResult = result
callback && callback(result)
},
// 识别完成回调
onComplete(sessionId: string, eventMessage: string) {
console.log('识别完成', sessionId, eventMessage);
},
// 错误回调,错误码通过本方法返回
// 如:返回错误码1002200006,识别引擎正忙,引擎正在识别中
// 更多错误码请参考错误码参考
onError(sessionId: string, errorCode: number, errorMessage: string) {
console.error('识别错误', sessionId, errorCode, errorMessage);
},
}
// 设置回调
SpeechRecognizerManager.asrEngine?.setListener(setListener);
}
|
AST#method_declaration#Left private static setListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left srr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // 创建回调对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left setListener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . RecognitionListener AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { // 开始识别成功回调 AST#property_assignment#Left AST#property_name#Left onStart AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventMessage : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '识别开始' AST#expression#Right , AST#expression#Left sessionId AST#expression#Right , AST#expression#Left eventMessage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , // 事件回调 AST#property_assignment#Left AST#property_name#Left onEvent AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventMessage : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#property_assignment#Right , // 识别结果回调,包括中间结果和最终结果 AST#property_assignment#Left AST#property_name#Left onResult AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '识别结果' AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left SpeechRecognizerManager AST#expression#Right . speechResult AST#member_expression#Right = AST#expression#Left result AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left callback AST#expression#Right && AST#expression#Left callback AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , // 识别完成回调 AST#property_assignment#Left AST#property_name#Left onComplete AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventMessage : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '识别完成' AST#expression#Right , AST#expression#Left sessionId AST#expression#Right , AST#expression#Left eventMessage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , // 错误回调,错误码通过本方法返回 // 如:返回错误码1002200006,识别引擎正忙,引擎正在识别中 // 更多错误码请参考错误码参考 AST#property_assignment#Left AST#property_name#Left onError AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left errorMessage : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '识别错误' AST#expression#Right , AST#expression#Left sessionId AST#expression#Right , AST#expression#Left errorCode AST#expression#Right , AST#expression#Left errorMessage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right // 设置回调 AST#ERROR#Left SpeechRecognizerManager AST#ERROR#Right . asrEngine AST#member_expression#Right AST#expression#Right ?. setListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left setListener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => {
}) {
let setListener: speechRecognizer.RecognitionListener = {
onStart(sessionId: string, eventMessage: string) {
console.log('识别开始', sessionId, eventMessage);
},
onEvent(sessionId: string, eventCode: number, eventMessage: string) {
},
onResult(sessionId: string, result: speechRecognizer.SpeechRecognitionResult) {
console.log('识别结果', result);
SpeechRecognizerManager.speechResult = result
callback && callback(result)
},
onComplete(sessionId: string, eventMessage: string) {
console.log('识别完成', sessionId, eventMessage);
},
onError(sessionId: string, errorCode: number, errorMessage: string) {
console.error('识别错误', sessionId, errorCode, errorMessage);
},
}
SpeechRecognizerManager.asrEngine?.setListener(setListener);
}
|
https://github.com/CQULeaf/HarmonyOS-App-Development.git/blob/91f6ab13be3dbf83f6c1c4d2958673f15faefe46/Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets#L49-L79
|
4de5abcbd179f9cc9b76c24ff1b60b9e0027e253
|
github
|
DompetApp/Dompet.harmony.git
|
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
|
entry/src/main/ets/configure/device.ets
|
arkts
|
updateWindowSize
|
@throws
|
updateWindowSize(_: window.Size) {
const displayClass = display.getDefaultDisplaySync()
this.foldDisplayMode = display.getFoldDisplayMode()
this.orientation = displayClass.orientation
this.foldStatus = display.getFoldStatus()
this.isFoldable = display.isFoldable()
this.height = displayClass.height
this.width = displayClass.width
this.state = displayClass.state
this.id = displayClass.id
}
|
AST#method_declaration#Left updateWindowSize AST#parameter_list#Left ( AST#parameter#Left _ : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left displayClass = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . foldDisplayMode AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getFoldDisplayMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . orientation AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left displayClass AST#expression#Right . orientation AST#member_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . foldStatus AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getFoldStatus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . isFoldable AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . isFoldable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . height AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left displayClass AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . width AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left displayClass AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . state AST#member_expression#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left displayClass AST#expression#Right . state AST#member_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . id AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left displayClass AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
updateWindowSize(_: window.Size) {
const displayClass = display.getDefaultDisplaySync()
this.foldDisplayMode = display.getFoldDisplayMode()
this.orientation = displayClass.orientation
this.foldStatus = display.getFoldStatus()
this.isFoldable = display.isFoldable()
this.height = displayClass.height
this.width = displayClass.width
this.state = displayClass.state
this.id = displayClass.id
}
|
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/device.ets#L100-L110
|
678dab8ef02d523f4ccb8b1300db81831f3aefb0
|
github
|
yangsongming/ArkTs-HuXiHelper.git
|
ed148299fc6dcf351bcc0f2863a5aee4885fbaf5
|
ets/controller/MapController.ets
|
arkts
|
getResourceString
|
Obtains the resource name.
@param resource Resource file.
@returns Resource File Name.
|
getResourceString(resource: Resource): string {
let resourceString: string = '';
try {
resourceString = getContext(this).resourceManager.getStringSync(resource.id);
} catch (error) {
Logger.error(TAG, `getResourceString failed, error is ${JSON.stringify(error)}`);
}
return resourceString;
}
|
AST#method_declaration#Left getResourceString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left resourceString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left resourceString = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left resource AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` getResourceString failed, error is AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left resourceString AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getResourceString(resource: Resource): string {
let resourceString: string = '';
try {
resourceString = getContext(this).resourceManager.getStringSync(resource.id);
} catch (error) {
Logger.error(TAG, `getResourceString failed, error is ${JSON.stringify(error)}`);
}
return resourceString;
}
|
https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/controller/MapController.ets#L129-L137
|
2123da0b61f702353a9608438fb143aefec406b0
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets
|
arkts
|
SecondaryLinkExample
|
每个TAG对应多少个元素
功能描述: 本示例主要介绍了List组件实现二级联动(Cascading List)的场景
推荐场景: 需要使用多级列表联合滚动的场景,如:外卖点单页面等
核心组件:
1. SecondaryLinkExample.tagListItemBuilder
实现步骤:
1. 一二级列表分别绑定不同的Scroller对象,一级列表(tagLists)绑定classifyScroller对象,二级列表绑定scroller对象
2. 点击一级列表后,通过一级列表的索引获取二级列表的索引,调用scrollToIndex方法将一二级列表滚动到指定索引值
3. 滑动二级列表触发组件滚动事件后,获取到列表可视区域第一个item对应的索引值,通过二级列表索引获取一级列表索引,调用scrollToIndex方法将一级列表滚动到指定索引值
|
@Component
export struct SecondaryLinkExample {
@State @Watch('onIndexChange') currentTagIndex: number = 0; // 一级列表焦点索引值
private tagLists: Array<string> = []; // 一级列表数据
@State contentData: MyDataSource = new MyDataSource(); // 二级列表数据
private records: Array<number> = []; // 二级列表分组count数量
// TODO:知识点: 1.级联列表分别绑定不同的Scroller对象,通过调用Scroller对象方法实现控制列表滚动
private classifyScroller: Scroller = new Scroller(); // 一级列表Scroller对象
private scroller: Scroller = new Scroller(); // 二级列表Scroller对象
private tagIndexPosition: ListIndexPosition = { start: 0, end: 0 }; // 一级列表可视区域的起始索引和终点索引
private isClickTagList: boolean = false; // 是否点击一级列表
/**
* 生命周期函数
*/
aboutToAppear(): void {
// 构造数据
for (let i = 0; i < TAG_LIST_LENGTH; i++) {
this.tagLists.push(`类别${i + 1}`);
const tempData: Array<CustomDataType> = new Array(CONTENT_PER_TAG).fill({
desc: '内容数据',
tag: `类别${i + 1}`
});
this.records.push(i * CONTENT_PER_TAG);
this.contentData.pushData(tempData);
}
this.records.push(CONTENT_PER_TAG * TAG_LIST_LENGTH);
}
build() {
Column() {
FunctionDescription({
title: $r('app.string.secondarylinkage_secondary_link'),
content: $r('app.string.secondarylinkage_secondary_link_desc')
})
Row() {
// TODO:知识点: 2.一级列表绑定Scroller对象
List({ scroller: this.classifyScroller, initialIndex: 0 }) {
// 性能知识点:此处为横向列表,列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach
ForEach(this.tagLists, (item: string, index: number) => {
this.tagListItemBuilder(item, index);
})
}
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.onScrollIndex((start: number, end: number) => {
this.tagIndexPosition = { start, end };
})
.listDirection(Axis.Vertical)
.scrollBar(BarState.Off)
.height('100%')
.width('27%')
// 二级列表
List({ scroller: this.scroller, space: COMPONENT_STYLE.ITEM_GUTTER }) {
/*
性能知识点:列表中数据较多且不确定的情况下,使用LazyForEach进行数据循环渲染。
当组件滑出可视区域外时,框架会进行组件销毁回收以降低内存占用。
文档参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-rendering-control-lazyforeach-0000001820879609
*/
LazyForEach(this.contentData, (item: CustomDataType, index: number) => {
this.contentListItemBuilder(item, index);
})
this.contentListNoMoreBuilder();
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.id('list_content')
.scrollBar(BarState.Off)
.listDirection(Axis.Vertical) // 列表排列方向水平
.flexShrink(1)
.divider({
strokeWidth: 1,
color: $r('sys.color.ohos_id_color_list_separator'),
startMargin: $r('sys.float.ohos_id_card_margin_start'),
endMargin: $r('sys.float.ohos_id_card_margin_end')
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isClickTagList = false; // 当前点击的非一级列表
}
})
// 性能知识点:onScrollIndex事件在列表滚动时频繁执行,在回调中需要尽量减少耗时和冗余操作,例如减少不必要的日志打印
.onScrollIndex((start: number) => {
// TODO:知识点: 4.滑动二级列表触发组件滚动事件后,返回列表可视区域的第一个item对应的索引值,当前通过二级列表索引获取一级列表索引,操作一级列表Scroller对象使列表滚动到指定位置
const currentClassIndex = this.findClassIndex(start);
if (currentClassIndex !== this.currentTagIndex && this.isClickTagList !== true) {
this.currentTagIndex = currentClassIndex;
this.classifyScroller.scrollToIndex(currentClassIndex, true);
}
})
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.width('100%')
.layoutWeight(1)
}
}
/**
* 内容底部"没有更多"视图
*/
@Builder
contentListNoMoreBuilder() {
ListItem() {
Text($r('app.string.secondarylinkage_nomore'))
.fontColor($r('sys.color.ohos_fa_text_secondary'))
}
.width('100%')
}
/**
* 右侧内容视图
*/
@Builder
contentListItemBuilder(item: CustomDataType, index: number) {
ListItem() {
Row({ space: COMPONENT_STYLE.ITEM_GUTTER }) {
Text()
.aspectRatio(1)
.height('100%')
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
Column({ space: COMPONENT_STYLE.SUB_ITEM_GUTTER }) {
Text(item.desc + index)
Text(item.tag)
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.fontColor($r('app.color.secondarylinkage_contentTextFontColor'))
Text()
.height(COMPONENT_STYLE.SUB_ITEM_TEXT_HEIGHT)
.width(COMPONENT_STYLE.SUB_ITEM_TEXT_WIDTH_TITLE)
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
Text()
.height(COMPONENT_STYLE.SUB_ITEM_TEXT_HEIGHT)
.width(COMPONENT_STYLE.SUB_ITEM_TEXT_WIDTH_BODY)
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
}
.width('100%')
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.SpaceEvenly)
.height('100%')
}
.backgroundColor($r('app.color.secondarylinkage_white'))
.height(COMPONENT_STYLE.SUB_ITEM_HEIGHT)
}
.id('content_' + index)
.padding({
left: $r('sys.float.ohos_id_card_margin_start'),
right: $r('sys.float.ohos_id_card_margin_end'),
})
}
/**
* 左侧类别视图
*/
@Builder
tagListItemBuilder(item: string, index: number) {
ListItem() {
Text(item)
.width('100%')
.height(COMPONENT_STYLE.TAG_TEXT_HEIGHT)
.fontWeight(FontWeight.Regular)
.fontColor($r('sys.color.ohos_fa_text_secondary'))
.textAlign(TextAlign.Center)
.backgroundColor(this.currentTagIndex === index ? $r('sys.color.ohos_id_color_background') : '')
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isClickTagList = true; // 当前点击的是一级列表
}
})
.onClick(() => {
// TODO:知识点: 3.点击一级列表后,通过一级列表索引获取二级列表索引,分别操作不同的Scroller对象使列表滚动到指定位置
this.currentTagIndex = index;
const itemIndex = this.findItemIndex(index);
this.scroller.scrollToIndex(itemIndex, true);
})
}
.id(this.currentTagIndex === index ? 'type_' + index : 'type_' + index + '_selected')
}
/**
* 根据一级列表索引值获取二级列表索引值
*
* @param {number} index - 一级列表索引值
* @returns {number} 二级列表索引值
*/
findItemIndex(index: number): number {
return this.records[index];
}
/**
* 根据二级列表索引值获取对应一级列表索引
*
* @param {number} index - 二级列表索引值
* @returns {number} 一级列表索引值
*/
findClassIndex(index: number): number {
let ans = 0;
for (let i = 0; i < this.records.length; i++) {
if (index >= this.records[i] && index < this.records[i + 1]) {
ans = i;
break;
}
}
return ans;
}
/**
* 监听一级列表获焦索引变化
*/
onIndexChange() {
const start = this.tagIndexPosition.start;
const end = this.tagIndexPosition.end;
if ((this.currentTagIndex === end || this.currentTagIndex === end - 1)) {
let leftScrollCount: number = this.currentTagIndex + 1;
leftScrollCount = leftScrollCount >= this.tagLists.length - 1 ? this.tagLists.length - 1 : leftScrollCount;
/**
* scrollToIndex(value: number, smooth?: boolean, align?: ScrollAlign)
* 性能知识点:开启smooth动效时,会对经过的所有item进行加载和布局计算,当大量加载item时会导致性能问题。
*/
this.classifyScroller.scrollToIndex(leftScrollCount, true); // 使获焦item向左滚动
}
if (this.currentTagIndex === start || this.currentTagIndex === start + 1) {
let rightScrollCount: number = this.currentTagIndex - 1;
rightScrollCount = rightScrollCount <= 0 ? 0 : rightScrollCount;
this.classifyScroller.scrollToIndex(rightScrollCount, true); // 使获焦item向右滚动
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SecondaryLinkExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onIndexChange' AST#expression#Right ) AST#decorator#Right currentTagIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right // 一级列表焦点索引值 AST#property_declaration#Left private tagLists : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 一级列表数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right contentData : AST#type_annotation#Left AST#primary_type#Left MyDataSource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left MyDataSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 二级列表数据 AST#property_declaration#Left private records : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 二级列表分组count数量 // TODO:知识点: 1.级联列表分别绑定不同的Scroller对象,通过调用Scroller对象方法实现控制列表滚动 AST#property_declaration#Left private classifyScroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 一级列表Scroller对象 AST#property_declaration#Left private scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 二级列表Scroller对象 AST#property_declaration#Left private tagIndexPosition : AST#type_annotation#Left AST#primary_type#Left ListIndexPosition AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left start AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left end AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // 一级列表可视区域的起始索引和终点索引 AST#property_declaration#Left private isClickTagList : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 是否点击一级列表 /**
* 生命周期函数
*/ AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 构造数据 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left TAG_LIST_LENGTH AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagLists AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 类别 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tempData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left CONTENT_PER_TAG AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left desc AST#property_name#Right : AST#expression#Left '内容数据' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 类别 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . records AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right * AST#expression#Left CONTENT_PER_TAG AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentData AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tempData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . records AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left CONTENT_PER_TAG AST#expression#Right * AST#expression#Left TAG_LIST_LENGTH AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FunctionDescription ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.secondarylinkage_secondary_link' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.secondarylinkage_secondary_link_desc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // TODO:知识点: 2.一级列表绑定Scroller对象 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifyScroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left initialIndex : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 性能知识点:此处为横向列表,列表项确定且数量较少,使用了ForEach,在列表项多的情况下,推荐使用LazyForeEach AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagLists AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagListItemBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_component_normal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onScrollIndex ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left end : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagIndexPosition AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left start AST#property_assignment#Right , AST#property_assignment#Left end AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '27%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 二级列表 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . ITEM_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { /*
性能知识点:列表中数据较多且不确定的情况下,使用LazyForEach进行数据循环渲染。
当组件滑出可视区域外时,框架会进行组件销毁回收以降低内存占用。
文档参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-rendering-control-lazyforeach-0000001820879609
*/ AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentListItemBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right , AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentListNoMoreBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'list_content' AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) // 列表排列方向水平 AST#modifier_chain_expression#Left . flexShrink ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . divider ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_list_separator' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left startMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_card_margin_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endMargin AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_card_margin_end' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onTouch ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Down AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClickTagList AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 当前点击的非一级列表 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) // 性能知识点:onScrollIndex事件在列表滚动时频繁执行,在回调中需要尽量减少耗时和冗余操作,例如减少不必要的日志打印 AST#modifier_chain_expression#Left . onScrollIndex ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left start : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:知识点: 4.滑动二级列表触发组件滚动事件后,返回列表可视区域的第一个item对应的索引值,当前通过二级列表索引获取一级列表索引,操作一级列表Scroller对象使列表滚动到指定位置 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentClassIndex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . findClassIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left start AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left currentClassIndex AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isClickTagList AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right = AST#expression#Left currentClassIndex AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifyScroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left currentClassIndex AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /**
* 内容底部"没有更多"视图
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right contentListNoMoreBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.secondarylinkage_nomore' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_fa_text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 右侧内容视图
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right contentListItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . ITEM_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_component_normal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_corner_radius_default_m' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . SUB_ITEM_GUTTER AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . desc AST#member_expression#Right AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . tag AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_text_size_body2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.secondarylinkage_contentTextFontColor' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . SUB_ITEM_TEXT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . SUB_ITEM_TEXT_WIDTH_TITLE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_component_normal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . SUB_ITEM_TEXT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . SUB_ITEM_TEXT_WIDTH_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_component_normal' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.secondarylinkage_white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . SUB_ITEM_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'content_' AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_card_margin_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_card_margin_end' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 左侧类别视图
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tagListItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left item AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left COMPONENT_STYLE AST#expression#Right . TAG_TEXT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Regular AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_fa_text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_id_color_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onTouch ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Down AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClickTagList AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 当前点击的是一级列表 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // TODO:知识点: 3.点击一级列表后,通过一级列表索引获取二级列表索引,分别操作不同的Scroller对象使列表滚动到指定位置 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left itemIndex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . findItemIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left itemIndex AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'type_' AST#expression#Right + AST#ERROR#Left index : AST#ERROR#Right AST#expression#Left 'type_' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '_selected' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 根据一级列表索引值获取二级列表索引值
*
* @param {number} index - 一级列表索引值
* @returns {number} 二级列表索引值
*/ AST#method_declaration#Left findItemIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . records AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 根据二级列表索引值获取对应一级列表索引
*
* @param {number} index - 二级列表索引值
* @returns {number} 一级列表索引值
*/ AST#method_declaration#Left findClassIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ans = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . records AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . records AST#member_expression#Right AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right && AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . records AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ans = AST#expression#Left i AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left ans AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 监听一级列表获焦索引变化
*/ AST#method_declaration#Left onIndexChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left start = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagIndexPosition AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left end = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagIndexPosition AST#member_expression#Right AST#expression#Right . end AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left end AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left end AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left leftScrollCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left leftScrollCount = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left leftScrollCount AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . tagLists AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tagLists AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left leftScrollCount AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right /**
* scrollToIndex(value: number, smooth?: boolean, align?: ScrollAlign)
* 性能知识点:开启smooth动效时,会对经过的所有item进行加载和布局计算,当大量加载item时会导致性能问题。
*/ AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifyScroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left leftScrollCount AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 使获焦item向左滚动 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left start AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left start AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rightScrollCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTagIndex AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left rightScrollCount = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left rightScrollCount AST#expression#Right <= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left rightScrollCount AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifyScroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rightScrollCount AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 使获焦item向右滚动 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct SecondaryLinkExample {
@State @Watch('onIndexChange') currentTagIndex: number = 0;
private tagLists: Array<string> = [];
@State contentData: MyDataSource = new MyDataSource();
private records: Array<number> = [];
private classifyScroller: Scroller = new Scroller();
private scroller: Scroller = new Scroller();
private tagIndexPosition: ListIndexPosition = { start: 0, end: 0 };
private isClickTagList: boolean = false;
aboutToAppear(): void {
for (let i = 0; i < TAG_LIST_LENGTH; i++) {
this.tagLists.push(`类别${i + 1}`);
const tempData: Array<CustomDataType> = new Array(CONTENT_PER_TAG).fill({
desc: '内容数据',
tag: `类别${i + 1}`
});
this.records.push(i * CONTENT_PER_TAG);
this.contentData.pushData(tempData);
}
this.records.push(CONTENT_PER_TAG * TAG_LIST_LENGTH);
}
build() {
Column() {
FunctionDescription({
title: $r('app.string.secondarylinkage_secondary_link'),
content: $r('app.string.secondarylinkage_secondary_link_desc')
})
Row() {
List({ scroller: this.classifyScroller, initialIndex: 0 }) {
ForEach(this.tagLists, (item: string, index: number) => {
this.tagListItemBuilder(item, index);
})
}
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.onScrollIndex((start: number, end: number) => {
this.tagIndexPosition = { start, end };
})
.listDirection(Axis.Vertical)
.scrollBar(BarState.Off)
.height('100%')
.width('27%')
List({ scroller: this.scroller, space: COMPONENT_STYLE.ITEM_GUTTER }) {
LazyForEach(this.contentData, (item: CustomDataType, index: number) => {
this.contentListItemBuilder(item, index);
})
this.contentListNoMoreBuilder();
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.id('list_content')
.scrollBar(BarState.Off)
.listDirection(Axis.Vertical)
.flexShrink(1)
.divider({
strokeWidth: 1,
color: $r('sys.color.ohos_id_color_list_separator'),
startMargin: $r('sys.float.ohos_id_card_margin_start'),
endMargin: $r('sys.float.ohos_id_card_margin_end')
})
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isClickTagList = false;
}
})
.onScrollIndex((start: number) => {
const currentClassIndex = this.findClassIndex(start);
if (currentClassIndex !== this.currentTagIndex && this.isClickTagList !== true) {
this.currentTagIndex = currentClassIndex;
this.classifyScroller.scrollToIndex(currentClassIndex, true);
}
})
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM])
.width('100%')
.layoutWeight(1)
}
}
@Builder
contentListNoMoreBuilder() {
ListItem() {
Text($r('app.string.secondarylinkage_nomore'))
.fontColor($r('sys.color.ohos_fa_text_secondary'))
}
.width('100%')
}
@Builder
contentListItemBuilder(item: CustomDataType, index: number) {
ListItem() {
Row({ space: COMPONENT_STYLE.ITEM_GUTTER }) {
Text()
.aspectRatio(1)
.height('100%')
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
.borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
Column({ space: COMPONENT_STYLE.SUB_ITEM_GUTTER }) {
Text(item.desc + index)
Text(item.tag)
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.fontColor($r('app.color.secondarylinkage_contentTextFontColor'))
Text()
.height(COMPONENT_STYLE.SUB_ITEM_TEXT_HEIGHT)
.width(COMPONENT_STYLE.SUB_ITEM_TEXT_WIDTH_TITLE)
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
Text()
.height(COMPONENT_STYLE.SUB_ITEM_TEXT_HEIGHT)
.width(COMPONENT_STYLE.SUB_ITEM_TEXT_WIDTH_BODY)
.backgroundColor($r('sys.color.ohos_id_color_component_normal'))
}
.width('100%')
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.SpaceEvenly)
.height('100%')
}
.backgroundColor($r('app.color.secondarylinkage_white'))
.height(COMPONENT_STYLE.SUB_ITEM_HEIGHT)
}
.id('content_' + index)
.padding({
left: $r('sys.float.ohos_id_card_margin_start'),
right: $r('sys.float.ohos_id_card_margin_end'),
})
}
@Builder
tagListItemBuilder(item: string, index: number) {
ListItem() {
Text(item)
.width('100%')
.height(COMPONENT_STYLE.TAG_TEXT_HEIGHT)
.fontWeight(FontWeight.Regular)
.fontColor($r('sys.color.ohos_fa_text_secondary'))
.textAlign(TextAlign.Center)
.backgroundColor(this.currentTagIndex === index ? $r('sys.color.ohos_id_color_background') : '')
.onTouch((event: TouchEvent) => {
if (event.type === TouchType.Down) {
this.isClickTagList = true;
}
})
.onClick(() => {
this.currentTagIndex = index;
const itemIndex = this.findItemIndex(index);
this.scroller.scrollToIndex(itemIndex, true);
})
}
.id(this.currentTagIndex === index ? 'type_' + index : 'type_' + index + '_selected')
}
findItemIndex(index: number): number {
return this.records[index];
}
findClassIndex(index: number): number {
let ans = 0;
for (let i = 0; i < this.records.length; i++) {
if (index >= this.records[i] && index < this.records[i + 1]) {
ans = i;
break;
}
}
return ans;
}
onIndexChange() {
const start = this.tagIndexPosition.start;
const end = this.tagIndexPosition.end;
if ((this.currentTagIndex === end || this.currentTagIndex === end - 1)) {
let leftScrollCount: number = this.currentTagIndex + 1;
leftScrollCount = leftScrollCount >= this.tagLists.length - 1 ? this.tagLists.length - 1 : leftScrollCount;
this.classifyScroller.scrollToIndex(leftScrollCount, true);
}
if (this.currentTagIndex === start || this.currentTagIndex === start + 1) {
let rightScrollCount: number = this.currentTagIndex - 1;
rightScrollCount = rightScrollCount <= 0 ? 0 : rightScrollCount;
this.classifyScroller.scrollToIndex(rightScrollCount, true);
}
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets#L34-L263
|
6e779d5f4b7575e161580b3e7e96262ca138656e
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets
|
arkts
|
get
|
应用约束1:添加返回类型注解
|
get status(): number {
return this.client.ws.connection ? Constants.Status.IDLE : Constants.Status.IDLE;
}
|
AST#method_declaration#Left get AST#ERROR#Left status AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . connection AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Status AST#member_expression#Right AST#expression#Right . IDLE AST#member_expression#Right AST#expression#Right : AST#expression#Left Constants AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Status AST#member_expression#Right AST#expression#Right . IDLE AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
get status(): number {
return this.client.ws.connection ? Constants.Status.IDLE : Constants.Status.IDLE;
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets#L41-L43
|
cef80d40f41da7ad4a3e314e6c4143e1312b5907
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Connectivity/Bluetooth/entry/src/main/ets/constants/StyleConstants.ets
|
arkts
|
Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export default class StyleConstants {
/**
* navigation bar height
*/
public static readonly HEIGHT_NAVIGATION_BAR = 64;
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /**
* navigation bar height
*/ AST#property_declaration#Left public static readonly HEIGHT_NAVIGATION_BAR = AST#expression#Left 64 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class StyleConstants {
public static readonly HEIGHT_NAVIGATION_BAR = 64;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/Bluetooth/entry/src/main/ets/constants/StyleConstants.ets#L16-L21
|
2c139226ad963d15416860edfd3ff15fcd8e7636
|
gitee
|
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/processes/init_process.ets
|
arkts
|
settings
|
Hosts
Inits both settings and tabs.
@param t0 Start time of the whole initialization process.
|
async function settings(storage: LocalStorage) {
await bunch_of_settings.init();
// DEV_MODE
AppStorage.setOrCreate('DEV_MODE', bunch_of_settings.get('DEV_MODE') as boolean);
// UI Status
AppStorage.setOrCreate('title_bar_position', bunch_of_settings.get('title_bar_position') as string);
AppStorage.setOrCreate('tabs_style', bunch_of_settings.get('tabs_style') as string);
AppStorage.setOrCreate('tabs_style_non_tablet_mode', bunch_of_settings.get('tabs_style_non_tablet_mode') as string);
AppStorage.setOrCreate('showing_my_window_alias', bunch_of_settings.get('status_showing_my_windows_alias') as boolean);
AppStorage.setOrCreate('showing_my_window_alias_non_tablet', bunch_of_settings.get('status_showing_my_windows_alias_non_tablet') as boolean);
AppStorage.setOrCreate('tabs_vertical_auto_hide', bunch_of_settings.get('tabs_vertical_auto_hide') as boolean);
AppStorage.setOrCreate('tabs_vertical_auto_hide_button', bunch_of_settings.get('tabs_vertical_auto_hide_button') as boolean);
AppStorage.setOrCreate('showing_large_my_window_alias', bunch_of_settings.get('status_showing_large_my_window_alias') as boolean);
AppStorage.setOrCreate('my_window_alias_position', bunch_of_settings.get('my_window_alias_position') as string);
AppStorage.setOrCreate('effects', bunch_of_settings.get('effects') as boolean);
AppStorage.setOrCreate('last_zone', bunch_of_settings.get('last_zone') as string);
// Continuation
AppStorage.setOrCreate('continuation_auto_exit', bunch_of_settings.get('continuation_auto_exit') as boolean);
AppStorage.setOrCreate('continuation_auto_close_tab', bunch_of_settings.get('continuation_auto_close_tab') as boolean);
// Experience - Suggestions
AppStorage.setOrCreate('max_bookmark_advice', bunch_of_settings.get('max_bookmark_suggest') as number);
AppStorage.setOrCreate('max_history_advice', bunch_of_settings.get('max_history_suggest') as number);
// Context Menu
AppStorage.setOrCreate('web_context_menu_enabled', bunch_of_settings.get('web_context_menu_enabled') as boolean);
AppStorage.setOrCreate('web_context_menu_image_preview', bunch_of_settings.get('web_context_menu_image_preview') as boolean);
AppStorage.setOrCreate('web_context_menu_web_preview', bunch_of_settings.get('web_context_menu_web_preview') as boolean);
AppStorage.setOrCreate('web_context_image_height', bunch_of_settings.get('web_context_image_height') as number);
AppStorage.setOrCreate('web_context_web_height', bunch_of_settings.get('web_context_web_height') as number);
// History
AppStorage.setOrCreate('collect_new_history', bunch_of_settings.get('collect_new_history') as boolean);
AppStorage.setOrCreate('history_index_load_quantity', bunch_of_settings.get('history_index_load_quantity') as boolean);
// Accessibility
AppStorage.setOrCreate('sys_back_to_access_backward', bunch_of_settings.get('sys_back_access_backward') as boolean);
AppStorage.setOrCreate('esc_to_access_backward', bunch_of_settings.get('esc_to_access_backward') as boolean);
AppStorage.setOrCreate('preferred_hand_left_or_right', bunch_of_settings.get('preferred_hand_left_or_right') as string);
AppStorage.setOrCreate('preferred_hand_reverse_tabs_panel', bunch_of_settings.get('preferred_hand_reverse_tabs_panel') as boolean);
AppStorage.setOrCreate('preferred_hand_reverse_settings_menu', bunch_of_settings.get('preferred_hand_reverse_settings_menu') as boolean);
AppStorage.setOrCreate('preferred_hand_reverse_homepage_shortcuts', bunch_of_settings.get('preferred_hand_reverse_homepage_shortcuts') as boolean);
AppStorage.setOrCreate('preferred_hand_auto', bunch_of_settings.get('preferred_hand_auto') as boolean);
// Appearance - Animation
let animation_response = bunch_of_settings.get('animation_response') as number;
let animation_damping = bunch_of_settings.get('animation_damping_coefficient') as number;
console.log('[Meow][init] Animation response: ' + animation_response.toString() + ', damping: ' + animation_damping.toString());
AppStorage.setOrCreate('animation_response', animation_response);
AppStorage.setOrCreate('animation_damping_coefficient', animation_damping);
// Appearance - Colors
AppStorage.setOrCreate('color_light_primary', bunch_of_settings.get('color_light_primary') as string);
AppStorage.setOrCreate('color_light_secondary', bunch_of_settings.get('color_light_secondary') as string);
AppStorage.setOrCreate('color_light_font', bunch_of_settings.get('color_light_font') as string);
AppStorage.setOrCreate('color_dark_primary', bunch_of_settings.get('color_dark_primary') as string);
AppStorage.setOrCreate('color_dark_secondary', bunch_of_settings.get('color_dark_secondary') as string);
AppStorage.setOrCreate('color_dark_font', bunch_of_settings.get('color_dark_font') as string);
// Appearance - Dark
AppStorage.setOrCreate('web_force_dark_mode', bunch_of_settings.get('web_force_dark_mode') as boolean);
let web_force_dark_mode_exemptions = bunch_of_settings.get('web_force_dark_mode_exemptions') as string;
if (web_force_dark_mode_exemptions.length < 2) {
// Empty
let web_force_dark_mode_exemptions_list: string[] = [];
AppStorage.setOrCreate('web_force_dark_mode_exemptions', web_force_dark_mode_exemptions_list);
} else {
AppStorage.setOrCreate('web_force_dark_mode_exemptions', web_force_dark_mode_exemptions.split('\n'));
}
// Bottom avoid
AppStorage.setOrCreate('bottom_avoid', bunch_of_settings.get('bottom_avoid') as boolean);
AppStorage.setOrCreate('navigation_indicator', bunch_of_settings.get('navigation_indicator') as boolean);
// General - Surf
// NO NEED, as these data would be put to bunch_of_tabs
// let home_url: string = bunch_of_settings.get('home_url') as string
// let new_tab_url: string = bunch_of_settings.get('new_tab_url') as string
// let start_up_option: string = bunch_of_settings.get('start_up_option') as string
// AppStorage.setOrCreate('home_url', home_url);
// AppStorage.setOrCreate('new_tab_url', new_tab_url);
// AppStorage.setOrCreate('start_up_option', start_up_option);
AppStorage.setOrCreate('intelligent_tracking_prevention', bunch_of_settings.get('intelligent_tracking_prevention') as boolean);
AppStorage.setOrCreate('enable_third_party_cookies', bunch_of_settings.get('enable_third_party_cookies') as boolean);
// General - Homepage
AppStorage.setOrCreate('homepage_shortcuts_init_height', bunch_of_settings.get('homepage_shortcuts_init_height') as number);
AppStorage.setOrCreate('homepage_shortcuts_bookmarks_dir', bunch_of_settings.get('homepage_shortcuts_bookmarks_dir') as string);
// console.log('[Meow] homepage_shortcuts_bookmarks_dir: ' + bunch_of_settings.get('homepage_shortcuts_bookmarks_dir') as string);
let sites_got: string;
// Disable image
AppStorage.setOrCreate('disable_image', bunch_of_settings.get('disable_image') as boolean);
AppStorage.setOrCreate('disable_image_all_sites', bunch_of_settings.get('disable_image_all_sites') as boolean);
sites_got = bunch_of_settings.get('disable_image_these_sites') as string;
let disable_image_these_sites = (sites_got == '') ? [] : sites_got.split('\n');
AppStorage.setOrCreate('disable_image_these_sites', disable_image_these_sites);
// Disable JS
AppStorage.setOrCreate('disable_js', bunch_of_settings.get('disable_js') as boolean);
AppStorage.setOrCreate('disable_js_all_sites', bunch_of_settings.get('disable_js_all_sites') as boolean);
sites_got = bunch_of_settings.get('disable_js_these_sites') as string;
let disable_js_these_sites = (sites_got == '') ? [] : sites_got.split('\n');
AppStorage.setOrCreate('disable_js_these_sites', disable_js_these_sites);
// Ad Blocker
AppStorage.setOrCreate('use_adblock', bunch_of_settings.get('use_adblock') as boolean);
sites_got = bunch_of_settings.get('adblock_exceptions') as string;
let adblock_exceptions = (sites_got == '') ? [] : sites_got.split('\n');
AppStorage.setOrCreate('adblock_exceptions', adblock_exceptions);
// UA
AppStorage.setOrCreate('custom_user_agents', bunch_of_settings.get('custom_user_agents') as string);
AppStorage.setOrCreate('user_agent_selected', bunch_of_settings.get('custom_user_agents_selected_index') as string);
// SE
AppStorage.setOrCreate('custom_search_engines', bunch_of_settings.get('custom_search_engines') as string);
AppStorage.setOrCreate('search_engine_selected', bunch_of_settings.get('custom_search_engines_selected_index') as string);
// Downloads
AppStorage.setOrCreate('direct_download', bunch_of_settings.get('direct_download') as string);
AppStorage.setOrCreate('direct_download_auto_open', bunch_of_settings.get('direct_download_auto_open') as string);
// Cardboard Box
AppStorage.setOrCreate('resource_monitor', bunch_of_settings.get('resource_monitor') as boolean);
// Title function buttons
AppStorage.setOrCreate('title_CONFIG_EXTENSIONS', bunch_of_settings.get('title_function_extensions') as boolean);
let config_buttons_str = bunch_of_settings.get('title_function_buttons') as string;
let bool_config: boolean[] = []
for (let index = 0; index < config_buttons_str.length; index++) {
const element = config_buttons_str[index];
if (element == '1') {
bool_config.push(true);
} else {
bool_config.push(false);
}
}
while (bool_config.length < default_title_function_buttons_amount()) {
// Add defaults to the bool_config.
bool_config.splice(0, 0, false);
}
AppStorage.setOrCreate('title_CONFIG_BUTTONS', bool_config);
console.log(`[init] title_CONFIG_BUTTONS = ${bool_config}`);
// Timer
console.log('[init] Settings OK. (' + run_time(storage) + ' ms)');
}
|
AST#function_declaration#Left async function settings AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left bunch_of_settings AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // DEV_MODE AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'DEV_MODE' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'DEV_MODE' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // UI Status AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_bar_position' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_bar_position' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_style' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_style' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_style_non_tablet_mode' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_style_non_tablet_mode' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showing_my_window_alias' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_showing_my_windows_alias' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showing_my_window_alias_non_tablet' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_showing_my_windows_alias_non_tablet' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_vertical_auto_hide' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_vertical_auto_hide' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_vertical_auto_hide_button' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_vertical_auto_hide_button' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'showing_large_my_window_alias' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_showing_large_my_window_alias' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_alias_position' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_alias_position' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'effects' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'effects' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'last_zone' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'last_zone' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Continuation AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continuation_auto_exit' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continuation_auto_exit' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continuation_auto_close_tab' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continuation_auto_close_tab' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Experience - Suggestions AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'max_bookmark_advice' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'max_bookmark_suggest' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'max_history_advice' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'max_history_suggest' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Context Menu AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_enabled' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_enabled' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_image_preview' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_image_preview' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_web_preview' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_web_preview' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_image_height' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_image_height' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_web_height' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_web_height' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // History AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'collect_new_history' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'collect_new_history' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'history_index_load_quantity' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'history_index_load_quantity' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Accessibility AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sys_back_to_access_backward' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sys_back_access_backward' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'esc_to_access_backward' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'esc_to_access_backward' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_left_or_right' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_left_or_right' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_tabs_panel' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_tabs_panel' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_settings_menu' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_settings_menu' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_homepage_shortcuts' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_homepage_shortcuts' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_auto' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_auto' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Appearance - Animation AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animation_response = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_response' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animation_damping = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_damping_coefficient' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[Meow][init] Animation response: ' AST#expression#Right + AST#expression#Left animation_response AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left ', damping: ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left animation_damping AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_response' AST#expression#Right , AST#expression#Left animation_response AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_damping_coefficient' AST#expression#Right , AST#expression#Left animation_damping AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Appearance - Colors AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_primary' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_primary' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_secondary' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_secondary' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_font' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_font' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_primary' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_primary' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_secondary' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_secondary' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_font' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_font' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Appearance - Dark AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left web_force_dark_mode_exemptions = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode_exemptions' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left web_force_dark_mode_exemptions AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // Empty AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left web_force_dark_mode_exemptions_list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode_exemptions' AST#expression#Right , AST#expression#Left web_force_dark_mode_exemptions_list AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode_exemptions' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left web_force_dark_mode_exemptions AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '\n' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // Bottom avoid AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bottom_avoid' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bottom_avoid' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'navigation_indicator' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'navigation_indicator' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // General - Surf // NO NEED, as these data would be put to bunch_of_tabs // let home_url: string = bunch_of_settings.get('home_url') as string // let new_tab_url: string = bunch_of_settings.get('new_tab_url') as string // let start_up_option: string = bunch_of_settings.get('start_up_option') as string // AppStorage.setOrCreate('home_url', home_url); // AppStorage.setOrCreate('new_tab_url', new_tab_url); // AppStorage.setOrCreate('start_up_option', start_up_option); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'intelligent_tracking_prevention' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'intelligent_tracking_prevention' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'enable_third_party_cookies' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'enable_third_party_cookies' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // General - Homepage AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'homepage_shortcuts_init_height' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'homepage_shortcuts_init_height' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'homepage_shortcuts_bookmarks_dir' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'homepage_shortcuts_bookmarks_dir' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // console.log('[Meow] homepage_shortcuts_bookmarks_dir: ' + bunch_of_settings.get('homepage_shortcuts_bookmarks_dir') as string); AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sites_got : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // Disable image AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image_all_sites' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image_all_sites' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sites_got = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image_these_sites' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left disable_image_these_sites = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left sites_got AST#expression#Right == AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right : AST#expression#Left sites_got AST#expression#Right AST#conditional_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '\n' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image_these_sites' AST#expression#Right , AST#expression#Left disable_image_these_sites AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Disable JS AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js_all_sites' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js_all_sites' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sites_got = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js_these_sites' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left disable_js_these_sites = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left sites_got AST#expression#Right == AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right : AST#expression#Left sites_got AST#expression#Right AST#conditional_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '\n' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js_these_sites' AST#expression#Right , AST#expression#Left disable_js_these_sites AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Ad Blocker AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'use_adblock' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'use_adblock' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sites_got = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'adblock_exceptions' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left adblock_exceptions = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left sites_got AST#expression#Right == AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ? AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right : AST#expression#Left sites_got AST#expression#Right AST#conditional_expression#Right AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '\n' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'adblock_exceptions' AST#expression#Right , AST#expression#Left adblock_exceptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // UA AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_user_agents' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_user_agents' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'user_agent_selected' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_user_agents_selected_index' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // SE AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_search_engines' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_search_engines' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'search_engine_selected' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_search_engines_selected_index' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Downloads AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'direct_download' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'direct_download' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'direct_download_auto_open' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'direct_download_auto_open' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Cardboard Box AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'resource_monitor' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'resource_monitor' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Title function buttons AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_CONFIG_EXTENSIONS' AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_function_extensions' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left config_buttons_str = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_function_buttons' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bool_config : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left boolean [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left config_buttons_str AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left element = AST#expression#Left AST#subscript_expression#Left AST#expression#Left config_buttons_str AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left element AST#expression#Right == AST#expression#Left '1' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bool_config AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bool_config AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bool_config AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left default_title_function_buttons_amount AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // Add defaults to the bool_config. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bool_config AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_CONFIG_BUTTONS' AST#expression#Right , AST#expression#Left bool_config AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [init] title_CONFIG_BUTTONS = AST#template_substitution#Left $ { AST#expression#Left bool_config AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Timer AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[init] Settings OK. (' AST#expression#Right + AST#expression#Left run_time AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left storage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left ' ms)' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
async function settings(storage: LocalStorage) {
await bunch_of_settings.init();
AppStorage.setOrCreate('DEV_MODE', bunch_of_settings.get('DEV_MODE') as boolean);
AppStorage.setOrCreate('title_bar_position', bunch_of_settings.get('title_bar_position') as string);
AppStorage.setOrCreate('tabs_style', bunch_of_settings.get('tabs_style') as string);
AppStorage.setOrCreate('tabs_style_non_tablet_mode', bunch_of_settings.get('tabs_style_non_tablet_mode') as string);
AppStorage.setOrCreate('showing_my_window_alias', bunch_of_settings.get('status_showing_my_windows_alias') as boolean);
AppStorage.setOrCreate('showing_my_window_alias_non_tablet', bunch_of_settings.get('status_showing_my_windows_alias_non_tablet') as boolean);
AppStorage.setOrCreate('tabs_vertical_auto_hide', bunch_of_settings.get('tabs_vertical_auto_hide') as boolean);
AppStorage.setOrCreate('tabs_vertical_auto_hide_button', bunch_of_settings.get('tabs_vertical_auto_hide_button') as boolean);
AppStorage.setOrCreate('showing_large_my_window_alias', bunch_of_settings.get('status_showing_large_my_window_alias') as boolean);
AppStorage.setOrCreate('my_window_alias_position', bunch_of_settings.get('my_window_alias_position') as string);
AppStorage.setOrCreate('effects', bunch_of_settings.get('effects') as boolean);
AppStorage.setOrCreate('last_zone', bunch_of_settings.get('last_zone') as string);
AppStorage.setOrCreate('continuation_auto_exit', bunch_of_settings.get('continuation_auto_exit') as boolean);
AppStorage.setOrCreate('continuation_auto_close_tab', bunch_of_settings.get('continuation_auto_close_tab') as boolean);
AppStorage.setOrCreate('max_bookmark_advice', bunch_of_settings.get('max_bookmark_suggest') as number);
AppStorage.setOrCreate('max_history_advice', bunch_of_settings.get('max_history_suggest') as number);
AppStorage.setOrCreate('web_context_menu_enabled', bunch_of_settings.get('web_context_menu_enabled') as boolean);
AppStorage.setOrCreate('web_context_menu_image_preview', bunch_of_settings.get('web_context_menu_image_preview') as boolean);
AppStorage.setOrCreate('web_context_menu_web_preview', bunch_of_settings.get('web_context_menu_web_preview') as boolean);
AppStorage.setOrCreate('web_context_image_height', bunch_of_settings.get('web_context_image_height') as number);
AppStorage.setOrCreate('web_context_web_height', bunch_of_settings.get('web_context_web_height') as number);
AppStorage.setOrCreate('collect_new_history', bunch_of_settings.get('collect_new_history') as boolean);
AppStorage.setOrCreate('history_index_load_quantity', bunch_of_settings.get('history_index_load_quantity') as boolean);
AppStorage.setOrCreate('sys_back_to_access_backward', bunch_of_settings.get('sys_back_access_backward') as boolean);
AppStorage.setOrCreate('esc_to_access_backward', bunch_of_settings.get('esc_to_access_backward') as boolean);
AppStorage.setOrCreate('preferred_hand_left_or_right', bunch_of_settings.get('preferred_hand_left_or_right') as string);
AppStorage.setOrCreate('preferred_hand_reverse_tabs_panel', bunch_of_settings.get('preferred_hand_reverse_tabs_panel') as boolean);
AppStorage.setOrCreate('preferred_hand_reverse_settings_menu', bunch_of_settings.get('preferred_hand_reverse_settings_menu') as boolean);
AppStorage.setOrCreate('preferred_hand_reverse_homepage_shortcuts', bunch_of_settings.get('preferred_hand_reverse_homepage_shortcuts') as boolean);
AppStorage.setOrCreate('preferred_hand_auto', bunch_of_settings.get('preferred_hand_auto') as boolean);
let animation_response = bunch_of_settings.get('animation_response') as number;
let animation_damping = bunch_of_settings.get('animation_damping_coefficient') as number;
console.log('[Meow][init] Animation response: ' + animation_response.toString() + ', damping: ' + animation_damping.toString());
AppStorage.setOrCreate('animation_response', animation_response);
AppStorage.setOrCreate('animation_damping_coefficient', animation_damping);
AppStorage.setOrCreate('color_light_primary', bunch_of_settings.get('color_light_primary') as string);
AppStorage.setOrCreate('color_light_secondary', bunch_of_settings.get('color_light_secondary') as string);
AppStorage.setOrCreate('color_light_font', bunch_of_settings.get('color_light_font') as string);
AppStorage.setOrCreate('color_dark_primary', bunch_of_settings.get('color_dark_primary') as string);
AppStorage.setOrCreate('color_dark_secondary', bunch_of_settings.get('color_dark_secondary') as string);
AppStorage.setOrCreate('color_dark_font', bunch_of_settings.get('color_dark_font') as string);
AppStorage.setOrCreate('web_force_dark_mode', bunch_of_settings.get('web_force_dark_mode') as boolean);
let web_force_dark_mode_exemptions = bunch_of_settings.get('web_force_dark_mode_exemptions') as string;
if (web_force_dark_mode_exemptions.length < 2) {
let web_force_dark_mode_exemptions_list: string[] = [];
AppStorage.setOrCreate('web_force_dark_mode_exemptions', web_force_dark_mode_exemptions_list);
} else {
AppStorage.setOrCreate('web_force_dark_mode_exemptions', web_force_dark_mode_exemptions.split('\n'));
}
AppStorage.setOrCreate('bottom_avoid', bunch_of_settings.get('bottom_avoid') as boolean);
AppStorage.setOrCreate('navigation_indicator', bunch_of_settings.get('navigation_indicator') as boolean);
AppStorage.setOrCreate('intelligent_tracking_prevention', bunch_of_settings.get('intelligent_tracking_prevention') as boolean);
AppStorage.setOrCreate('enable_third_party_cookies', bunch_of_settings.get('enable_third_party_cookies') as boolean);
AppStorage.setOrCreate('homepage_shortcuts_init_height', bunch_of_settings.get('homepage_shortcuts_init_height') as number);
AppStorage.setOrCreate('homepage_shortcuts_bookmarks_dir', bunch_of_settings.get('homepage_shortcuts_bookmarks_dir') as string);
let sites_got: string;
AppStorage.setOrCreate('disable_image', bunch_of_settings.get('disable_image') as boolean);
AppStorage.setOrCreate('disable_image_all_sites', bunch_of_settings.get('disable_image_all_sites') as boolean);
sites_got = bunch_of_settings.get('disable_image_these_sites') as string;
let disable_image_these_sites = (sites_got == '') ? [] : sites_got.split('\n');
AppStorage.setOrCreate('disable_image_these_sites', disable_image_these_sites);
AppStorage.setOrCreate('disable_js', bunch_of_settings.get('disable_js') as boolean);
AppStorage.setOrCreate('disable_js_all_sites', bunch_of_settings.get('disable_js_all_sites') as boolean);
sites_got = bunch_of_settings.get('disable_js_these_sites') as string;
let disable_js_these_sites = (sites_got == '') ? [] : sites_got.split('\n');
AppStorage.setOrCreate('disable_js_these_sites', disable_js_these_sites);
AppStorage.setOrCreate('use_adblock', bunch_of_settings.get('use_adblock') as boolean);
sites_got = bunch_of_settings.get('adblock_exceptions') as string;
let adblock_exceptions = (sites_got == '') ? [] : sites_got.split('\n');
AppStorage.setOrCreate('adblock_exceptions', adblock_exceptions);
AppStorage.setOrCreate('custom_user_agents', bunch_of_settings.get('custom_user_agents') as string);
AppStorage.setOrCreate('user_agent_selected', bunch_of_settings.get('custom_user_agents_selected_index') as string);
AppStorage.setOrCreate('custom_search_engines', bunch_of_settings.get('custom_search_engines') as string);
AppStorage.setOrCreate('search_engine_selected', bunch_of_settings.get('custom_search_engines_selected_index') as string);
AppStorage.setOrCreate('direct_download', bunch_of_settings.get('direct_download') as string);
AppStorage.setOrCreate('direct_download_auto_open', bunch_of_settings.get('direct_download_auto_open') as string);
AppStorage.setOrCreate('resource_monitor', bunch_of_settings.get('resource_monitor') as boolean);
AppStorage.setOrCreate('title_CONFIG_EXTENSIONS', bunch_of_settings.get('title_function_extensions') as boolean);
let config_buttons_str = bunch_of_settings.get('title_function_buttons') as string;
let bool_config: boolean[] = []
for (let index = 0; index < config_buttons_str.length; index++) {
const element = config_buttons_str[index];
if (element == '1') {
bool_config.push(true);
} else {
bool_config.push(false);
}
}
while (bool_config.length < default_title_function_buttons_amount()) {
bool_config.splice(0, 0, false);
}
AppStorage.setOrCreate('title_CONFIG_BUTTONS', bool_config);
console.log(`[init] title_CONFIG_BUTTONS = ${bool_config}`);
console.log('[init] Settings OK. (' + run_time(storage) + ' ms)');
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L251-L404
|
86cddaed429b7802adc75f79156d25bc1c22a6b8
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets
|
arkts
|
getDashPathEffect
|
returns the DashPathEffect that is set for this LimitLine
@return
|
public getDashPathEffect(): DashPathEffect {
return this.mDashPathEffect;
}
|
AST#method_declaration#Left public getDashPathEffect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDashPathEffect AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getDashPathEffect(): DashPathEffect {
return this.mDashPathEffect;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L140-L142
|
9cecdfef2789f4099abbe3c6dc31764fdc2d25e5
|
gitee
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
|
arkts
|
encodeText
|
Returns a QR Code representing the given Unicode text string at the given error correction level. As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
public static encodeText(text: string, ecl: QrCode.Ecc): QrCode {
const segs: Array<QrSegment> = qrcodegen.QrSegment.makeSegments(text);
return QrCode.encodeSegments(segs, ecl);
}
|
AST#method_declaration#Left public static encodeText AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ecl : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left QrCode . Ecc AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left QrCode AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left segs : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left QrSegment AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left qrcodegen AST#expression#Right . QrSegment AST#member_expression#Right AST#expression#Right . makeSegments AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left text AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left QrCode AST#expression#Right . encodeSegments AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left segs AST#expression#Right , AST#expression#Left ecl AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static encodeText(text: string, ecl: QrCode.Ecc): QrCode {
const segs: Array<QrSegment> = qrcodegen.QrSegment.makeSegments(text);
return QrCode.encodeSegments(segs, ecl);
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets#L61-L64
|
9310c961f79232b1b3ded5190cd036230590d00b
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets
|
arkts
|
alignment
|
弹窗滑出方向
@description 默认为true
@param autoCancel
@returns
|
alignment(alignment: DialogAlignment) {
this.builderOptions.alignment = alignment;
return this;
}
|
AST#method_declaration#Left alignment AST#parameter_list#Left ( AST#parameter#Left alignment : AST#type_annotation#Left AST#primary_type#Left DialogAlignment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . alignment AST#member_expression#Right = AST#expression#Left alignment AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
alignment(alignment: DialogAlignment) {
this.builderOptions.alignment = alignment;
return this;
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L99-L102
|
8fce26d90526acdb683c2ffe9166f4ec1707e2cc
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets
|
arkts
|
getBuilderNode
|
获取BuilderNode节点
|
getBuilderNode(): BuilderNode<[Params]> | undefined | null {
return this.rootNode;
}
|
AST#method_declaration#Left getBuilderNode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left BuilderNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left Params AST#primary_type#Right AST#type_annotation#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getBuilderNode(): BuilderNode<[Params]> | undefined | null {
return this.rootNode;
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets#L103-L105
|
d9a206c8f95bc36c2fbdcade1a63d64bbac3a21b
|
gitee
|
lime-zz/Ark-ui_RubbishRecycleApp.git
|
c2a9bff8fbb5bc46d922934afad0327cc1696969
|
rubbish/rubbish/entry/src/main/ets/pages/Shoucang.ets
|
arkts
|
aboutToAppear
|
页面加载时获取收藏数据
|
aboutToAppear() {
this.getCollectData();
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCollectData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear() {
this.getCollectData();
}
|
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Shoucang.ets#L90-L92
|
e59c589de7b27e7bc5b95a13bb71038e5e5228ea
|
github
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/ciphers/MorseCode.ets
|
arkts
|
decode
|
将摩斯密码转换为文本
@param morse 摩斯密码字符串
@returns 原始文本
|
static decode(morse: string): string {
if (!morse) {
return '';
}
return morse.split(' ').map(code => {
const char = MorseCode.REVERSE_MORSE_CODE_MAP.get(code);
return char || code;
}).join('');
}
|
AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left morse : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left morse AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left morse AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ' ' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left code => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left char = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MorseCode AST#expression#Right . REVERSE_MORSE_CODE_MAP AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left code AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right || AST#expression#Left code AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static decode(morse: string): string {
if (!morse) {
return '';
}
return morse.split(' ').map(code => {
const char = MorseCode.REVERSE_MORSE_CODE_MAP.get(code);
return char || code;
}).join('');
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/MorseCode.ets#L45-L54
|
e5838059ed65023729b3cb0594b3f3aecc7d5d8c
|
github
|
junw2024/hnchain-ArkTs.git
|
0cc3c182ad418709b577fa24e9fe909a205232c6
|
entry/src/main/ets/common/utils/http/HttpUtils.ets
|
arkts
|
handleResult
|
导出httpRequest请求函数
|
function handleResult(responseResult:Promise<http.HttpResponse>): Promise<Response> {
let response = new Response();
return responseResult.then((val: http.HttpResponse)=>{
if(val.responseCode === http.ResponseCode.OK) {
let res: Response = JSON.parse(`${val.result}`)
return res
}else {
response.msg = 'http request error!';
response.code = 400;
Logger.error("http request error:"+JSON.stringify(val))
}
return response
}).catch((err)=>{
response.msg = 'http request unknown error!';
response.code = 400;
Logger.error("http request unknown error:"+JSON.stringify(err))
return response
})
}
|
AST#function_declaration#Left function handleResult AST#parameter_list#Left ( AST#parameter#Left responseResult : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Response AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left response = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Response AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left responseResult AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left val AST#expression#Right . responseCode AST#member_expression#Right AST#expression#Right === AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . ResponseCode AST#member_expression#Right AST#expression#Right . OK AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left res : AST#type_annotation#Left AST#primary_type#Left Response AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left val AST#expression#Right . result AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left res AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . msg AST#member_expression#Right = AST#expression#Left 'http request error!' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right = AST#expression#Left 400 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "http request error:" AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left val AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left response AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . msg AST#member_expression#Right = AST#expression#Left 'http request unknown error!' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . code AST#member_expression#Right = AST#expression#Left 400 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "http request unknown error:" AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left response AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function handleResult(responseResult:Promise<http.HttpResponse>): Promise<Response> {
let response = new Response();
return responseResult.then((val: http.HttpResponse)=>{
if(val.responseCode === http.ResponseCode.OK) {
let res: Response = JSON.parse(`${val.result}`)
return res
}else {
response.msg = 'http request error!';
response.code = 400;
Logger.error("http request error:"+JSON.stringify(val))
}
return response
}).catch((err)=>{
response.msg = 'http request unknown error!';
response.code = 400;
Logger.error("http request unknown error:"+JSON.stringify(err))
return response
})
}
|
https://github.com/junw2024/hnchain-ArkTs.git/blob/0cc3c182ad418709b577fa24e9fe909a205232c6/entry/src/main/ets/common/utils/http/HttpUtils.ets#L8-L26
|
07781cae33cab2e0b6e923ce729eae1e461073d8
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets
|
arkts
|
signPKCS1
|
签名-PKCS1
@param str 需要签名的字符串
@param priKey 私钥
@returns OutDTO<string> 签名对象
|
static async signPKCS1(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.sign(str, priKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024);
}
|
AST#method_declaration#Left static async signPKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . sign AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'RSA1024' AST#expression#Right , AST#expression#Left 'RSA1024|PKCS1|SHA256' AST#expression#Right , AST#expression#Left 1024 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async signPKCS1(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.sign(str, priKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L124-L126
|
c1082b23cb4fdaae198b7bb24c4850363626b4bb
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
|
arkts
|
getDataSync
|
读取系统剪贴板内容
@returns
|
static getDataSync(): pasteboard.PasteData {
return PasteboardUtil.getSystemPasteboard().getDataSync();
}
|
AST#method_declaration#Left static getDataSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . PasteData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil AST#expression#Right . getSystemPasteboard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getDataSync(): pasteboard.PasteData {
return PasteboardUtil.getSystemPasteboard().getDataSync();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L100-L102
|
33ae00c4a59453e69d16dc349579723c9307c113
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/storage/PreferencesService.ets
|
arkts
|
checkInitialized
|
检查是否已初始化
|
private checkInitialized(): void {
if (!this.initialized || !this.dataPreferences) {
throw new Error('PreferencesService not initialized. Call initialize() first.');
}
}
|
AST#method_declaration#Left private checkInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . initialized AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . dataPreferences AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'PreferencesService not initialized. Call initialize() first.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private checkInitialized(): void {
if (!this.initialized || !this.dataPreferences) {
throw new Error('PreferencesService not initialized. Call initialize() first.');
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L53-L57
|
2e6b5d886f944cb1caba757386392f8c6568f78a
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets
|
arkts
|
encodeAsym
|
非对称加密
@param encodeStr 待加密的字符串
@param pubKey 给定秘钥规格公钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
|
static async encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
//将公钥转换
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
//生成加密器
let encoder = crypto.createCipher(symEncryptName);
//初始化加密环境
await encoder.init(crypto.CryptoMode.ENCRYPT_MODE, pubPair.pubKey, null);
//封装加密所需数据
let encode = new util.TextEncoder();
//开始加密
let updateOutput = await encoder.doFinal({ data: encode.encodeInto(str) });
//转换字符串
let result = StrAndUintUtil.unitArray2String(updateOutput.data);
// if (symAlgName.indexOf('SM2') >= 0 || symEncryptName.indexOf('SM2') >= 0) {
// result = StrAndUintUtil.unitArray2String(updateOutput.data, true);
// } else {
// result = StrAndUintUtil.unitArray2String(updateOutput.data);
// }
return OutDTO.OKByDataRow(symAlgName + '加密成功~', result);
}
|
AST#method_declaration#Left static async encodeAsym AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symEncryptName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyName : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //将公钥转换 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pubPair = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left CryptoUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . convertPubKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pubKey AST#expression#Right , AST#expression#Left symAlgName AST#expression#Right , AST#expression#Left keyName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //生成加密器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symEncryptName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //初始化加密环境 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left encoder AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left pubPair AST#expression#Right . pubKey AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //封装加密所需数据 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . TextEncoder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //开始加密 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left encoder AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encode AST#expression#Right . encodeInto AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2String AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // if (symAlgName.indexOf('SM2') >= 0 || symEncryptName.indexOf('SM2') >= 0) { // result = StrAndUintUtil.unitArray2String(updateOutput.data, true); // } else { // result = StrAndUintUtil.unitArray2String(updateOutput.data); // } AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left symAlgName AST#expression#Right + AST#expression#Left '加密成功~' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
let encoder = crypto.createCipher(symEncryptName);
await encoder.init(crypto.CryptoMode.ENCRYPT_MODE, pubPair.pubKey, null);
let encode = new util.TextEncoder();
let updateOutput = await encoder.doFinal({ data: encode.encodeInto(str) });
let result = StrAndUintUtil.unitArray2String(updateOutput.data);
return OutDTO.OKByDataRow(symAlgName + '加密成功~', result);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L223-L242
|
4ecccb5616415c08dfab0a5450f725afcfd80042
|
gitee
|
Rayawa/dashboard.git
|
9107efe7fb69a58d799a378b79ea8ffa4041cec8
|
entry/src/main/ets/pages/user/settings.ets
|
arkts
|
aboutToAppear
|
页面显示时加载设置
|
async aboutToAppear() {
initializeSettings();
await this.loadSettings();
isTSiteDev().then((val) => {
if (!val) {
return;
}
this.isTDev = true;
});
}
|
AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left initializeSettings ( ) ; AST#ui_custom_component_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . loadSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left isTSiteDev ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . then ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left val AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left val AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isTDev AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
async aboutToAppear() {
initializeSettings();
await this.loadSettings();
isTSiteDev().then((val) => {
if (!val) {
return;
}
this.isTDev = true;
});
}
|
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L112-L121
|
7246fbe10b5fb3ab2d128e322cacf7484bd968ae
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets
|
arkts
|
drawMask
|
绘制蒙层
|
drawMask() {
this.maskContext.clearRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.fillStyle = 'rgba(0,0,0,0.7)';
this.maskContext.fillRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.clearRect(this.clipRect.x - this.imageArea.x, this.clipRect.y - this.imageArea.y,
this.clipRect.width, this.clipRect.height);
}
|
AST#method_declaration#Left drawMask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskContext AST#member_expression#Right AST#expression#Right . clearRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArea AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArea AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskContext AST#member_expression#Right AST#expression#Right . fillStyle AST#member_expression#Right = AST#expression#Left 'rgba(0,0,0,0.7)' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskContext AST#member_expression#Right AST#expression#Right . fillRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArea AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageArea AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskContext AST#member_expression#Right AST#expression#Right . clearRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clipRect AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageArea AST#member_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clipRect AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageArea AST#member_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clipRect AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clipRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
drawMask() {
this.maskContext.clearRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.fillStyle = 'rgba(0,0,0,0.7)';
this.maskContext.fillRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.clearRect(this.clipRect.x - this.imageArea.x, this.clipRect.y - this.imageArea.y,
this.clipRect.width, this.clipRect.height);
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets#L288-L294
|
087523006f504644dcec441faadd1e116e6a19f3
|
github
|
kumaleap/ArkSwipeDeck.git
|
5afa77b9b2a2a531595d31f895c54a3371e4249a
|
library/src/main/ets/types/SwipeCardTypes.ets
|
arkts
|
卡片滑动回调函数类型
@param direction - 滑动方向
@param data - 卡片数据对象
@param index - 卡片在数组中的索引
|
export type OnCardSwipedCallback = (direction: SwipeDirection, data: object, index: number) => void;
|
AST#export_declaration#Left export AST#type_declaration#Left type OnCardSwipedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left direction : AST#type_annotation#Left AST#primary_type#Left SwipeDirection AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export type OnCardSwipedCallback = (direction: SwipeDirection, data: object, index: number) => void;
|
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L50-L50
|
b9c341f66493eae7a7e6160b8ac90edfb1671af5
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/widgets/pages/WidgetCard2x2.ets
|
arkts
|
onWidgetClick
|
点击事件处理
|
private onWidgetClick(): void {
if (this.widgetData.hasData && this.widgetData.contactId) {
// 打开联系人详情
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'viewContact',
contactId: this.widgetData.contactId
}
});
} else {
// 打开主应用
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'openApp'
}
});
}
}
|
AST#method_declaration#Left private onWidgetClick AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widgetData AST#member_expression#Right AST#expression#Right . hasData AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . widgetData AST#member_expression#Right AST#expression#Right . contactId AST#member_expression#Right AST#expression#Right ) { // 打开联系人详情 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left postCardAction ( AST#expression#Left this AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'router' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'EntryAbility' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'viewContact' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contactId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widgetData AST#member_expression#Right AST#expression#Right . contactId AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } else { // 打开主应用 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left postCardAction ( AST#expression#Left this AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'router' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left 'EntryAbility' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left 'openApp' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private onWidgetClick(): void {
if (this.widgetData.hasData && this.widgetData.contactId) {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'viewContact',
contactId: this.widgetData.contactId
}
});
} else {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'openApp'
}
});
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x2.ets#L202-L223
|
cd34dfc53e6ee400f01171f9b77f11acf7c890c8
|
github
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/service/PodcastService.ets
|
arkts
|
addPodcastByUrl
|
通过RSS URL添加播客
|
async addPodcastByUrl(feedUrl: string): Promise<Podcast> {
// 获取RSS内容
const rssContent = await this.fetchRssFeed(feedUrl);
// 解析RSS
const podcast = this.parseRssFeed(rssContent, feedUrl);
// 保存到数据库
podcast.subscribeDate = Date.now();
podcast.isSubscribed = true;
await this.dbService.insertPodcast(podcast);
// 获取并保存Episodes
await this.updatePodcastEpisodes(podcast.id);
return podcast;
}
|
AST#method_declaration#Left async addPodcastByUrl AST#parameter_list#Left ( AST#parameter#Left feedUrl : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Podcast AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 获取RSS内容 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rssContent = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchRssFeed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left feedUrl AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 解析RSS AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left podcast = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parseRssFeed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rssContent AST#expression#Right , AST#expression#Left feedUrl AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 保存到数据库 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . subscribeDate AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . isSubscribed AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . insertPodcast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left podcast AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 获取并保存Episodes AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . updatePodcastEpisodes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left podcast AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async addPodcastByUrl(feedUrl: string): Promise<Podcast> {
const rssContent = await this.fetchRssFeed(feedUrl);
const podcast = this.parseRssFeed(rssContent, feedUrl);
podcast.subscribeDate = Date.now();
podcast.isSubscribed = true;
await this.dbService.insertPodcast(podcast);
await this.updatePodcastEpisodes(podcast.id);
return podcast;
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L29-L45
|
ec6b980b00a950ea588471d7adc5a31284b5418e
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/DetailConstant.ets
|
arkts
|
Detail page constant description.
|
export class DetailConstant {
/**
* detail page day data.
*/
static readonly DAY_DATA: DayDataBean[] = [
{ timeType: 0, delSelect: 0, data: ['上午', '下午'] } as DayDataBean,
{ timeType: 1, delSelect: 0, data:
[
'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'
]
} as DayDataBean,
{ timeType: 2, delSelect: 0, data:
[
'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24',
'25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36',
'37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48',
'49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '00',
]
} as DayDataBean
];
/**
* week day data.
*/
static readonly WEEKDAY_DATA: number[] = [1, 2, 3, 4, 5, 6, 7];
/**
* ring duration list data.
*/
static readonly RING_DURATION: number[] = [1, 5, 10, 15, 20, 30];
/**
* default string minute.
*/
static readonly DEFAULT_STRING_MINUTE: string = '分钟';
/**
* default string group name.
*/
static readonly DEFAULT_STRING_GROUP_NAME: string = 'radioGroup';
/**
* default string provider key.
*/
static readonly DEFAULT_PROVIDER_KEY: string = 'alarmItemProvide';
/**
* default string repeat.
*/
static readonly DEFAULT_STRING_REPEAT: string = '重复';
/**
* default string alarm name.
*/
static readonly DEFAULT_STRING_ALARM_NAME: string = '闹钟名';
/**
* default string interval.
*/
static readonly DEFAULT_STRING_INTERVAL: string = '再响间隔';
/**
* default string duration.
*/
static readonly DEFAULT_STRING_DURATION: string = '闹铃时长';
/**
* default string times.
*/
static readonly DEFAULT_STRING_TIMES: string = '次';
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DetailConstant AST#class_body#Left { /**
* detail page day data.
*/ AST#property_declaration#Left static readonly DAY_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DayDataBean [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left timeType AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delSelect AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '上午' AST#expression#Right , AST#expression#Left '下午' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left DayDataBean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left timeType AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delSelect AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '01' AST#expression#Right , AST#expression#Left '02' AST#expression#Right , AST#expression#Left '03' AST#expression#Right , AST#expression#Left '04' AST#expression#Right , AST#expression#Left '05' AST#expression#Right , AST#expression#Left '06' AST#expression#Right , AST#expression#Left '07' AST#expression#Right , AST#expression#Left '08' AST#expression#Right , AST#expression#Left '09' AST#expression#Right , AST#expression#Left '10' AST#expression#Right , AST#expression#Left '11' AST#expression#Right , AST#expression#Left '12' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left DayDataBean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left timeType AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delSelect AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '01' AST#expression#Right , AST#expression#Left '02' AST#expression#Right , AST#expression#Left '03' AST#expression#Right , AST#expression#Left '04' AST#expression#Right , AST#expression#Left '05' AST#expression#Right , AST#expression#Left '06' AST#expression#Right , AST#expression#Left '07' AST#expression#Right , AST#expression#Left '08' AST#expression#Right , AST#expression#Left '09' AST#expression#Right , AST#expression#Left '10' AST#expression#Right , AST#expression#Left '11' AST#expression#Right , AST#expression#Left '12' AST#expression#Right , AST#expression#Left '13' AST#expression#Right , AST#expression#Left '14' AST#expression#Right , AST#expression#Left '15' AST#expression#Right , AST#expression#Left '16' AST#expression#Right , AST#expression#Left '17' AST#expression#Right , AST#expression#Left '18' AST#expression#Right , AST#expression#Left '19' AST#expression#Right , AST#expression#Left '20' AST#expression#Right , AST#expression#Left '21' AST#expression#Right , AST#expression#Left '22' AST#expression#Right , AST#expression#Left '23' AST#expression#Right , AST#expression#Left '24' AST#expression#Right , AST#expression#Left '25' AST#expression#Right , AST#expression#Left '26' AST#expression#Right , AST#expression#Left '27' AST#expression#Right , AST#expression#Left '28' AST#expression#Right , AST#expression#Left '29' AST#expression#Right , AST#expression#Left '30' AST#expression#Right , AST#expression#Left '31' AST#expression#Right , AST#expression#Left '32' AST#expression#Right , AST#expression#Left '33' AST#expression#Right , AST#expression#Left '34' AST#expression#Right , AST#expression#Left '35' AST#expression#Right , AST#expression#Left '36' AST#expression#Right , AST#expression#Left '37' AST#expression#Right , AST#expression#Left '38' AST#expression#Right , AST#expression#Left '39' AST#expression#Right , AST#expression#Left '40' AST#expression#Right , AST#expression#Left '41' AST#expression#Right , AST#expression#Left '42' AST#expression#Right , AST#expression#Left '43' AST#expression#Right , AST#expression#Left '44' AST#expression#Right , AST#expression#Left '45' AST#expression#Right , AST#expression#Left '46' AST#expression#Right , AST#expression#Left '47' AST#expression#Right , AST#expression#Left '48' AST#expression#Right , AST#expression#Left '49' AST#expression#Right , AST#expression#Left '50' AST#expression#Right , AST#expression#Left '51' AST#expression#Right , AST#expression#Left '52' AST#expression#Right , AST#expression#Left '53' AST#expression#Right , AST#expression#Left '54' AST#expression#Right , AST#expression#Left '55' AST#expression#Right , AST#expression#Left '56' AST#expression#Right , AST#expression#Left '57' AST#expression#Right , AST#expression#Left '58' AST#expression#Right , AST#expression#Left '59' AST#expression#Right , AST#expression#Left '00' AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left DayDataBean AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* week day data.
*/ AST#property_declaration#Left static readonly WEEKDAY_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 6 AST#expression#Right , AST#expression#Left 7 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* ring duration list data.
*/ AST#property_declaration#Left static readonly RING_DURATION : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left 15 AST#expression#Right , AST#expression#Left 20 AST#expression#Right , AST#expression#Left 30 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* default string minute.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_MINUTE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '分钟' AST#expression#Right ; AST#property_declaration#Right /**
* default string group name.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_GROUP_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'radioGroup' AST#expression#Right ; AST#property_declaration#Right /**
* default string provider key.
*/ AST#property_declaration#Left static readonly DEFAULT_PROVIDER_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'alarmItemProvide' AST#expression#Right ; AST#property_declaration#Right /**
* default string repeat.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_REPEAT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '重复' AST#expression#Right ; AST#property_declaration#Right /**
* default string alarm name.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_ALARM_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '闹钟名' AST#expression#Right ; AST#property_declaration#Right /**
* default string interval.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_INTERVAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '再响间隔' AST#expression#Right ; AST#property_declaration#Right /**
* default string duration.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_DURATION : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '闹铃时长' AST#expression#Right ; AST#property_declaration#Right /**
* default string times.
*/ AST#property_declaration#Left static readonly DEFAULT_STRING_TIMES : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '次' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DetailConstant {
static readonly DAY_DATA: DayDataBean[] = [
{ timeType: 0, delSelect: 0, data: ['上午', '下午'] } as DayDataBean,
{ timeType: 1, delSelect: 0, data:
[
'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'
]
} as DayDataBean,
{ timeType: 2, delSelect: 0, data:
[
'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12',
'13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24',
'25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36',
'37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48',
'49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '00',
]
} as DayDataBean
];
static readonly WEEKDAY_DATA: number[] = [1, 2, 3, 4, 5, 6, 7];
static readonly RING_DURATION: number[] = [1, 5, 10, 15, 20, 30];
static readonly DEFAULT_STRING_MINUTE: string = '分钟';
static readonly DEFAULT_STRING_GROUP_NAME: string = 'radioGroup';
static readonly DEFAULT_PROVIDER_KEY: string = 'alarmItemProvide';
static readonly DEFAULT_STRING_REPEAT: string = '重复';
static readonly DEFAULT_STRING_ALARM_NAME: string = '闹钟名';
static readonly DEFAULT_STRING_INTERVAL: string = '再响间隔';
static readonly DEFAULT_STRING_DURATION: string = '闹铃时长';
static readonly DEFAULT_STRING_TIMES: string = '次';
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/DetailConstant.ets#L20-L81
|
14277d898f3e0367854205078badb52dde5c6972
|
gitee
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_rcp/src/main/ets/rcp/EfRcp.ets
|
arkts
|
私有化构造
|
private constructor() {
}
|
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right
|
private constructor() {
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L77-L78
|
99dc3bcaa283f1e7bf86715285a2a6a8369ff5a7
|
gitee
|
|
wasd09090030/MyHongmengProject.git
|
a8ed386b658ceeac69ef5bc42a92d78c7980821c
|
entry/src/main/ets/models/TaskModel.ets
|
arkts
|
clearAll
|
清除所有数据
|
static async clearAll(): Promise<void> {
if (!DataStorage.prefsInstance) {
console.error('Preferences not initialized');
return;
}
try {
await DataStorage.prefsInstance.clear();
await DataStorage.prefsInstance.flush();
console.info('All data cleared successfully');
} catch (err) {
console.error('Failed to clear data: ' + JSON.stringify(err));
}
}
|
AST#method_declaration#Left static async clearAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left DataStorage AST#expression#Right AST#unary_expression#Right AST#expression#Right . prefsInstance AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Preferences not initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left DataStorage AST#expression#Right AST#await_expression#Right AST#expression#Right . prefsInstance AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left DataStorage AST#expression#Right AST#await_expression#Right AST#expression#Right . prefsInstance AST#member_expression#Right AST#expression#Right . flush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'All data cleared successfully' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Failed to clear data: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async clearAll(): Promise<void> {
if (!DataStorage.prefsInstance) {
console.error('Preferences not initialized');
return;
}
try {
await DataStorage.prefsInstance.clear();
await DataStorage.prefsInstance.flush();
console.info('All data cleared successfully');
} catch (err) {
console.error('Failed to clear data: ' + JSON.stringify(err));
}
}
|
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L102-L114
|
85f9a94b293959d8543f7bcfe4b6c503ef3a3bdb
|
github
|
huang7855196/ArkTs-iLearn.git
|
08590adaca7a58d5284416ba5cfc09117122af84
|
HomeModule/src/main/ets/view/BannerView.ets
|
arkts
|
BannerView
|
@desc:广告
@author:hxy
@date:2024/2/17
|
@Component
export struct BannerView {
build() {
Swiper() {
Flex() {
Image('/images/banner_ai.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
Flex() {
Image('/images/banner_pj.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
Flex() {
Image('/images/banner_qa.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
}
.autoPlay(true)
.indicator(false)
.aspectRatio(2.8)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BannerView AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Swiper ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left '/images/banner_ai.png' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Fill AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left '/images/banner_pj.png' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Fill AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left '/images/banner_qa.png' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Fill AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left dp AST#expression#Right AST#argument_list#Left ( AST#expression#Left 15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . autoPlay ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . indicator ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 2.8 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct BannerView {
build() {
Swiper() {
Flex() {
Image('/images/banner_ai.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
Flex() {
Image('/images/banner_pj.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
Flex() {
Image('/images/banner_qa.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
}
.autoPlay(true)
.indicator(false)
.aspectRatio(2.8)
}
}
|
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/view/BannerView.ets#L7-L34
|
8aae57afd1d1708978d720c8eb7ae3f0a1102aec
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.