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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_rcp/src/main/ets/rcp/RcpLogInterceptor.ets
|
arkts
|
@Author csx
@DateTime 2024/7/24 00:02
@TODO RcpInterceptor rcp日志拦截器配置
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_rcp
|
export class RcpLogInterceptor implements rcp.Interceptor {
/**
* 拦截核心
* @param context
* @param next
* @returns
*/
async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> {
Logger.init('efRcp', getContext(), 0xFF00);
try {
//获取当前请求url
const url = context.request.url.href;
//获取请求缓存对象
const requestFromCache = CacheUtil.get<rcp.Request>(url);
if (!requestFromCache) {
//请求存入缓存
CacheUtil.save<rcp.Request>(url, context.request);
}
if (efRcpConfig.logger.enable) {
Logger.debug("--------请求信息---------", "");
Logger.debug("--------请求URL:", (context.request.url.href));
Logger.debug("--------请求方式:", context.request.method);
if (context.request.headers) {
Logger.debug("--------请求 头:", JSONObject.toJSONString(context.request.headers as object));
}
if (context.request.cookies) {
Logger.debug("--------请求cookie:", JSONObject.toJSONString(context.request.cookies as object));
}
if (context.request.content) {
Logger.debug("--------请求入参:", context.request.content.toString() as string);
}
}
//获取响应结果
const response = await next.handle(context);
if (efRcpConfig.logger.enable) {
//是否开启打印日志
Logger.debug("--------响应信息---------", "");
Logger.debug("--------响应状态:", response.statusCode + "");
Logger.debug("--------响应内容:", response.toString() as string);
}
return response;
} catch (error) {
//抛出
return Promise.reject(error);
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class RcpLogInterceptor AST#implements_clause#Left implements AST#implements_clause#Right AST#ERROR#Left AST#qualified_type#Left rcp . Interceptor AST#qualified_type#Right AST#ERROR#Right AST#class_body#Left { /**
* 拦截核心
* @param context
* @param next
* @returns
*/ AST#method_declaration#Left async intercept AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . RequestContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left next : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . RequestHandler 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Response 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#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 . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'efRcp' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left 0xFF00 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 { //获取当前请求url AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left url = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . url AST#member_expression#Right AST#expression#Right . href 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 requestFromCache = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CacheUtil AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Request AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url 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#unary_expression#Left ! AST#expression#Left requestFromCache AST#expression#Right AST#unary_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 CacheUtil AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . Request AST#qualified_type#Right 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 AST#member_expression#Left AST#expression#Left context AST#expression#Right . request 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcpConfig AST#expression#Right . logger AST#member_expression#Right AST#expression#Right . enable 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------请求信息---------" 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#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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------请求URL:" AST#expression#Right , AST#expression#Left AST#parenthesized_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 context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . url AST#member_expression#Right AST#expression#Right . href AST#member_expression#Right AST#expression#Right ) AST#parenthesized_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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------请求方式:" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . method 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . headers 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------请求 头:" AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . toJSONString 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 AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left object 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#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . cookies 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------请求cookie:" AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSONObject AST#expression#Right . toJSONString 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 AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . cookies AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left object 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#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . content 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------请求入参:" 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . request AST#member_expression#Right AST#expression#Right . content AST#member_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 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#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#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 next AST#expression#Right AST#await_expression#Right AST#expression#Right . handle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efRcpConfig AST#expression#Right . logger AST#member_expression#Right AST#expression#Right . enable 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------响应信息---------" 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#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 . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------响应状态:" AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . statusCode AST#member_expression#Right AST#expression#Right + AST#expression#Left "" 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 Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "--------响应内容:" 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 response 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 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#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#catch_clause#Left catch ( error ) 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 Promise AST#expression#Right . reject 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#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 AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class RcpLogInterceptor implements rcp.Interceptor {
async intercept(context: rcp.RequestContext, next: rcp.RequestHandler): Promise<rcp.Response> {
Logger.init('efRcp', getContext(), 0xFF00);
try {
const url = context.request.url.href;
const requestFromCache = CacheUtil.get<rcp.Request>(url);
if (!requestFromCache) {
CacheUtil.save<rcp.Request>(url, context.request);
}
if (efRcpConfig.logger.enable) {
Logger.debug("--------请求信息---------", "");
Logger.debug("--------请求URL:", (context.request.url.href));
Logger.debug("--------请求方式:", context.request.method);
if (context.request.headers) {
Logger.debug("--------请求 头:", JSONObject.toJSONString(context.request.headers as object));
}
if (context.request.cookies) {
Logger.debug("--------请求cookie:", JSONObject.toJSONString(context.request.cookies as object));
}
if (context.request.content) {
Logger.debug("--------请求入参:", context.request.content.toString() as string);
}
}
const response = await next.handle(context);
if (efRcpConfig.logger.enable) {
Logger.debug("--------响应信息---------", "");
Logger.debug("--------响应状态:", response.statusCode + "");
Logger.debug("--------响应内容:", response.toString() as string);
}
return response;
} catch (error) {
return Promise.reject(error);
}
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/RcpLogInterceptor.ets#L29-L75
|
ac096276d83fb5dbe87563a05beb6efc8ab01313
|
gitee
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Data/NotePadOpenHarmony/entry/src/main/ets/common/constants/StyleConstants.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 default class StyleConstants {
/**
* Full height.
*/
static readonly FULL_HEIGHT: string = '100%';
/**
* Full width.
*/
static readonly FULL_WIDTH: string = '100%';
/**
* Content width.
*/
static readonly CONTENT_WIDTH: string = '87%';
/**
* TextInput width.
*/
static readonly TEXT_INPUT_WIDTH: string = '93%';
/**
* Memo list space.
*/
static readonly MEMO_LIST_SPACE: string = '12';
/**
* Note content height.
*/
static readonly NOTE_CONTENT_HEIGHT: string = '90%';
/**
* Dialog content width.
*/
static readonly DIALOG_CONTENT_WIDTH: string = '93%';
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /**
* Full height.
*/ AST#property_declaration#Left static readonly FULL_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /**
* Full width.
*/ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /**
* Content width.
*/ AST#property_declaration#Left static readonly CONTENT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '87%' AST#expression#Right ; AST#property_declaration#Right /**
* TextInput width.
*/ AST#property_declaration#Left static readonly TEXT_INPUT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '93%' AST#expression#Right ; AST#property_declaration#Right /**
* Memo list space.
*/ AST#property_declaration#Left static readonly MEMO_LIST_SPACE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '12' AST#expression#Right ; AST#property_declaration#Right /**
* Note content height.
*/ AST#property_declaration#Left static readonly NOTE_CONTENT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /**
* Dialog content width.
*/ AST#property_declaration#Left static readonly DIALOG_CONTENT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '93%' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class StyleConstants {
static readonly FULL_HEIGHT: string = '100%';
static readonly FULL_WIDTH: string = '100%';
static readonly CONTENT_WIDTH: string = '87%';
static readonly TEXT_INPUT_WIDTH: string = '93%';
static readonly MEMO_LIST_SPACE: string = '12';
static readonly NOTE_CONTENT_HEIGHT: string = '90%';
static readonly DIALOG_CONTENT_WIDTH: string = '93%';
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/common/constants/StyleConstants.ets#L16-L51
|
ec720b2d0368b18a98c21e37299deb4ffae182f3
|
gitee
|
|
RicardoWesleyli/HarmonyNEXT_Examples.git
|
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
|
Chapter6/entry/src/main/ets/pages/Index.ets
|
arkts
|
textView
|
文字组件代码块
|
@Builder
textView(text:string,size:number,weight:number,color:Color){
Text(text)
.fontSize(size)
.fontWeight(weight)
.fontColor(color)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right textView 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 size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left weight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left Color 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 Text ( AST#expression#Left text AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left size AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left weight AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left color 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
textView(text:string,size:number,weight:number,color:Color){
Text(text)
.fontSize(size)
.fontWeight(weight)
.fontColor(color)
}
|
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L93-L99
|
422de6cb03ef86a7ed7dcd5ad21b9dbea8452f6f
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets
|
arkts
|
onChangeIsModeBol
|
After pausing, click 'stop' to reset the pause to default
|
onChangeIsModeBol() {
}
|
AST#method_declaration#Left onChangeIsModeBol AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
|
onChangeIsModeBol() {
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets#L139-L140
|
565c51507495218e1cc5dd4581680292cde5a2c0
|
gitee
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
src/main/ets/ffmpeg/FFMpegUtils.ets
|
arkts
|
convertVideo
|
便捷方法:视频格式转换
@param inputPath 输入文件路径或URL
@param outputPath 输出文件路径
@param onProgress 进度回调
@returns Promise
|
static convertVideo(
inputPath: string,
outputPath: string,
onProgress?: (progress: number) => void
): Promise<number> {
return FFMpegUtils.executeFFmpegCommand({
cmds: ['-i', inputPath, '-c:v', 'libx264', '-c:a', 'aac', outputPath],
onFFmpegProgress: onProgress || ((progress) => {
console.log(`Progress: ${progress}%`);
}),
onFFmpegFail: (code, msg) => {
console.error(`Conversion failed: ${code} - ${msg}`);
},
onFFmpegSuccess: () => {
console.log('Conversion succeeded!');
}
});
}
|
AST#method_declaration#Left static convertVideo AST#parameter_list#Left ( AST#parameter#Left inputPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outputPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left progress : 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#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 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#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 FFMpegUtils AST#expression#Right . executeFFmpegCommand 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 cmds AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '-i' AST#expression#Right , AST#expression#Left inputPath AST#expression#Right , AST#expression#Left '-c:v' AST#expression#Right , AST#expression#Left 'libx264' AST#expression#Right , AST#expression#Left '-c:a' AST#expression#Right , AST#expression#Left 'aac' AST#expression#Right , AST#expression#Left outputPath AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFFmpegProgress AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left onProgress AST#expression#Right || AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left progress 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#template_literal#Left ` Progress: AST#template_substitution#Left $ { AST#expression#Left progress 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#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFFmpegFail AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left code AST#parameter#Right , AST#parameter#Left msg 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 ` Conversion failed: AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left msg 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFFmpegSuccess AST#property_name#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#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 'Conversion succeeded!' 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#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#method_declaration#Right
|
static convertVideo(
inputPath: string,
outputPath: string,
onProgress?: (progress: number) => void
): Promise<number> {
return FFMpegUtils.executeFFmpegCommand({
cmds: ['-i', inputPath, '-c:v', 'libx264', '-c:a', 'aac', outputPath],
onFFmpegProgress: onProgress || ((progress) => {
console.log(`Progress: ${progress}%`);
}),
onFFmpegFail: (code, msg) => {
console.error(`Conversion failed: ${code} - ${msg}`);
},
onFFmpegSuccess: () => {
console.log('Conversion succeeded!');
}
});
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFMpegUtils.ets#L146-L163
|
a86e21ceb042dbbb497e631b6c8d8a3d5ec11c09
|
github
|
Classaspen/ArkTS_PasswordManagement.git
|
66aea6e4f8ee3a78e5029c63186dba70707ca2d9
|
entry/src/main/ets/components/pswmanagement/CommonConstants.ets
|
arkts
|
Common constants for all features.
|
export default class CommonConstants {
/**
* Search font weight.
*/
static readonly SEARCH_FONT_WEIGHT: number = 10;
/**
* The font family of search component.
*/
static readonly SEARCH_FONT_FAMILY: string = 'serif';
/**
* The layout weight of the list title.
*/
static readonly TITLE_LAYOUT_WEIGHT: number = 1;
/**
* The max lines of the list title.
*/
static readonly TITLE_MAX_LINES: number = 1;
/**
* Set component layout weight.
*/
static readonly WEIGHT: number = 1;
/**
* The contacts detail page url.
*/
static readonly PAGE_DETAIL_URL: string = 'pages/ContactDetailPage';
/**
* The contacts editing page url.
*/
static readonly ADD_EDIT_URL: string = 'pages/ContactAddAndEditPage';
/**
* The contacts list page url.
*/
static readonly LIST_PAGE_URL: string = 'pages/ContactHomePage';
/**
* The contacts delete page url.
*/
static readonly DELETE_PAGE_URL: string = 'pages/ContactDeletePage';
/**
* The key to transfer parameters when replace pages.
*/
static readonly KEY_PARAM_DATA: string = 'data';
/**
* The maximum component width.
*/
static readonly PERCENTAGE_MAX: string = '100%';
/**
* Eighty percent assembly width.
*/
static readonly PERCENTAGE_HEIGHT_MAX: string = '80%';
/**
* Delete page title width.
*/
static readonly PAGE_TITLE_WIDTH: string = '90%';
/**
* Edit the width of the input box on the page.
*/
static readonly EDIT_INPUT_WIDTH: string = '80%';
/**
* The contacts details page components width.
*/
static readonly DETAIL_ITEM_WIDTH: string = '70%';
/**
* Height of the address book list.
*/
static readonly CONTACTS_LIST_HEIGHT: string = '90%';
/**
* The width of the bottom component.
*/
static readonly BOTTOM_COMPONENT_WIDTH: string = '50%';
/**
* The contacts details page top height.
*/
static readonly DETAIL_TOP_HEIGHT: string = '30%';
/**
* The percentage of list component.
*/
static readonly LIST_WIDTH_PERCENT: string = '93.3%';
/**
* The contacts list divider left margin.
*/
static readonly CONTACTS_LIST_DIVIDER: string = '16%';
/**
* The contacts list divider left margin.
*/
static readonly CONTACTS_EMPTY_TOP: string = '17.8%';
/**
* Contact database key.
*/
static readonly CONTACTS_DATABASE_KEY: string = 'contactsKey';
/**
* Ability name.
*/
static readonly ABILITY_NAME: string = 'EntryAbility';
/**
* Detail page id.
*/
static readonly DETAIL_PAGE_ID: string = 'detailId';
/**
* Phone components id.
*/
static readonly PHONE_COMPONENTS_ID: number = 1;
/**
* Email components id.
*/
static readonly Email_COMPONENTS_ID: number = 2;
/**
* Note components id.
*/
static readonly Note_COMPONENTS_ID: number = 3;
/**
* Device list group.
*/
static readonly DEVICE_GROUP: string = 'deviceGroup';
/**
* Even column.
*/
static readonly EVEN_COLUMN: number = 2;
/**
* Indicates whether to edit the page.
*/
static readonly IS_EDIT: string = 'isEdit';
/**
* Key of details page information.
*/
static readonly DETAIL_INFO_KEY: string = 'key';
/**
* Monitors distributed database changes.
*/
static readonly DATA_CHANGE: string = 'dataChange';
/**
* Start ability callback.
*/
static readonly EXIT: string = 'exit';
/**
* Start ability callback id.
*/
static readonly SUBSCRIBE_ID: number = 100;
/**
* The mode of start device discovery info.
*/
static readonly INFO_MODE: number = 0xAA;
/**
* The frequency of start device discovery info.
*/
static readonly INFO_FREQ: number = 2;
/**
* Discover device list.
*/
static readonly DISCOVER_DEVICE_LIST: string = 'discoverDeviceList';
/**
* Zero.
*/
static readonly ZERO: string = '0';
/**
* One.
*/
static readonly ONE: number = 1;
/**
* Trusted device list.
*/
static readonly TRUSTED_DEVICE_LIST: string = 'trustedDeviceList';
/**
* Subscribe ID range.
*/
static readonly SUBSCRIBE_ID_RANGE: number = 65536;
/**
* Auth type.
*/
static readonly AUTH_TYPE: number = 1;
/**
* Subscribe mode.
*/
static readonly SUBSCRIBE_MODE: number = 0xAA;
/**
* Subscribe medium.
*/
static readonly SUBSCRIBE_MEDIUM: number = 0;
/**
* Subscribe freq.
*/
static readonly SUBSCRIBE_FREQ: number = 2;
/**
* Subscribe capability.
*/
static readonly SUBSCRIBE_CAPABILITY: number = 0;
/**
* Font weight.
*/
static readonly FONT_WEIGHT_500: number = 500;
/**
* Invalid Index.
*/
static readonly INVALID_INDEX: number = -1;
/**
* One hundred percent.
*/
static readonly FULL_PERCENT: string = '100%';
/**
* Number one.
*/
static readonly NUMBER_ONE: number = 1;
/**
* Device name width.
*/
static readonly DEVICE_NAME_WIDTH: string = '78%';
/**
* Select icon width.
*/
static readonly SELECT_ICON_WIDTH: string = '8%';
/**
* Localhost name.
*/
static readonly LOCALHOST_NAME: string = 'Local Host';
/**
* Entry ability.
*/
static readonly ENTRY_ABILITY: string = 'EntryAbility';
/**
* Ability name.
*/
static readonly BUNDLE_NAME: string = 'com.example.crossDeviceDataSynchronization';
/**
* App name.
*/
static readonly APP_NAME: string = 'Distributed Contacts';
/**
* Contacts name max length.
*/
static readonly CONTACTS_NAME_MAX_LENGTH: number = 10;
/**
* Contacts tel max length.
*/
static readonly CONTACTS_TEL_MAX_LENGTH: number = 11;
/**
* Contacts detail input box max length.
*/
static readonly CONTACTS_DETAIL_MAX: number = 20;
/**
* Distributed mail image storage location.
*/
static readonly MAIL_DISTRIBUTED_PATH: string = '/data/storage/el2/distributedfiles/';
/**
* File name for storing cross-end photos.
*/
static readonly PICTURE_NAME: string = 'pictureName';
/**
* Supports transfer.
*/
static readonly CAN_CONTINUATION: string = 'true';
/**
* Forwarding is not supported.
*/
static readonly NO_CONTINUATION: string = 'false';
/**
* With picture streaming.
*/
static readonly CAN_PHOTO: string = 'true';
/**
* Transfer without picture.
*/
static readonly NO_PHOTO: string = 'false';
/**
* Image stream size.
*/
static readonly IMAGE_STREAM_SIZE: number = 10240000;
/**
* Bottom toolbar picture spacing.
*/
static readonly BOTTOM_IMAGE_SPACE: number = 24;
static readonly FILE_BUFFER_SIZE: number = 4096;
static readonly APPENDIX_LIST_SPACE: number = 5;
static readonly APPENDIX_LIST_START_MARGIN: number = 15;
static readonly APPENDIX_LIST_END_MARGIN: number = 15;
/**
* Rdb database config.
*/
static readonly STORE_CONFIG: relationalStore.StoreConfig = {
name: 'pswdatabase.db',
securityLevel: relationalStore.SecurityLevel.S1,
};
/**
* Account table config.
*/
static readonly ACCOUNT_TABLE: AccountTable = {
tableName: 'accountTable',
sqlCreate: 'CREATE TABLE IF NOT EXISTS accountTable(id TEXT, accountType INTEGER, typeText TEXT, amount INTEGER)',
columns: ['id', 'name', 'typeText', 'amount'],
};
/**
* Search text of Search component.
*/
static readonly SEARCH_TEXT = $r('app.string.search');
/**
* toast text of prompt component.
*/
static readonly TOAST_TEXT_1 = $r('app.string.TOAST_TEXT_1');
static readonly TOAST_TEXT_2 = $r('app.string.TOAST_TEXT_2');
/**
* Component size.
*/
static readonly DIALOG_HEIGHT = '55%';
static readonly TABS_HEIGHT = '45%';
static readonly MINIMUM_SIZE = 0;
static readonly FULL_SIZE = 1;
static readonly PROMPT_BOTTOM = '70vp';
/**
* Component location.
*/
static readonly EDIT_POSITION_X = '80%';
static readonly EDIT_POSITION_Y = '90%';
static readonly DELETE_POSITION_X = '50%';
static readonly DELETE_POSITION_Y = '90%';
/**
* Log tag.
*/
static readonly RDB_TAG = '[Debug.Rdb]';
static readonly TABLE_TAG = '[Debug.AccountTable]';
static readonly INDEX_TAG = '[Debug.Index]';
}
|
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Search font weight.
*/ AST#property_declaration#Left static readonly SEARCH_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right /**
* The font family of search component.
*/ AST#property_declaration#Left static readonly SEARCH_FONT_FAMILY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'serif' AST#expression#Right ; AST#property_declaration#Right /**
* The layout weight of the list title.
*/ AST#property_declaration#Left static readonly TITLE_LAYOUT_WEIGHT : 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#property_declaration#Right /**
* The max lines of the list title.
*/ AST#property_declaration#Left static readonly TITLE_MAX_LINES : 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#property_declaration#Right /**
* Set component layout weight.
*/ AST#property_declaration#Left static readonly WEIGHT : 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#property_declaration#Right /**
* The contacts detail page url.
*/ AST#property_declaration#Left static readonly PAGE_DETAIL_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactDetailPage' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts editing page url.
*/ AST#property_declaration#Left static readonly ADD_EDIT_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactAddAndEditPage' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts list page url.
*/ AST#property_declaration#Left static readonly LIST_PAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactHomePage' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts delete page url.
*/ AST#property_declaration#Left static readonly DELETE_PAGE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/ContactDeletePage' AST#expression#Right ; AST#property_declaration#Right /**
* The key to transfer parameters when replace pages.
*/ AST#property_declaration#Left static readonly KEY_PARAM_DATA : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'data' AST#expression#Right ; AST#property_declaration#Right /**
* The maximum component width.
*/ AST#property_declaration#Left static readonly PERCENTAGE_MAX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /**
* Eighty percent assembly width.
*/ AST#property_declaration#Left static readonly PERCENTAGE_HEIGHT_MAX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '80%' AST#expression#Right ; AST#property_declaration#Right /**
* Delete page title width.
*/ AST#property_declaration#Left static readonly PAGE_TITLE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /**
* Edit the width of the input box on the page.
*/ AST#property_declaration#Left static readonly EDIT_INPUT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '80%' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts details page components width.
*/ AST#property_declaration#Left static readonly DETAIL_ITEM_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '70%' AST#expression#Right ; AST#property_declaration#Right /**
* Height of the address book list.
*/ AST#property_declaration#Left static readonly CONTACTS_LIST_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /**
* The width of the bottom component.
*/ AST#property_declaration#Left static readonly BOTTOM_COMPONENT_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '50%' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts details page top height.
*/ AST#property_declaration#Left static readonly DETAIL_TOP_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '30%' AST#expression#Right ; AST#property_declaration#Right /**
* The percentage of list component.
*/ AST#property_declaration#Left static readonly LIST_WIDTH_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '93.3%' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts list divider left margin.
*/ AST#property_declaration#Left static readonly CONTACTS_LIST_DIVIDER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '16%' AST#expression#Right ; AST#property_declaration#Right /**
* The contacts list divider left margin.
*/ AST#property_declaration#Left static readonly CONTACTS_EMPTY_TOP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '17.8%' AST#expression#Right ; AST#property_declaration#Right /**
* Contact database key.
*/ AST#property_declaration#Left static readonly CONTACTS_DATABASE_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'contactsKey' AST#expression#Right ; AST#property_declaration#Right /**
* Ability name.
*/ AST#property_declaration#Left static readonly ABILITY_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'EntryAbility' AST#expression#Right ; AST#property_declaration#Right /**
* Detail page id.
*/ AST#property_declaration#Left static readonly DETAIL_PAGE_ID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'detailId' AST#expression#Right ; AST#property_declaration#Right /**
* Phone components id.
*/ AST#property_declaration#Left static readonly PHONE_COMPONENTS_ID : 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#property_declaration#Right /**
* Email components id.
*/ AST#property_declaration#Left static readonly Email_COMPONENTS_ID : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /**
* Note components id.
*/ AST#property_declaration#Left static readonly Note_COMPONENTS_ID : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right /**
* Device list group.
*/ AST#property_declaration#Left static readonly DEVICE_GROUP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'deviceGroup' AST#expression#Right ; AST#property_declaration#Right /**
* Even column.
*/ AST#property_declaration#Left static readonly EVEN_COLUMN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /**
* Indicates whether to edit the page.
*/ AST#property_declaration#Left static readonly IS_EDIT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'isEdit' AST#expression#Right ; AST#property_declaration#Right /**
* Key of details page information.
*/ AST#property_declaration#Left static readonly DETAIL_INFO_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'key' AST#expression#Right ; AST#property_declaration#Right /**
* Monitors distributed database changes.
*/ AST#property_declaration#Left static readonly DATA_CHANGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'dataChange' AST#expression#Right ; AST#property_declaration#Right /**
* Start ability callback.
*/ AST#property_declaration#Left static readonly EXIT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'exit' AST#expression#Right ; AST#property_declaration#Right /**
* Start ability callback id.
*/ AST#property_declaration#Left static readonly SUBSCRIBE_ID : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right /**
* The mode of start device discovery info.
*/ AST#property_declaration#Left static readonly INFO_MODE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0xAA AST#expression#Right ; AST#property_declaration#Right /**
* The frequency of start device discovery info.
*/ AST#property_declaration#Left static readonly INFO_FREQ : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /**
* Discover device list.
*/ AST#property_declaration#Left static readonly DISCOVER_DEVICE_LIST : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'discoverDeviceList' AST#expression#Right ; AST#property_declaration#Right /**
* Zero.
*/ AST#property_declaration#Left static readonly ZERO : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '0' AST#expression#Right ; AST#property_declaration#Right /**
* One.
*/ AST#property_declaration#Left static readonly 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#property_declaration#Right /**
* Trusted device list.
*/ AST#property_declaration#Left static readonly TRUSTED_DEVICE_LIST : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'trustedDeviceList' AST#expression#Right ; AST#property_declaration#Right /**
* Subscribe ID range.
*/ AST#property_declaration#Left static readonly SUBSCRIBE_ID_RANGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 65536 AST#expression#Right ; AST#property_declaration#Right /**
* Auth type.
*/ AST#property_declaration#Left static readonly AUTH_TYPE : 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#property_declaration#Right /**
* Subscribe mode.
*/ AST#property_declaration#Left static readonly SUBSCRIBE_MODE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0xAA AST#expression#Right ; AST#property_declaration#Right /**
* Subscribe medium.
*/ AST#property_declaration#Left static readonly SUBSCRIBE_MEDIUM : 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 /**
* Subscribe freq.
*/ AST#property_declaration#Left static readonly SUBSCRIBE_FREQ : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /**
* Subscribe capability.
*/ AST#property_declaration#Left static readonly SUBSCRIBE_CAPABILITY : 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 /**
* Font weight.
*/ AST#property_declaration#Left static readonly FONT_WEIGHT_500 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right /**
* Invalid Index.
*/ AST#property_declaration#Left static readonly INVALID_INDEX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* One hundred percent.
*/ AST#property_declaration#Left static readonly FULL_PERCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /**
* Number one.
*/ AST#property_declaration#Left static readonly NUMBER_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#property_declaration#Right /**
* Device name width.
*/ AST#property_declaration#Left static readonly DEVICE_NAME_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '78%' AST#expression#Right ; AST#property_declaration#Right /**
* Select icon width.
*/ AST#property_declaration#Left static readonly SELECT_ICON_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '8%' AST#expression#Right ; AST#property_declaration#Right /**
* Localhost name.
*/ AST#property_declaration#Left static readonly LOCALHOST_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Local Host' AST#expression#Right ; AST#property_declaration#Right /**
* Entry ability.
*/ AST#property_declaration#Left static readonly ENTRY_ABILITY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'EntryAbility' AST#expression#Right ; AST#property_declaration#Right /**
* Ability name.
*/ AST#property_declaration#Left static readonly BUNDLE_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'com.example.crossDeviceDataSynchronization' AST#expression#Right ; AST#property_declaration#Right /**
* App name.
*/ AST#property_declaration#Left static readonly APP_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Distributed Contacts' AST#expression#Right ; AST#property_declaration#Right /**
* Contacts name max length.
*/ AST#property_declaration#Left static readonly CONTACTS_NAME_MAX_LENGTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right /**
* Contacts tel max length.
*/ AST#property_declaration#Left static readonly CONTACTS_TEL_MAX_LENGTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 11 AST#expression#Right ; AST#property_declaration#Right /**
* Contacts detail input box max length.
*/ AST#property_declaration#Left static readonly CONTACTS_DETAIL_MAX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right /**
* Distributed mail image storage location.
*/ AST#property_declaration#Left static readonly MAIL_DISTRIBUTED_PATH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/data/storage/el2/distributedfiles/' AST#expression#Right ; AST#property_declaration#Right /**
* File name for storing cross-end photos.
*/ AST#property_declaration#Left static readonly PICTURE_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pictureName' AST#expression#Right ; AST#property_declaration#Right /**
* Supports transfer.
*/ AST#property_declaration#Left static readonly CAN_CONTINUATION : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'true' AST#expression#Right ; AST#property_declaration#Right /**
* Forwarding is not supported.
*/ AST#property_declaration#Left static readonly NO_CONTINUATION : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'false' AST#expression#Right ; AST#property_declaration#Right /**
* With picture streaming.
*/ AST#property_declaration#Left static readonly CAN_PHOTO : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'true' AST#expression#Right ; AST#property_declaration#Right /**
* Transfer without picture.
*/ AST#property_declaration#Left static readonly NO_PHOTO : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'false' AST#expression#Right ; AST#property_declaration#Right /**
* Image stream size.
*/ AST#property_declaration#Left static readonly IMAGE_STREAM_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10240000 AST#expression#Right ; AST#property_declaration#Right /**
* Bottom toolbar picture spacing.
*/ AST#property_declaration#Left static readonly BOTTOM_IMAGE_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly FILE_BUFFER_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4096 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly APPENDIX_LIST_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly APPENDIX_LIST_START_MARGIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly APPENDIX_LIST_END_MARGIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15 AST#expression#Right ; AST#property_declaration#Right /**
* Rdb database config.
*/ AST#property_declaration#Left static readonly STORE_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreConfig 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 name AST#property_name#Right : AST#expression#Left 'pswdatabase.db' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left securityLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left relationalStore AST#expression#Right . SecurityLevel AST#member_expression#Right AST#expression#Right . S1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* Account table config.
*/ AST#property_declaration#Left static readonly ACCOUNT_TABLE : AST#type_annotation#Left AST#primary_type#Left AccountTable AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tableName AST#property_name#Right : AST#expression#Left 'accountTable' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sqlCreate AST#property_name#Right : AST#expression#Left 'CREATE TABLE IF NOT EXISTS accountTable(id TEXT, accountType INTEGER, typeText TEXT, amount INTEGER)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left columns AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'id' AST#expression#Right , AST#expression#Left 'name' AST#expression#Right , AST#expression#Left 'typeText' AST#expression#Right , AST#expression#Left 'amount' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* Search text of Search component.
*/ AST#property_declaration#Left static readonly SEARCH_TEXT = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.search' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* toast text of prompt component.
*/ AST#property_declaration#Left static readonly TOAST_TEXT_1 = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.TOAST_TEXT_1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TOAST_TEXT_2 = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.TOAST_TEXT_2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* Component size.
*/ AST#property_declaration#Left static readonly DIALOG_HEIGHT = AST#expression#Left '55%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABS_HEIGHT = AST#expression#Left '45%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MINIMUM_SIZE = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly FULL_SIZE = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly PROMPT_BOTTOM = AST#expression#Left '70vp' AST#expression#Right ; AST#property_declaration#Right /**
* Component location.
*/ AST#property_declaration#Left static readonly EDIT_POSITION_X = AST#expression#Left '80%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly EDIT_POSITION_Y = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DELETE_POSITION_X = AST#expression#Left '50%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DELETE_POSITION_Y = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /**
* Log tag.
*/ AST#property_declaration#Left static readonly RDB_TAG = AST#expression#Left '[Debug.Rdb]' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TABLE_TAG = AST#expression#Left '[Debug.AccountTable]' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly INDEX_TAG = AST#expression#Left '[Debug.Index]' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export default class CommonConstants {
static readonly SEARCH_FONT_WEIGHT: number = 10;
static readonly SEARCH_FONT_FAMILY: string = 'serif';
static readonly TITLE_LAYOUT_WEIGHT: number = 1;
static readonly TITLE_MAX_LINES: number = 1;
static readonly WEIGHT: number = 1;
static readonly PAGE_DETAIL_URL: string = 'pages/ContactDetailPage';
static readonly ADD_EDIT_URL: string = 'pages/ContactAddAndEditPage';
static readonly LIST_PAGE_URL: string = 'pages/ContactHomePage';
static readonly DELETE_PAGE_URL: string = 'pages/ContactDeletePage';
static readonly KEY_PARAM_DATA: string = 'data';
static readonly PERCENTAGE_MAX: string = '100%';
static readonly PERCENTAGE_HEIGHT_MAX: string = '80%';
static readonly PAGE_TITLE_WIDTH: string = '90%';
static readonly EDIT_INPUT_WIDTH: string = '80%';
static readonly DETAIL_ITEM_WIDTH: string = '70%';
static readonly CONTACTS_LIST_HEIGHT: string = '90%';
static readonly BOTTOM_COMPONENT_WIDTH: string = '50%';
static readonly DETAIL_TOP_HEIGHT: string = '30%';
static readonly LIST_WIDTH_PERCENT: string = '93.3%';
static readonly CONTACTS_LIST_DIVIDER: string = '16%';
static readonly CONTACTS_EMPTY_TOP: string = '17.8%';
static readonly CONTACTS_DATABASE_KEY: string = 'contactsKey';
static readonly ABILITY_NAME: string = 'EntryAbility';
static readonly DETAIL_PAGE_ID: string = 'detailId';
static readonly PHONE_COMPONENTS_ID: number = 1;
static readonly Email_COMPONENTS_ID: number = 2;
static readonly Note_COMPONENTS_ID: number = 3;
static readonly DEVICE_GROUP: string = 'deviceGroup';
static readonly EVEN_COLUMN: number = 2;
static readonly IS_EDIT: string = 'isEdit';
static readonly DETAIL_INFO_KEY: string = 'key';
static readonly DATA_CHANGE: string = 'dataChange';
static readonly EXIT: string = 'exit';
static readonly SUBSCRIBE_ID: number = 100;
static readonly INFO_MODE: number = 0xAA;
static readonly INFO_FREQ: number = 2;
static readonly DISCOVER_DEVICE_LIST: string = 'discoverDeviceList';
static readonly ZERO: string = '0';
static readonly ONE: number = 1;
static readonly TRUSTED_DEVICE_LIST: string = 'trustedDeviceList';
static readonly SUBSCRIBE_ID_RANGE: number = 65536;
static readonly AUTH_TYPE: number = 1;
static readonly SUBSCRIBE_MODE: number = 0xAA;
static readonly SUBSCRIBE_MEDIUM: number = 0;
static readonly SUBSCRIBE_FREQ: number = 2;
static readonly SUBSCRIBE_CAPABILITY: number = 0;
static readonly FONT_WEIGHT_500: number = 500;
static readonly INVALID_INDEX: number = -1;
static readonly FULL_PERCENT: string = '100%';
static readonly NUMBER_ONE: number = 1;
static readonly DEVICE_NAME_WIDTH: string = '78%';
static readonly SELECT_ICON_WIDTH: string = '8%';
static readonly LOCALHOST_NAME: string = 'Local Host';
static readonly ENTRY_ABILITY: string = 'EntryAbility';
static readonly BUNDLE_NAME: string = 'com.example.crossDeviceDataSynchronization';
static readonly APP_NAME: string = 'Distributed Contacts';
static readonly CONTACTS_NAME_MAX_LENGTH: number = 10;
static readonly CONTACTS_TEL_MAX_LENGTH: number = 11;
static readonly CONTACTS_DETAIL_MAX: number = 20;
static readonly MAIL_DISTRIBUTED_PATH: string = '/data/storage/el2/distributedfiles/';
static readonly PICTURE_NAME: string = 'pictureName';
static readonly CAN_CONTINUATION: string = 'true';
static readonly NO_CONTINUATION: string = 'false';
static readonly CAN_PHOTO: string = 'true';
static readonly NO_PHOTO: string = 'false';
static readonly IMAGE_STREAM_SIZE: number = 10240000;
static readonly BOTTOM_IMAGE_SPACE: number = 24;
static readonly FILE_BUFFER_SIZE: number = 4096;
static readonly APPENDIX_LIST_SPACE: number = 5;
static readonly APPENDIX_LIST_START_MARGIN: number = 15;
static readonly APPENDIX_LIST_END_MARGIN: number = 15;
static readonly STORE_CONFIG: relationalStore.StoreConfig = {
name: 'pswdatabase.db',
securityLevel: relationalStore.SecurityLevel.S1,
};
static readonly ACCOUNT_TABLE: AccountTable = {
tableName: 'accountTable',
sqlCreate: 'CREATE TABLE IF NOT EXISTS accountTable(id TEXT, accountType INTEGER, typeText TEXT, amount INTEGER)',
columns: ['id', 'name', 'typeText', 'amount'],
};
static readonly SEARCH_TEXT = $r('app.string.search');
static readonly TOAST_TEXT_1 = $r('app.string.TOAST_TEXT_1');
static readonly TOAST_TEXT_2 = $r('app.string.TOAST_TEXT_2');
static readonly DIALOG_HEIGHT = '55%';
static readonly TABS_HEIGHT = '45%';
static readonly MINIMUM_SIZE = 0;
static readonly FULL_SIZE = 1;
static readonly PROMPT_BOTTOM = '70vp';
static readonly EDIT_POSITION_X = '80%';
static readonly EDIT_POSITION_Y = '90%';
static readonly DELETE_POSITION_X = '50%';
static readonly DELETE_POSITION_Y = '90%';
static readonly RDB_TAG = '[Debug.Rdb]';
static readonly TABLE_TAG = '[Debug.AccountTable]';
static readonly INDEX_TAG = '[Debug.Index]';
}
|
https://github.com/Classaspen/ArkTS_PasswordManagement.git/blob/66aea6e4f8ee3a78e5029c63186dba70707ca2d9/entry/src/main/ets/components/pswmanagement/CommonConstants.ets#L22-L340
|
ed878f723ecda29fe2d627bda8236c300914197b
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
|
arkts
|
TextPickerDialogBuilder
|
TextPickerDialog
@param options
|
@Builder
export function TextPickerDialogBuilder(options: TextPickerOptions) {
TextPickerDialogView({ options: options })
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function TextPickerDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TextPickerOptions 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 TextPickerDialogView ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left options 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#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function TextPickerDialogBuilder(options: TextPickerOptions) {
TextPickerDialogView({ options: options })
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L177-L180
|
29be78c8280d80938ac91cc5b9d9265b3a7f9bf4
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets
|
arkts
|
pushData
|
存储数据到懒加载数据源中
|
pushData(data: NewsCommentModel): void {
this.comments.push(data);
// 在数组头部添加数据
this.notifyDataAdd(this.comments.length - 1);
}
|
AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left NewsCommentModel 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 . comments AST#member_expression#Right AST#expression#Right . push 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . comments 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
pushData(data: NewsCommentModel): void {
this.comments.push(data);
this.notifyDataAdd(this.comments.length - 1);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets#L140-L144
|
3862b907ce7eccc19eadf40639eba84873bda468
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/UrlUtils.ets
|
arkts
|
saveUrl
|
设置保存上传下载地址
|
async saveUrl(context: common.UIAbilityContext, url: string) {
let preference = await preferences.getPreferences(context, STORE_NAME);
await preference.put(URL_KEY, url);
await preference.flush();
logger.info(TAG, `saveUrl,url= ${url}`);
}
|
AST#method_declaration#Left async saveUrl 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#Left url : 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 preference = 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 preferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left STORE_NAME 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 preference AST#expression#Right AST#await_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left URL_KEY AST#expression#Right , AST#expression#Left url 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#await_expression#Left await AST#expression#Left preference AST#expression#Right AST#await_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 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#template_literal#Left ` saveUrl,url= AST#template_substitution#Left $ { AST#expression#Left url 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#method_declaration#Right
|
async saveUrl(context: common.UIAbilityContext, url: string) {
let preference = await preferences.getPreferences(context, STORE_NAME);
await preference.put(URL_KEY, url);
await preference.flush();
logger.info(TAG, `saveUrl,url= ${url}`);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/UrlUtils.ets#L41-L46
|
3ce65710f68731655fb343d37c74e884da32b188
|
gitee
|
0dot618/my_PCB_detection_harmony_app.git
|
58217366ac936b5f4c246191701b333f4d3c5513
|
MyApplication2/entry/src/main/ets/pages/Detect.ets
|
arkts
|
savePixmap2SysHelper
|
保存到系统相册
|
async savePixmap2SysHelper(pixmap:image.PixelMap) {
if (!pixmap) {
return;
}
const imgBuffer = await this.transferPixelMap2Buffer(pixmap);
// 获取相册管理模块的实例,用于访问和修改相册中的媒体文件。
let helper = photoAccessHelper.getPhotoAccessHelper(getContext(this));
// 指定待创建的文件类型和后缀,创建图片或视频资源,使用callback方式返回结果。
const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'png');
const file = await fileIo.open(uri, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
await fileIo.write(file.fd, imgBuffer);
await fileIo.close(file.fd);
}
|
AST#method_declaration#Left async savePixmap2SysHelper AST#parameter_list#Left ( AST#parameter#Left pixmap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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#unary_expression#Left ! AST#expression#Left pixmap 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#variable_declaration#Left const AST#variable_declarator#Left imgBuffer = 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 . transferPixelMap2Buffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixmap 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 helper = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . getPhotoAccessHelper AST#member_expression#Right AST#expression#Right AST#argument_list#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 ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 指定待创建的文件类型和后缀,创建图片或视频资源,使用callback方式返回结果。 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uri = 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 helper AST#expression#Right AST#await_expression#Right AST#expression#Right . createAsset 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 photoAccessHelper AST#expression#Right . PhotoType AST#member_expression#Right AST#expression#Right . IMAGE AST#member_expression#Right AST#expression#Right , AST#expression#Left 'png' 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 file = 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 fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri 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 fileIo AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fileIo AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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#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 fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . write AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left imgBuffer 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#await_expression#Left await AST#expression#Left fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd 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#method_declaration#Right
|
async savePixmap2SysHelper(pixmap:image.PixelMap) {
if (!pixmap) {
return;
}
const imgBuffer = await this.transferPixelMap2Buffer(pixmap);
let helper = photoAccessHelper.getPhotoAccessHelper(getContext(this));
const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'png');
const file = await fileIo.open(uri, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
await fileIo.write(file.fd, imgBuffer);
await fileIo.close(file.fd);
}
|
https://github.com/0dot618/my_PCB_detection_harmony_app.git/blob/58217366ac936b5f4c246191701b333f4d3c5513/MyApplication2/entry/src/main/ets/pages/Detect.ets#L194-L206
|
087cf0c4d017f725f62fd17c82919b96da676762
|
github
|
851432669/Smart-Home-ArkTs-Hi3861.git
|
0451f85f072ed3281cc23d9cdc2843d79f60f975
|
entry/src/main/ets/view/AIComponent.ets
|
arkts
|
saveConversation
|
新增:保存对话记录到MongoDB
|
private saveConversation(prompt: string, reply: string, environmentData: EnvironmentViewModel): void {
const httpRequest = http.createHttp()
console.info('准备保存AI对话记录到MongoDB...')
console.info('服务器地址:', this.SAVE_CONVERSATION_URL)
// 创建符合接口定义的请求数据对象
const requestData: ConversationRequest = {
username: 'current_user', // 可以从全局状态或存储中获取实际用户名
prompt: prompt,
reply: reply,
environmentData: {
temperature: environmentData.temp, // 使用正确的属性名
humidity: environmentData.hum, // 使用正确的属性名
co2: environmentData.gas, // 使用可燃气体浓度作为co2
pm25: 0 // EnvironmentViewModel中没有pm25,设置默认值
}
}
console.info('请求数据:', JSON.stringify(requestData))
const options: http.HttpRequestOptions = {
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify(requestData),
readTimeout: 60000,
connectTimeout: 5000
}
console.info('开始发送HTTP请求...')
httpRequest.request(this.SAVE_CONVERSATION_URL, options)
.then((response: http.HttpResponse) => {
console.info('收到HTTP响应, 状态码:', response.responseCode)
const result: SaveConversationResponse = JSON.parse(response.result as string)
if (result.success) {
console.info('AI对话记录保存成功')
} else {
console.error('AI对话记录保存失败:', result.message)
}
})
.catch((error: BusinessError) => {
console.error('保存对话记录请求失败:', JSON.stringify(error))
})
.finally(() => {
httpRequest.destroy()
})
}
|
AST#method_declaration#Left private saveConversation AST#parameter_list#Left ( AST#parameter#Left prompt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reply : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left environmentData : AST#type_annotation#Left AST#primary_type#Left EnvironmentViewModel 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 const AST#variable_declarator#Left httpRequest = 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 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#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '准备保存AI对话记录到MongoDB...' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '服务器地址:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . SAVE_CONVERSATION_URL 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 const AST#variable_declarator#Left requestData : AST#type_annotation#Left AST#primary_type#Left ConversationRequest 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left username AST#property_name#Right : AST#expression#Left 'current_user' AST#expression#Right AST#property_assignment#Right , // 可以从全局状态或存储中获取实际用户名 AST#property_assignment#Left AST#property_name#Left prompt AST#property_name#Right : AST#expression#Left prompt AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reply AST#property_name#Right : AST#expression#Left reply AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left environmentData AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left temperature AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left environmentData AST#expression#Right . temp AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 使用正确的属性名 AST#property_assignment#Left AST#property_name#Left humidity AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left environmentData AST#expression#Right . hum AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 使用正确的属性名 AST#property_assignment#Left AST#property_name#Left co2 AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left environmentData AST#expression#Right . gas AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 使用可燃气体浓度作为co2 AST#property_assignment#Left AST#property_name#Left pm25 AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right // EnvironmentViewModel中没有pm25,设置默认值 } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '请求数据:' 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 requestData 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 const AST#variable_declarator#Left options : 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#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 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#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 header AST#property_name#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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left extraData AST#property_name#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 requestData 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 readTimeout AST#property_name#Right : AST#expression#Left 60000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left 5000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left console AST#ERROR#Right . info 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#ERROR#Left httpRequest AST#ERROR#Right . request 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 . SAVE_CONVERSATION_URL AST#member_expression#Right AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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 response : 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#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 '收到HTTP响应, 状态码:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . responseCode 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#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left SaveConversationResponse 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . success 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AI对话记录保存成功' 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AI对话记录保存失败:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . message 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#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 error : 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#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 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#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 . finally AST#member_expression#Right 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 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#arrow_function#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#block_statement#Right AST#method_declaration#Right
|
private saveConversation(prompt: string, reply: string, environmentData: EnvironmentViewModel): void {
const httpRequest = http.createHttp()
console.info('准备保存AI对话记录到MongoDB...')
console.info('服务器地址:', this.SAVE_CONVERSATION_URL)
const requestData: ConversationRequest = {
username: 'current_user',
prompt: prompt,
reply: reply,
environmentData: {
temperature: environmentData.temp,
humidity: environmentData.hum,
co2: environmentData.gas,
pm25: 0
}
}
console.info('请求数据:', JSON.stringify(requestData))
const options: http.HttpRequestOptions = {
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify(requestData),
readTimeout: 60000,
connectTimeout: 5000
}
console.info('开始发送HTTP请求...')
httpRequest.request(this.SAVE_CONVERSATION_URL, options)
.then((response: http.HttpResponse) => {
console.info('收到HTTP响应, 状态码:', response.responseCode)
const result: SaveConversationResponse = JSON.parse(response.result as string)
if (result.success) {
console.info('AI对话记录保存成功')
} else {
console.error('AI对话记录保存失败:', result.message)
}
})
.catch((error: BusinessError) => {
console.error('保存对话记录请求失败:', JSON.stringify(error))
})
.finally(() => {
httpRequest.destroy()
})
}
|
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/view/AIComponent.ets#L120-L166
|
1982ca1f42cac1d6968dac8d12961750185049db
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets
|
arkts
|
Copyright (C) 2024 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 RouterModule {
static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>();
static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>();
// 通过名称注册builder
public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void{
RouterModule.builderMap.set(builderName, builder);
}
// 通过名称获取builder
public static getBuilder(builderName: string): WrappedBuilder<[object]>{
let builder = RouterModule.builderMap.get(builderName);
return builder as WrappedBuilder<[object]>;
}
// 通过名称注册router
public static createRouter(routerName: string, router: NavPathStack): void{
RouterModule.routerMap.set(routerName, router);
}
// 通过名称获取router
public static getRouter(routerName: string): NavPathStack{
let router = RouterModule.routerMap.get(routerName);
return router as NavPathStack;
}
// 通过获取页面栈跳转到指定页面
public static async push(url: string): Promise<void>{
// 分解url
// 获取包名、路由名、页面名
let params = url.split("/");
const harName = params[0];
let context = params[params.length - 1].split("-");
const routerName = context[0];
const builderName = context[1];
// 获取路径
let path = ".";
for (let i = 1; i < params.length - 1; i++) {
path += "/" + params[i];
}
// 动态引入要跳转的页面
let ns: ESObject = await import(harName);
ns.harInit(path);
RouterModule.getRouter(routerName).pushPathByName(builderName, null);
}
// 通过获取页面栈并pop
public static pop(routerName: string): void {
// 查找到对应的路由栈进行pop
RouterModule.getRouter(routerName).pop();
}
// 通过获取页面栈并将其清空
public static clear(routerName: string): void {
// 查找到对应的路由栈进行pop
RouterModule.getRouter(routerName).clear();
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class RouterModule AST#class_body#Left { AST#property_declaration#Left static builderMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map 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 AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object 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#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#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right 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 AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object 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#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static routerMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map 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 NavPathStack 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#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right 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 NavPathStack AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 通过名称注册builder AST#method_declaration#Left public static registerBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object 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#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 RouterModule AST#expression#Right . builderMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName AST#expression#Right , AST#expression#Left builder 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 // 通过名称获取builder AST#method_declaration#Left public static getBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : 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 WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object 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#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left builder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . builderMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName 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#as_expression#Left AST#expression#Left builder AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#primary_type#Left object 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#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 通过名称注册router AST#method_declaration#Left public static createRouter AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left router : AST#type_annotation#Left AST#primary_type#Left NavPathStack 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 RouterModule AST#expression#Right . routerMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right , AST#expression#Left router 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 // 通过名称获取router AST#method_declaration#Left public static getRouter AST#parameter_list#Left ( AST#parameter#Left routerName : 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 NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left router = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RouterModule AST#expression#Right . routerMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName 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#as_expression#Left AST#expression#Left router AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 通过获取页面栈跳转到指定页面 AST#method_declaration#Left public static async push 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_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 { // 分解url // 获取包名、路由名、页面名 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left url 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#variable_declaration#Left const AST#variable_declarator#Left harName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left 0 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#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params 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#subscript_expression#Right 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#variable_declaration#Left const AST#variable_declarator#Left routerName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left context AST#expression#Right [ AST#expression#Left 0 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#variable_declaration#Left const AST#variable_declarator#Left builderName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left context AST#expression#Right [ AST#expression#Left 1 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#variable_declaration#Left let AST#variable_declarator#Left path = AST#expression#Left "." 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 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_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 params AST#expression#Right AST#binary_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#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#assignment_expression#Left path += AST#expression#Left AST#binary_expression#Left AST#expression#Left "/" AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right 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#for_statement#Right AST#statement#Right // 动态引入要跳转的页面 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ns : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#await_expression#Left await AST#expression#Left AST#import_expression#Left import ( AST#expression#Left harName AST#expression#Right ) AST#import_expression#Right AST#expression#Right AST#await_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 ns AST#expression#Right . harInit 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#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 RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pushPathByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName 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#block_statement#Right AST#method_declaration#Right // 通过获取页面栈并pop AST#method_declaration#Left public static pop AST#parameter_list#Left ( AST#parameter#Left routerName : 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#builder_function_body#Left { // 查找到对应的路由栈进行pop 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 RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pop 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 // 通过获取页面栈并将其清空 AST#method_declaration#Left public static clear AST#parameter_list#Left ( AST#parameter#Left routerName : 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#builder_function_body#Left { // 查找到对应的路由栈进行pop 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 RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_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#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class RouterModule {
static builderMap: Map<string, WrappedBuilder<[object]>> = new Map<string, WrappedBuilder<[object]>>();
static routerMap: Map<string, NavPathStack> = new Map<string, NavPathStack>();
public static registerBuilder(builderName: string, builder: WrappedBuilder<[object]>): void{
RouterModule.builderMap.set(builderName, builder);
}
public static getBuilder(builderName: string): WrappedBuilder<[object]>{
let builder = RouterModule.builderMap.get(builderName);
return builder as WrappedBuilder<[object]>;
}
public static createRouter(routerName: string, router: NavPathStack): void{
RouterModule.routerMap.set(routerName, router);
}
public static getRouter(routerName: string): NavPathStack{
let router = RouterModule.routerMap.get(routerName);
return router as NavPathStack;
}
public static async push(url: string): Promise<void>{
let params = url.split("/");
const harName = params[0];
let context = params[params.length - 1].split("-");
const routerName = context[0];
const builderName = context[1];
let path = ".";
for (let i = 1; i < params.length - 1; i++) {
path += "/" + params[i];
}
let ns: ESObject = await import(harName);
ns.harInit(path);
RouterModule.getRouter(routerName).pushPathByName(builderName, null);
}
public static pop(routerName: string): void {
RouterModule.getRouter(routerName).pop();
}
public static clear(routerName: string): void {
RouterModule.getRouter(routerName).clear();
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L15-L72
|
fb8019fd0dd34f65639a552116484ad623ebbef2
|
gitee
|
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
|
arkts
|
decryptCBCSync
|
解密(CBC模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|CBC|PKCS7、AES192|CBC|PKCS7、AES128|CBC|PKCS7)。
@returns
|
static decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec): cryptoFramework.DataBlob {
return SM4.decryptSync(data, symKey, ivParams, 'SM4_128|CBC|PKCS7');
}
|
AST#method_declaration#Left static decryptCBCSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivParams : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec 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 AST#qualified_type#Left cryptoFramework . DataBlob 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 SM4 AST#expression#Right . decryptSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ivParams AST#expression#Right , AST#expression#Left 'SM4_128|CBC|PKCS7' 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 decryptCBCSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
ivParams: cryptoFramework.IvParamsSpec): cryptoFramework.DataBlob {
return SM4.decryptSync(data, symKey, ivParams, 'SM4_128|CBC|PKCS7');
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L143-L146
|
93b4fbfeb13849aa5e97b8bdc788aa086273d937
|
github
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
|
arkts
|
registerAnimParam
|
注册路由转场动画,设置相关参数
@param modifier
@param ctx
@param param
|
public registerAnimParam(component: object, ctx: NavDestinationContext): AnimateCallback | undefined {
if (ctx.navDestinationId) {
const pageInfo = this.navContextMap.get(this.getKey(component))
if (pageInfo) {
pageInfo.pageId = ctx.navDestinationId
const name = ctx.navDestinationId;
let param = this.customTransitionMap.get(name)
if (!param) {
param = {
modifier: pageInfo?.modifier,
}
this.customTransitionMap.set(name, param);
}
return param
}
}
return undefined
}
|
AST#method_declaration#Left public registerAnimParam AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left NavDestinationContext 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 AnimateCallback AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_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 ctx AST#expression#Right . navDestinationId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pageInfo = 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 . navContextMap AST#member_expression#Right AST#expression#Right . get 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 this AST#expression#Right . getKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left component 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#if_statement#Left if ( AST#expression#Left pageInfo 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 pageInfo AST#expression#Right . pageId AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ctx AST#expression#Right . navDestinationId 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#variable_declaration#Left const AST#variable_declarator#Left name = AST#expression#Left AST#member_expression#Left AST#expression#Left ctx AST#expression#Right . navDestinationId 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 let AST#variable_declarator#Left param = 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 . customTransitionMap AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name 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#unary_expression#Left ! AST#expression#Left param AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left param = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left modifier AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left pageInfo AST#expression#Right ?. modifier AST#member_expression#Right AST#expression#Right 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#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 . customTransitionMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left name AST#expression#Right , AST#expression#Left param 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 param 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 undefined AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public registerAnimParam(component: object, ctx: NavDestinationContext): AnimateCallback | undefined {
if (ctx.navDestinationId) {
const pageInfo = this.navContextMap.get(this.getKey(component))
if (pageInfo) {
pageInfo.pageId = ctx.navDestinationId
const name = ctx.navDestinationId;
let param = this.customTransitionMap.get(name)
if (!param) {
param = {
modifier: pageInfo?.modifier,
}
this.customTransitionMap.set(name, param);
}
return param
}
}
return undefined
}
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L302-L319
|
a6ee652b0b07b6411fe9858d6f40038c10ed623f
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_user_agents.ets
|
arkts
|
export_string
|
Export user agents in a specific plain text format.
@returns '\n' connected string of user agents in the format of:
@example 'Firefox Windows 132\nMozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0'
|
static export_string() {
let export_list: string[] = []
for (let index = 0; index < bunch_of_user_agents.list_of_user_agents.length; index++) {
let ua: user_agent = bunch_of_user_agents.list_of_user_agents[index];
export_list.push(ua.label);
export_list.push(ua.user_agent_content);
}
return export_list.join("\n");
}
|
AST#method_declaration#Left static export_string AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left export_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#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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left bunch_of_user_agents AST#expression#Right AST#binary_expression#Right AST#expression#Right . list_of_user_agents 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 index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ua : AST#type_annotation#Left AST#primary_type#Left user_agent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_user_agents AST#expression#Right . list_of_user_agents AST#member_expression#Right 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left export_list 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 ua AST#expression#Right . label 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left export_list 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 ua AST#expression#Right . user_agent_content 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left export_list AST#expression#Right . join 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static export_string() {
let export_list: string[] = []
for (let index = 0; index < bunch_of_user_agents.list_of_user_agents.length; index++) {
let ua: user_agent = bunch_of_user_agents.list_of_user_agents[index];
export_list.push(ua.label);
export_list.push(ua.user_agent_content);
}
return export_list.join("\n");
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_user_agents.ets#L57-L65
|
7147e2f8e15b99e2aee32ac50af18aa29fad8c27
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_synchronous.ets
|
arkts
|
encryptMessage
|
加密消息
|
function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|CCM');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, ccmParams);
let encryptUpdate = cipher.updateSync(plainText);
// ccm模式加密doFinal时传入空,获得tag数据,并更新至ccmParams对象中。
ccmParams.authTag = cipher.doFinalSync(null);
return encryptUpdate;
}
|
AST#function_declaration#Left function encryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left plainText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob 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 let AST#variable_declarator#Left cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES128|CCM' 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 cipher AST#expression#Right . initSync 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 cryptoFramework AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE AST#member_expression#Right AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left ccmParams 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 encryptUpdate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . updateSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left plainText 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 // ccm模式加密doFinal时传入空,获得tag数据,并更新至ccmParams对象中。 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left ccmParams AST#expression#Right . authTag AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cipher AST#expression#Right . doFinalSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left encryptUpdate AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|CCM');
cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, ccmParams);
let encryptUpdate = cipher.updateSync(plainText);
ccmParams.authTag = cipher.doFinalSync(null);
return encryptUpdate;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_synchronous.ets#L42-L49
|
dc057a23518e6dea34cacb71596e872c1dc8e62f
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/RenderTxtBoxSameLayer_two.ets
|
arkts
|
makeNode
|
必须要重写的方法,用于构建节点数、返回节点数挂载在对应NodeContainer中。 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新。
|
makeNode(uiContext: UIContext): FrameNode | null {
if (this.isDestroy_) { // rootNode为null
return null;
}
if (!this.rootNode) {// rootNode 为undefined时
this.rootNode = new BuilderNode(uiContext, { surfaceId: this.surfaceId_, type: this.renderType_ });
if(this.rootNode) {
this.rootNode.build(
wrapBuilder(textInputBuilder), { textOne: 'myTextInput', width: this.width_, height: this.height_ });
return this.rootNode.getFrameNode();
}else{
return null;
}
}
// 返回FrameNode节点。
return this.rootNode.getFrameNode();
}
|
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#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 . isDestroy_ AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // rootNode为null AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // rootNode 为undefined时 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 . rootNode 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left surfaceId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . surfaceId_ AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . renderType_ AST#member_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#assignment_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 . rootNode 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 this AST#expression#Right . rootNode AST#member_expression#Right AST#expression#Right . build AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left textInputBuilder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left textOne AST#property_name#Right : AST#expression#Left 'myTextInput' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . width_ AST#member_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . height_ AST#member_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#expression_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#member_expression#Left AST#expression#Left this AST#expression#Right . rootNode 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#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_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#if_statement#Right AST#statement#Right // 返回FrameNode节点。 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 . rootNode 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
makeNode(uiContext: UIContext): FrameNode | null {
if (this.isDestroy_) {
return null;
}
if (!this.rootNode) {
this.rootNode = new BuilderNode(uiContext, { surfaceId: this.surfaceId_, type: this.renderType_ });
if(this.rootNode) {
this.rootNode.build(
wrapBuilder(textInputBuilder), { textOne: 'myTextInput', width: this.width_, height: this.height_ });
return this.rootNode.getFrameNode();
}else{
return null;
}
}
return this.rootNode.getFrameNode();
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/RenderTxtBoxSameLayer_two.ets#L62-L78
|
6dd4444084820439486d94cc1aa093929ece9e2c
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
|
arkts
|
setYOffset
|
Sets the used y-axis offset for the labels on this axis. For the legend,
higher offset means the legend as a whole will be placed further away
from the top.
@param yOffset
|
public setYOffset(yOffset: number): void {
this.mYOffset = Utils.convertDpToPixel(yOffset);
}
|
AST#method_declaration#Left public setYOffset AST#parameter_list#Left ( AST#parameter#Left yOffset : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mYOffset AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . convertDpToPixel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left yOffset 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#builder_function_body#Right AST#method_declaration#Right
|
public setYOffset(yOffset: number): void {
this.mYOffset = Utils.convertDpToPixel(yOffset);
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L91-L93
|
f58cb124ca4209cda810df66443c8cf070d55e40
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
|
arkts
|
setLabelXOffset
|
sets the horizontal offset of the y-label
@param xOffset
|
public setLabelXOffset(xOffset: number): void {
this.mXLabelOffset = xOffset;
}
|
AST#method_declaration#Left public setLabelXOffset AST#parameter_list#Left ( AST#parameter#Left xOffset : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mXLabelOffset AST#member_expression#Right = AST#expression#Left xOffset AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setLabelXOffset(xOffset: number): void {
this.mXLabelOffset = xOffset;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L199-L201
|
cd0a4b306b0dffe1f686aeb40aacdb6361837ac4
|
gitee
|
asasugar/HarmoneyNote.git
|
2a7f0eeac701ffc41ed09c3c95244fab1bed7489
|
entry/src/main/ets/view/DetailListComponent.ets
|
arkts
|
DetailListComponent
|
Detail page list component.
|
@Component
export struct DetailListComponent {
build() {
Column() {
List() {
ForEach(BusinessViewModel.getDetailPageListItems(), (item: ListItemData) => {
ListItem() {
Row() {
Text(item.title)
.fontSize($r('app.float.detail_title_size'))
.fontColor($r('app.color.detail_list_title'))
Blank()
Text(item.subTitle)
.fontSize($r('app.float.detail_summary_size'))
.fontColor($r('app.color.detail_list_summary'))
}
.width(CommonConstants.ROW_WIDTH_PERCENT)
.height($r('app.float.detail_list_item_height'))
}
}, (item, index) => index + JSON.stringify(item));
}
.width(CommonConstants.LIST_WIDTH_PERCENT)
.divider({
strokeWidth: $r('app.float.list_divider_width'),
color: $r('app.color.divider')
})
}
.padding({
top: $r('app.float.list_padding_top'),
bottom: $r('app.float.list_padding_bottom'),
left: $r('app.float.column_margin_left'),
right: $r('app.float.column_margin_right')
})
.margin({ top: $r('app.float.list_margin_top') })
.backgroundColor($r('app.color.start_window_background'))
.borderRadius($r('app.float.detail_list_radius'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DetailListComponent 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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left BusinessViewModel AST#expression#Right . getDetailPageListItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_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 ListItemData 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 Row ( ) 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#member_expression#Left AST#expression#Left item AST#expression#Right . title 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 'app.float.detail_title_size' 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.detail_list_title' 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 Blank ( ) 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 . subTitle 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 'app.float.detail_summary_size' 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.detail_list_summary' 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_WIDTH_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.detail_list_item_height' 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#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#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#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 index 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 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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LIST_WIDTH_PERCENT AST#member_expression#Right 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 AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_divider_width' AST#expression#Right ) AST#resource_expression#Right 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.divider' 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#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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_bottom' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.column_margin_left' 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 'app.float.column_margin_right' 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_margin_top' 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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.start_window_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.float.detail_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#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 DetailListComponent {
build() {
Column() {
List() {
ForEach(BusinessViewModel.getDetailPageListItems(), (item: ListItemData) => {
ListItem() {
Row() {
Text(item.title)
.fontSize($r('app.float.detail_title_size'))
.fontColor($r('app.color.detail_list_title'))
Blank()
Text(item.subTitle)
.fontSize($r('app.float.detail_summary_size'))
.fontColor($r('app.color.detail_list_summary'))
}
.width(CommonConstants.ROW_WIDTH_PERCENT)
.height($r('app.float.detail_list_item_height'))
}
}, (item, index) => index + JSON.stringify(item));
}
.width(CommonConstants.LIST_WIDTH_PERCENT)
.divider({
strokeWidth: $r('app.float.list_divider_width'),
color: $r('app.color.divider')
})
}
.padding({
top: $r('app.float.list_padding_top'),
bottom: $r('app.float.list_padding_bottom'),
left: $r('app.float.column_margin_left'),
right: $r('app.float.column_margin_right')
})
.margin({ top: $r('app.float.list_margin_top') })
.backgroundColor($r('app.color.start_window_background'))
.borderRadius($r('app.float.detail_list_radius'))
}
}
|
https://github.com/asasugar/HarmoneyNote.git/blob/2a7f0eeac701ffc41ed09c3c95244fab1bed7489/entry/src/main/ets/view/DetailListComponent.ets#L8-L45
|
a2bbade1ddf61103616158c8e06fec1189c85e69
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/GreetingsPage.ets
|
arkts
|
getOccasionLabel
|
获取场合标签
|
private getOccasionLabel(occasion: GreetingOccasion): string {
const labels: Record<GreetingOccasion, string> = {
[GreetingOccasion.BIRTHDAY]: '生日',
[GreetingOccasion.HOLIDAY]: '节日',
[GreetingOccasion.ANNIVERSARY]: '纪念日',
[GreetingOccasion.GRADUATION]: '毕业',
[GreetingOccasion.OTHER]: '其他'
};
return labels[occasion] || '其他';
}
|
AST#method_declaration#Left private getOccasionLabel AST#parameter_list#Left ( AST#parameter#Left occasion : AST#type_annotation#Left AST#primary_type#Left GreetingOccasion 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 const AST#variable_declarator#Left labels : 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 GreetingOccasion 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 [ AST#expression#Left AST#member_expression#Left AST#expression#Left GreetingOccasion AST#expression#Right . BIRTHDAY AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '生日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left GreetingOccasion AST#expression#Right . HOLIDAY AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '节日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left GreetingOccasion AST#expression#Right . ANNIVERSARY AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '纪念日' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left GreetingOccasion AST#expression#Right . GRADUATION AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '毕业' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left GreetingOccasion AST#expression#Right . OTHER AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '其他' 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#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left labels AST#expression#Right [ AST#expression#Left occasion AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left '其他' 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
|
private getOccasionLabel(occasion: GreetingOccasion): string {
const labels: Record<GreetingOccasion, string> = {
[GreetingOccasion.BIRTHDAY]: '生日',
[GreetingOccasion.HOLIDAY]: '节日',
[GreetingOccasion.ANNIVERSARY]: '纪念日',
[GreetingOccasion.GRADUATION]: '毕业',
[GreetingOccasion.OTHER]: '其他'
};
return labels[occasion] || '其他';
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L652-L661
|
bef69351d66297918d369421737e2ca61d9b69f6
|
github
|
htliang128/arkts_oss.git
|
9da4a87c36272873c649f556854bd793ac337a18
|
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
|
arkts
|
getClientCert
|
Getter and setter for clientCert
|
getClientCert(): http.ClientCert | undefined {
return this.clientCert;
}
|
AST#method_declaration#Left getClientCert AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left http . ClientCert AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined 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 . clientCert AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getClientCert(): http.ClientCert | undefined {
return this.clientCert;
}
|
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L146-L148
|
378cfef6081c3ff03e0a4484f2cd4f56c67f8704
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
|
arkts
|
totalCount
|
获取聊天信息数组长度函数
|
public totalCount(): number {
return this.originDataArray.length;
}
|
AST#method_declaration#Left public totalCount 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 this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public totalCount(): number {
return this.originDataArray.length;
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L63-L65
|
3a6ae5a1f3258de8f4fdebe7b9cd8528a647f602
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
|
arkts
|
getSizeValue
|
获取尺寸适配值
@returns {string} 尺寸值
|
private getSizeValue(): string {
return bp({ sm: "80vp", md: "96vp", lg: "120vp" });
}
|
AST#method_declaration#Left private getSizeValue AST#parameter_list#Left ( ) 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 bp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left sm AST#property_name#Right : AST#expression#Left "80vp" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left md AST#property_name#Right : AST#expression#Left "96vp" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lg AST#property_name#Right : AST#expression#Left "120vp" 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#method_declaration#Right
|
private getSizeValue(): string {
return bp({ sm: "80vp", md: "96vp", lg: "120vp" });
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L268-L270
|
23df3ba2b1529d44df7599ef71287198f5e98a66
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets
|
arkts
|
buildSwitchItem
|
构建开关项
|
@Builder
buildSwitchItem(label: string, value: boolean, onChange: (value: boolean) => void) {
Row() {
Text(label)
.fontSize(UIConstants.FONT_SIZE_BODY)
.fontColor($r('app.color.text_primary'))
.layoutWeight(1)
Toggle({ type: ToggleType.Switch, isOn: value })
.onChange(onChange)
}
.width('100%')
.height('40vp')
.alignItems(VerticalAlign.Center)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSwitchItem AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onChange : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left value : 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#function_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 Text ( AST#expression#Left label AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left UIConstants AST#expression#Right . FONT_SIZE_BODY AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_primary' AST#expression#Right ) AST#resource_expression#Right 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isOn : AST#expression#Left value AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onChange ( AST#expression#Left onChange 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#Left . height ( AST#expression#Left '40vp' AST#expression#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#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
buildSwitchItem(label: string, value: boolean, onChange: (value: boolean) => void) {
Row() {
Text(label)
.fontSize(UIConstants.FONT_SIZE_BODY)
.fontColor($r('app.color.text_primary'))
.layoutWeight(1)
Toggle({ type: ToggleType.Switch, isOn: value })
.onChange(onChange)
}
.width('100%')
.height('40vp')
.alignItems(VerticalAlign.Center)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/ThemeCustomizationPage.ets#L705-L719
|
72797284c3545871335a11571bce4f271be11259
|
github
|
zhangyuhang0914/ArkTs-HarmonyOs.git
|
c9773cad7ebeee413f98ee1a57cc8fba91fecf7d
|
entry/src/main/ets/components/CommonComponents.ets
|
arkts
|
BackHeader
|
通用返回Header组件
|
@Component
export struct BackHeader {
@Prop title: string
@Prop alpha: number
@State statusBarHeight: number = 0
private titleAlignment: TextAlign = TextAlign.Center
private backButton: boolean = true
private onBackClick?: () => void
aboutToAppear() {
this.setSystemStatusBar()
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BackHeader AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right statusBarHeight : 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 titleAlignment : AST#type_annotation#Left AST#primary_type#Left TextAlign AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private backButton : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_declaration#Right private onBackClick ? : AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#ERROR#Left AST#primary_type#Left void AST#primary_type#Right aboutToAppear AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right AST#component_body#Left { AST#method_declaration#Left this AST#ERROR#Left . setSystemStatusBar AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct BackHeader {
@Prop title: string
@Prop alpha: number
@State statusBarHeight: number = 0
private titleAlignment: TextAlign = TextAlign.Center
private backButton: boolean = true
private onBackClick?: () => void
aboutToAppear() {
this.setSystemStatusBar()
}
|
https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/components/CommonComponents.ets#L83-L94
|
d418c039915e1ac5edb7a5606420e02cc3dc4ba2
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpServer.ets
|
arkts
|
sendMessage
|
发送消息到服务端
|
sendMessage() {
if (!this.message) {
Logger.error('Some required fields are missing.');
this.msgHistory += 'Some required fields are missing.' + '\r\n';
return;
}
let tcpMessage: TcpMessage = {
type: 'sendMessage',
message: this.message,
};
workerPort.postMessage(
tcpMessage
);
workerPort.onmessage = (e: MessageEvents) => {
const response: TcpMessage = e.data;
if (response.type === 'send success') {
this.msgHistory += `Sent: ${this.message}\n`;
}
if (response.type === 'send fail') {
this.msgHistory += `Send failed: ` + response.message;
} else if (response.type === 'No client connected') {
this.msgHistory += 'No client connected\n';
}
}
}
|
AST#method_declaration#Left sendMessage 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 AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . message 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Some required fields are missing.' 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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Some required fields are missing.' AST#expression#Right + AST#expression#Left '\r\n' 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#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 tcpMessage : AST#type_annotation#Left AST#primary_type#Left TcpMessage AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 'sendMessage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left workerPort AST#expression#Right . postMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tcpMessage 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 workerPort AST#expression#Right . onmessage AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left MessageEvents 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 response : AST#type_annotation#Left AST#primary_type#Left TcpMessage AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left e 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#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 . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'send success' 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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` Sent: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right \n ` AST#template_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#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 . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'send fail' 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 . msgHistory AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` Send failed: ` AST#template_literal#Right AST#expression#Right + AST#expression#Left response AST#expression#Right AST#binary_expression#Right AST#expression#Right . message 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 else 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 . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'No client connected' 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 . msgHistory AST#member_expression#Right += AST#expression#Left 'No client connected\n' 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#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
|
sendMessage() {
if (!this.message) {
Logger.error('Some required fields are missing.');
this.msgHistory += 'Some required fields are missing.' + '\r\n';
return;
}
let tcpMessage: TcpMessage = {
type: 'sendMessage',
message: this.message,
};
workerPort.postMessage(
tcpMessage
);
workerPort.onmessage = (e: MessageEvents) => {
const response: TcpMessage = e.data;
if (response.type === 'send success') {
this.msgHistory += `Sent: ${this.message}\n`;
}
if (response.type === 'send fail') {
this.msgHistory += `Send failed: ` + response.message;
} else if (response.type === 'No client connected') {
this.msgHistory += 'No client connected\n';
}
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpServer.ets#L223-L251
|
dbf6882b5a4c952362d4451334bcb12a2eb116dc
|
gitee
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_history_index_lite.ets
|
arkts
|
log_head_worker
|
The head of logging information for workers.
@returns "[Meow][bunch_of_history_index]"
|
static log_head_worker() {
return '[Meow][bunch_of_history_index_add_only][Worker]';
}
|
AST#method_declaration#Left static log_head_worker AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '[Meow][bunch_of_history_index_add_only][Worker]' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static log_head_worker() {
return '[Meow][bunch_of_history_index_add_only][Worker]';
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L190-L192
|
eed8bb407adb243b5fc51ba5ccbee95822fabac8
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/components/doc/VHDocPageComponent.ets
|
arkts
|
onDocSwitchStatus
|
@description 是否显示文档
@param switchStatus 状态
|
onDocSwitchStatus(switchStatus: boolean) {
this.showDoc = switchStatus;
}
|
AST#method_declaration#Left onDocSwitchStatus AST#parameter_list#Left ( AST#parameter#Left switchStatus : 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#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 . showDoc AST#member_expression#Right = AST#expression#Left switchStatus AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
onDocSwitchStatus(switchStatus: boolean) {
this.showDoc = switchStatus;
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/doc/VHDocPageComponent.ets#L105-L107
|
76c10bdd58a7ff98a94286420ae2d23764584dc6
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/cigen/CigenWordHelper.ets
|
arkts
|
getRefWords
|
============================================================ 同 CID 的所有单词(wordsOfSameCigen / wordsOfSameCid) ============================================================
|
static async getRefWords(cigen: CigenWord): Promise<Array<WordUser> | null> {
const cid = cigen.cid;
if (!cid) return null;
// 不做缓存,保持与你原 Kotlin 逻辑一致
const list = await CigenWordDbAccess.shared.getCigenWordsByCid(cid);
if (!list || list.length === 0) return null;
const titleSet = new Set<string>();
for (const item of list) {
const title = item.titleEn;
if (title) {
titleSet.add(title);
}
}
return SearchManager.shared.getAliveWords().filter(
word => word.titleEn != null && titleSet.has(word.titleEn)
);
}
|
AST#method_declaration#Left static async getRefWords AST#parameter_list#Left ( AST#parameter#Left cigen : AST#type_annotation#Left AST#primary_type#Left CigenWord 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#union_type#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left WordUser 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#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 cid = AST#expression#Left AST#member_expression#Left AST#expression#Left cigen AST#expression#Right . cid 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#unary_expression#Left ! AST#expression#Left cid AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 不做缓存,保持与你原 Kotlin 逻辑一致 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left list = 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 CigenWordDbAccess AST#expression#Right AST#await_expression#Right AST#expression#Right . shared AST#member_expression#Right AST#expression#Right . getCigenWordsByCid AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cid 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#unary_expression#Left ! AST#expression#Left list AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left list 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left titleSet = 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#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#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#for_statement#Left for ( const item of AST#expression#Left list AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left title = AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . titleEn 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 title 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 titleSet AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left title 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#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#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 . 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 AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleEn 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#Left titleSet AST#expression#Right AST#binary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left word AST#expression#Right . titleEn AST#member_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
|
static async getRefWords(cigen: CigenWord): Promise<Array<WordUser> | null> {
const cid = cigen.cid;
if (!cid) return null;
const list = await CigenWordDbAccess.shared.getCigenWordsByCid(cid);
if (!list || list.length === 0) return null;
const titleSet = new Set<string>();
for (const item of list) {
const title = item.titleEn;
if (title) {
titleSet.add(title);
}
}
return SearchManager.shared.getAliveWords().filter(
word => word.titleEn != null && titleSet.has(word.titleEn)
);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordHelper.ets#L13-L33
|
6e8afe7b47b44687d6aa1919b1ebf77139adfe18
|
github
|
lulululing/calendar.git
|
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
|
entry/src/main/ets/utils/DateUtil.ets
|
arkts
|
getFirstDayOfMonth
|
获取月份第一天是星期几 (0-6, 0代表周日)
|
static getFirstDayOfMonth(year: number, month: number): number {
return new Date(year, month, 1).getDay()
}
|
AST#method_declaration#Left static getFirstDayOfMonth 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#Left month : 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#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#expression#Left year AST#expression#Right , AST#expression#Left month AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getFirstDayOfMonth(year: number, month: number): number {
return new Date(year, month, 1).getDay()
}
|
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L26-L28
|
116e94db050f04420fb75934cca26fe7276ec58e
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/user/RrewardSection.ets
|
arkts
|
RewardSectionComponent
|
Copyright (c) 2022 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.
|
@Component
export struct RewardSectionComponent {
@Builder
options(img: Resource, label: Resource) {
Column() {
Image(img)
.aspectRatio(1)
.width(40)
.objectFit(ImageFit.Contain)
Text(label)
.margin({
top: 12
})
.fontSize(12)
}
.width('25%')
.justifyContent(FlexAlign.Center)
}
build() {
Row() {
this.options($r('app.media.vip_channel'), $r('app.string.point_reward'));
this.options($r('app.media.point_reward'), $r('app.string.interaction'));
this.options($r('app.media.interaction'), $r('app.string.interaction'));
this.options($r('app.media.card_volumn'), $r('app.string.card_volume'));
}
.width('100%')
.padding({
top: 16,
bottom: 16
})
.backgroundColor($r('app.color.white'))
.border({
radius: 16
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct RewardSectionComponent AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right options AST#parameter_list#Left ( AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left label : 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#builder_function_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 Image ( AST#expression#Left img 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 . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain 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 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left label AST#expression#Right ) AST#ui_component#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 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 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 . width ( AST#expression#Left '25%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center 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#builder_function_body#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 Row ( ) AST#container_content_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 . options AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.vip_channel' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.point_reward' 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.point_reward' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.interaction' 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.interaction' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.interaction' 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.card_volumn' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.card_volume' 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#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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 16 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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct RewardSectionComponent {
@Builder
options(img: Resource, label: Resource) {
Column() {
Image(img)
.aspectRatio(1)
.width(40)
.objectFit(ImageFit.Contain)
Text(label)
.margin({
top: 12
})
.fontSize(12)
}
.width('25%')
.justifyContent(FlexAlign.Center)
}
build() {
Row() {
this.options($r('app.media.vip_channel'), $r('app.string.point_reward'));
this.options($r('app.media.point_reward'), $r('app.string.interaction'));
this.options($r('app.media.interaction'), $r('app.string.interaction'));
this.options($r('app.media.card_volumn'), $r('app.string.card_volume'));
}
.width('100%')
.padding({
top: 16,
bottom: 16
})
.backgroundColor($r('app.color.white'))
.border({
radius: 16
})
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/user/RrewardSection.ets#L16-L52
|
a4439e63b54b8c829d75422da425ddc7fd07e073
|
gitee
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/services/NotificationService.ets
|
arkts
|
requestNotificationPermission
|
请求通知权限
|
private async requestNotificationPermission(context: common.UIAbilityContext): Promise<boolean> {
try {
const isEnabled = await notificationManager.isNotificationEnabled();
if (!isEnabled) {
// 引导用户开启通知权限
await notificationManager.requestEnableNotification(context);
}
return await notificationManager.isNotificationEnabled();
} catch (error) {
console.error('[NotificationService] 请求通知权限失败');
return false;
}
}
|
AST#method_declaration#Left private async requestNotificationPermission 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 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left isEnabled = 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 notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . isNotificationEnabled 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#unary_expression#Left ! AST#expression#Left isEnabled AST#expression#Right AST#unary_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#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestEnableNotification AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left notificationManager AST#expression#Right AST#await_expression#Right AST#expression#Right . isNotificationEnabled 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#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 '[NotificationService] 请求通知权限失败' 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#boolean_literal#Left false AST#boolean_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 AST#method_declaration#Right
|
private async requestNotificationPermission(context: common.UIAbilityContext): Promise<boolean> {
try {
const isEnabled = await notificationManager.isNotificationEnabled();
if (!isEnabled) {
await notificationManager.requestEnableNotification(context);
}
return await notificationManager.isNotificationEnabled();
} catch (error) {
console.error('[NotificationService] 请求通知权限失败');
return false;
}
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L89-L101
|
ddea3e944bb0a5a6265fec24bf8d02e129257b31
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/TimeConversion.ets
|
arkts
|
timeToMillisecond
|
Converts the time units obtained in the time selection component to milliseconds
|
timeToMillisecond(hour: number, minute: number) {
let nowTime: Date = new Date
let nowAllTime: number = nowTime.getHours() * HOUR_SECONDS + nowTime.getMinutes() *
MINUTES_SECONDS + nowTime.getSeconds()
let selectAllTime: number = (hour * HOUR_SECONDS + minute * MINUTES_SECONDS)
let delayTime: number = selectAllTime - nowAllTime >= 0 ? selectAllTime - nowAllTime :
DAY_SECONDS - (nowAllTime - selectAllTime)
Logger.info(TAG, `this vibratorTime is ${delayTime}`)
return (delayTime - 2)
}
|
AST#method_declaration#Left timeToMillisecond AST#parameter_list#Left ( AST#parameter#Left hour : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left minute : 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#variable_declaration#Left let AST#variable_declarator#Left nowTime : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_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 nowAllTime : 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 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 AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left nowTime AST#expression#Right . getHours 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 HOUR_SECONDS AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left nowTime AST#expression#Right AST#binary_expression#Right AST#expression#Right . getMinutes 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 MINUTES_SECONDS AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left nowTime AST#expression#Right AST#binary_expression#Right AST#expression#Right . getSeconds 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 selectAllTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#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 hour AST#expression#Right * AST#expression#Left HOUR_SECONDS AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left minute AST#expression#Right * AST#expression#Left MINUTES_SECONDS 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#ERROR#Left let delayTime : 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#binary_expression#Left AST#expression#Left selectAllTime AST#expression#Right - AST#expression#Left nowAllTime AST#expression#Right AST#binary_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_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#binary_expression#Left AST#expression#Left selectAllTime AST#expression#Right - AST#expression#Left nowAllTime AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left : DAY_SECONDS AST#ERROR#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left nowAllTime AST#expression#Right - AST#expression#Left selectAllTime 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#ERROR#Left Logger AST#ERROR#Right . info 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 ` this vibratorTime is AST#template_substitution#Left $ { AST#expression#Left delayTime 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#ERROR#Left return AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left delayTime AST#expression#Right - AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right } AST#block_statement#Right AST#method_declaration#Right
|
timeToMillisecond(hour: number, minute: number) {
let nowTime: Date = new Date
let nowAllTime: number = nowTime.getHours() * HOUR_SECONDS + nowTime.getMinutes() *
MINUTES_SECONDS + nowTime.getSeconds()
let selectAllTime: number = (hour * HOUR_SECONDS + minute * MINUTES_SECONDS)
let delayTime: number = selectAllTime - nowAllTime >= 0 ? selectAllTime - nowAllTime :
DAY_SECONDS - (nowAllTime - selectAllTime)
Logger.info(TAG, `this vibratorTime is ${delayTime}`)
return (delayTime - 2)
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/TaskManagement/ReminderAgentManager/entry/src/main/ets/util/TimeConversion.ets#L27-L36
|
9b4c07f7878027ee5a81f7267453d5c478966ac1
|
gitee
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
|
arkts
|
keys
|
Set the key value.
@since 10
|
static keys(): Array<string> {
throw new Error("PersistentStorage.keys is not implemented")
}
|
AST#method_declaration#Left static keys AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#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 "PersistentStorage.keys is not implemented" 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#method_declaration#Right
|
static keys(): Array<string> {
throw new Error("PersistentStorage.keys is not implemented")
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L420-L422
|
ffcc61d9da7772c53249a9030181510b914373ef
|
gitee
|
common-apps/ZRouter
|
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
|
RouterApi/src/main/ets/animation/param/RotateAnimateOptions.ets
|
arkts
|
@author: HHBin
@date: 2024-11-23
@desc: 旋转动画
|
export class RotateAnimateOptions implements INavAnimateOptions {
_options?: RotateOptions;
_isBeforePage: boolean = false
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class RotateAnimateOptions AST#implements_clause#Left implements INavAnimateOptions AST#implements_clause#Right { AST#property_declaration#Left _options ? : AST#type_annotation#Left AST#primary_type#Left RotateOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right _isBeforePage : 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#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export class RotateAnimateOptions implements INavAnimateOptions {
_options?: RotateOptions;
_isBeforePage: boolean = false
constructor
|
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/param/RotateAnimateOptions.ets#L10-L14
|
661b52bdae42a4eff2484b19df34883d082d1c73
|
gitee
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
|
arkts
|
calculate
|
Calculates the minimum / maximum and range values of the axis with the given
minimum and maximum values from the chart data.
@param dataMin the min value according to chart data
@param dataMax the max value according to chart data
|
public calculate(dataMin: number, dataMax: number): void {
// if custom, use value as is, else use data value
var min: number = this.mCustomAxisMin ? this.mAxisMinimum : dataMin - this.mSpaceMin;
var max: number = this.mCustomAxisMax ? this.mAxisMaximum : dataMax + this.mSpaceMax;
// temporary range (before calculations)
var range: number = Math.abs(max - min);
// in case all values are equal
if (range == 0) {
max = max + 1;
min = min - 1;
}
this.mAxisMinimum = min;
this.mAxisMaximum = max;
// actual range
this.mAxisRange = Math.abs(max - min);
}
|
AST#method_declaration#Left public calculate AST#parameter_list#Left ( AST#parameter#Left dataMin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dataMax : 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 { // if custom, use value as is, else use data value AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMin AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisMinimum AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left dataMin AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . mSpaceMin 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 var AST#variable_declarator#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mCustomAxisMax AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mAxisMaximum AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left dataMax AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . mSpaceMax AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // temporary range (before calculations) AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left range : 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 AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right - AST#expression#Left min 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 // in case all values are equal AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left range 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left max = AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right + AST#expression#Left 1 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#assignment_expression#Left min = AST#expression#Left AST#binary_expression#Left AST#expression#Left min AST#expression#Right - AST#expression#Left 1 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#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 . mAxisMinimum AST#member_expression#Right = AST#expression#Left min 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 . mAxisMaximum AST#member_expression#Right = AST#expression#Left max AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // actual range 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 . mAxisRange AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left max AST#expression#Right - AST#expression#Left min AST#expression#Right AST#binary_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#method_declaration#Right
|
public calculate(dataMin: number, dataMax: number): void {
var min: number = this.mCustomAxisMin ? this.mAxisMinimum : dataMin - this.mSpaceMin;
var max: number = this.mCustomAxisMax ? this.mAxisMaximum : dataMax + this.mSpaceMax;
var range: number = Math.abs(max - min);
if (range == 0) {
max = max + 1;
min = min - 1;
}
this.mAxisMinimum = min;
this.mAxisMaximum = max;
this.mAxisRange = Math.abs(max - min);
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L754-L773
|
3fd1557af902f23b3fcf3b342c80fc10b1e69e88
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/components/timer/TimerDialog.ets
|
arkts
|
closeDialog
|
关闭窗口
|
private closeDialog() {
this.stopTimer();
this.showTimerDialog = false;
}
|
AST#method_declaration#Left private closeDialog 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 . stopTimer 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showTimerDialog 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
|
private closeDialog() {
this.stopTimer();
this.showTimerDialog = false;
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L51-L54
|
010bcf8720dd653711e86d673c3fbb25b83e2773
|
gitee
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/user/src/main/ets/view/ProfilePage.ets
|
arkts
|
ProfileContent
|
个人中心页面内容视图
@returns {void} 无返回值
|
@Builder
private ProfileContent(): void {
Scroll() {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
top: $r("app.float.space_vertical_medium")
}
}) {
this.ProfileBaseInfoCard();
SpaceVerticalMedium();
SpaceVerticalSmall();
this.SectionTitle($r("app.string.account_info"));
SpaceVerticalMedium();
this.AccountInfoCard();
SpaceVerticalMedium();
SpaceVerticalSmall();
this.SectionTitle($r("app.string.social_account"));
SpaceVerticalMedium();
this.SocialAccountCard();
SpaceVerticalMedium();
SpaceVerticalSmall();
this.SectionTitle($r("app.string.security"));
SpaceVerticalMedium();
this.SecurityCard();
SpaceVerticalMedium();
this.LogoutCard();
}
}
.scrollBar(BarState.Off);
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ProfileContent 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : 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 "app.float.space_horizontal_medium" 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 "app.float.space_horizontal_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_vertical_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_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 . ProfileBaseInfoCard 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; 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 this AST#expression#Right . SectionTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.account_info" 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; 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 this AST#expression#Right . AccountInfoCard 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; 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 this AST#expression#Right . SectionTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.social_account" 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; 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 this AST#expression#Right . SocialAccountCard 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; 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 this AST#expression#Right . SectionTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.security" 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; 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 this AST#expression#Right . SecurityCard 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#ui_custom_component_statement#Left SpaceVerticalMedium ( ) ; 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 this AST#expression#Right . LogoutCard 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#ui_element_with_modifiers#Right AST#arkts_ui_element#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#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
|
@Builder
private ProfileContent(): void {
Scroll() {
ColumnStart({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
top: $r("app.float.space_vertical_medium")
}
}) {
this.ProfileBaseInfoCard();
SpaceVerticalMedium();
SpaceVerticalSmall();
this.SectionTitle($r("app.string.account_info"));
SpaceVerticalMedium();
this.AccountInfoCard();
SpaceVerticalMedium();
SpaceVerticalSmall();
this.SectionTitle($r("app.string.social_account"));
SpaceVerticalMedium();
this.SocialAccountCard();
SpaceVerticalMedium();
SpaceVerticalSmall();
this.SectionTitle($r("app.string.security"));
SpaceVerticalMedium();
this.SecurityCard();
SpaceVerticalMedium();
this.LogoutCard();
}
}
.scrollBar(BarState.Off);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L54-L91
|
a9eef05a629ee8e9305137566d4ee9f6313497d6
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
common full length.
|
export const FULL_LENGTH = '100%';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left FULL_LENGTH = AST#expression#Left '100%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const FULL_LENGTH = '100%';
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L33-L33
|
cfe16bec6ed136a25b1e2ccd88062e176864b1a9
|
gitee
|
|
wasd09090030/MyHongmengProject.git
|
a8ed386b658ceeac69ef5bc42a92d78c7980821c
|
entry/src/main/ets/models/TaskModel.ets
|
arkts
|
任务数据模型
|
export interface TaskItem {
id: string;
name: string;
estimatedTime: number; // 预估时长(秒)
actualTime?: number; // 实际用时(秒)
completedTime?: number; // 完成时间戳
status: 'pending' | 'completed';
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TaskItem AST#object_type#Left { AST#type_member#Left id : 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 name : 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 estimatedTime : 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 actualTime ? : 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 completedTime ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 完成时间戳 AST#ERROR#Left status : 'pending' | 'completed' ; AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface TaskItem {
id: string;
name: string;
estimatedTime: number;
actualTime?: number;
completedTime?: number;
status: 'pending' | 'completed';
}
|
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L4-L11
|
4461de0e85af68726dfe14a611e1b85e18c6c4c3
|
github
|
|
JackJiang2011/harmonychat.git
|
bca3f3e1ce54d763720510f99acf595a49e37879
|
entry/src/main/ets/pages/components/ChatTitleBar.ets
|
arkts
|
CustomeTitleBar
|
聊天界面的自定义标题栏组件。
@author Jack Jiang(http://www.52im.net/thread-2792-1-1.html)
|
@Preview
@Component
export struct CustomeTitleBar {
// 连接状态:false 连接断开、true 连接正常
@Prop connectStatus: boolean;
@Prop keepAliveStatus: boolean;
// 返回按钮图片
backImg: Resource = $r("app.media.widget_title_btn_back_normal");
build() {
Column() {
Row() {
Row() {
Text('HarmonyChat')
.textAlign(TextAlign.Start)
.fontSize(22)
.maxLines(1)
.fontColor(Color.Black)
.fontWeight(500)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({overflow: TextOverflow.Ellipsis})
Text('鸿蒙')
.fontFamily('HarmonyHeiTi')
.fontColor(Color.White)
.fontSize(11)
.fontWeight(400)
// .backgroundColor('#e50a59f7')
.backgroundColor(Color.Black)
.padding({top:3, bottom:3, left: 4, right: 4})
.borderRadius(5)
.margin({left: 3})
Text('v1.0')
.fontSize(10)
.fontColor('#999')
.margin({left: 5})
}
.layoutWeight(1)
Row() {
// Image($r(this.connectStatus ? (this.keepAliveStatus ? 'app.media.ic_net_status_light': 'app.media.ic_net_status_ok') : 'app.media.ic_net_status_warn'))
// .width(12)
// .height(12)
// .objectFit(ImageFit.Fill)
// .margin({right: 5})
Text()
.width(12)
.height(12)
.borderRadius(6)
.margin({right: 5})
.backgroundColor(this.connectStatus ? (this.keepAliveStatus ? '#f1f515': '#00de7a') : '#ff8c6f')// '#00de7a'
.border({width: 1, color: (this.connectStatus ? (this.keepAliveStatus ? '#d1d505': '#00c86e') : '#f26c4f'), radius: 6})
.shadow({
radius: 15, // 模糊半径
color: this.keepAliveStatus ? "#59f1f515" : '#00ffffff', // 阴影颜色
offsetX: 0, // X轴偏移量
offsetY: 15 // Y轴偏移量
})
Text('UID:')
.textAlign(TextAlign.Start)
.fontSize(13)
.maxLines(1)
.fontColor(Color.Black)
.fontWeight(500)
.margin({right: 2})
Text(ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId)
// .width(40)
.constraintSize({maxWidth: 42})
.fontSize(13)
.fontColor('#505256')
.maxLines(2)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
}
.height(58)
.padding({left: 10, right: 10})
this.BottomLine()
// if(!this.connectStatus) {
Row() {
LoadingProgress().width(20).height(20).margin({ right: 8 }).color('#ff6434')
// Image($r('app.media.ic_disconnect_info2'))
// .width(14)
// .height(14)
// .objectFit(ImageFit.Fill)
// .margin({right: 8})
Text('网络不给力,正在努力恢复中…')
.maxLines(1)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontColor('#ff6434')
.fontSize(14)
}
.width('100%')
.height(40)
.backgroundColor('#fff0eb')
.justifyContent(FlexAlign.Center)
.visibility(this.connectStatus ? Visibility.None : Visibility.Visible)
.animation({
duration: 250,
curve: Curve.EaseInOut,
iterations: 1,
playMode: PlayMode.Normal
})
// }
}
.width('100%')
.backgroundColor(ToolKits.chat_page_title_background_color)//'#2e3746')
// .linearGradient({
// direction:GradientDirection.Right,// 渐变方向
// colors:[['#2e3746',0],['#0e1a26',1]]
// })
// .shadow({
// radius: 6, // 模糊半径
// color: "#ffff0000", // 阴影颜色
// offsetX: 0, // X轴偏移量
// offsetY: 10 // Y轴偏移量
// })
}
@Builder
BottomLine() {
Line()
.height('1px')
.width('100%')
.backgroundColor('#dbdbdb')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CustomeTitleBar AST#component_body#Left { // 连接状态:false 连接断开、true 连接正常 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right connectStatus : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right keepAliveStatus : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 返回按钮图片 AST#property_declaration#Left backImg : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.widget_title_btn_back_normal" AST#expression#Right ) AST#resource_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 Row ( ) AST#container_content_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 Text ( AST#expression#Left 'HarmonyChat' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 22 AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 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 500 AST#expression#Right ) AST#modifier_chain_expression#Left . ellipsisMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left EllipsisMode AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_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#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 . fontFamily ( AST#expression#Left 'HarmonyHeiTi' 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 . fontSize ( AST#expression#Left 11 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 400 AST#expression#Right ) // .backgroundColor('#e50a59f7') AST#modifier_chain_expression#Left . backgroundColor ( 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 . padding ( 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#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left 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#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 Text ( AST#expression#Left 'v1.0' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 5 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 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 Row ( ) AST#container_content_body#Left { // Image($r(this.connectStatus ? (this.keepAliveStatus ? 'app.media.ic_net_status_light': 'app.media.ic_net_status_ok') : 'app.media.ic_net_status_warn')) // .width(12) // .height(12) // .objectFit(ImageFit.Fill) // .margin({right: 5}) 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 . width ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 6 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . connectStatus AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keepAliveStatus AST#member_expression#Right AST#expression#Right ? AST#expression#Left '#f1f515' AST#expression#Right : AST#expression#Left '#00de7a' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : AST#expression#Left '#ff8c6f' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) // '#00de7a' AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width 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#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . connectStatus AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keepAliveStatus AST#member_expression#Right AST#expression#Right ? AST#expression#Left '#d1d505' AST#expression#Right : AST#expression#Left '#00c86e' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : AST#expression#Left '#f26c4f' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , // 模糊半径 AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . keepAliveStatus AST#member_expression#Right AST#expression#Right ? AST#expression#Left "#59f1f515" AST#expression#Right : AST#expression#Left '#00ffffff' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , // 阴影颜色 AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // X轴偏移量 AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right // Y轴偏移量 } 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#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 'UID:' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 13 AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 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 500 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 2 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#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#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ClientCoreSDK 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 . currentLoginInfo AST#member_expression#Right AST#expression#Right ?. loginUserId AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right // .width(40) AST#modifier_chain_expression#Left . constraintSize ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left maxWidth AST#property_name#Right : AST#expression#Left 42 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 13 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#505256' AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . ellipsisMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left EllipsisMode AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_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#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 58 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 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . BottomLine 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 // if(!this.connectStatus) { 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 LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right 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 . color ( AST#expression#Left '#ff6434' 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 // Image($r('app.media.ic_disconnect_info2')) // .width(14) // .height(14) // .objectFit(ImageFit.Fill) // .margin({right: 8}) 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 . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . ellipsisMode ( AST#expression#Left AST#member_expression#Left AST#expression#Left EllipsisMode AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ff6434' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#fff0eb' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center 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 this AST#expression#Right . connectStatus 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#Left . animation ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 250 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#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left playMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Normal AST#member_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#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left ToolKits AST#expression#Right . chat_page_title_background_color 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 //'#2e3746') // .linearGradient({ // direction:GradientDirection.Right,// 渐变方向 // colors:[['#2e3746',0],['#0e1a26',1]] // }) // .shadow({ // radius: 6, // 模糊半径 // color: "#ffff0000", // 阴影颜色 // offsetX: 0, // X轴偏移量 // offsetY: 10 // Y轴偏移量 // }) } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right BottomLine 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 Line ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '1px' 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 '#dbdbdb' 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#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Preview
@Component
export struct CustomeTitleBar {
@Prop connectStatus: boolean;
@Prop keepAliveStatus: boolean;
backImg: Resource = $r("app.media.widget_title_btn_back_normal");
build() {
Column() {
Row() {
Row() {
Text('HarmonyChat')
.textAlign(TextAlign.Start)
.fontSize(22)
.maxLines(1)
.fontColor(Color.Black)
.fontWeight(500)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({overflow: TextOverflow.Ellipsis})
Text('鸿蒙')
.fontFamily('HarmonyHeiTi')
.fontColor(Color.White)
.fontSize(11)
.fontWeight(400)
.backgroundColor(Color.Black)
.padding({top:3, bottom:3, left: 4, right: 4})
.borderRadius(5)
.margin({left: 3})
Text('v1.0')
.fontSize(10)
.fontColor('#999')
.margin({left: 5})
}
.layoutWeight(1)
Row() {
Text()
.width(12)
.height(12)
.borderRadius(6)
.margin({right: 5})
.backgroundColor(this.connectStatus ? (this.keepAliveStatus ? '#f1f515': '#00de7a') : '#ff8c6f')
.border({width: 1, color: (this.connectStatus ? (this.keepAliveStatus ? '#d1d505': '#00c86e') : '#f26c4f'), radius: 6})
.shadow({
radius: 15,
color: this.keepAliveStatus ? "#59f1f515" : '#00ffffff',
offsetX: 0,
offsetY: 15
})
Text('UID:')
.textAlign(TextAlign.Start)
.fontSize(13)
.maxLines(1)
.fontColor(Color.Black)
.fontWeight(500)
.margin({right: 2})
Text(ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId)
.constraintSize({maxWidth: 42})
.fontSize(13)
.fontColor('#505256')
.maxLines(2)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
}
.height(58)
.padding({left: 10, right: 10})
this.BottomLine()
Row() {
LoadingProgress().width(20).height(20).margin({ right: 8 }).color('#ff6434')
Text('网络不给力,正在努力恢复中…')
.maxLines(1)
.ellipsisMode(EllipsisMode.CENTER)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontColor('#ff6434')
.fontSize(14)
}
.width('100%')
.height(40)
.backgroundColor('#fff0eb')
.justifyContent(FlexAlign.Center)
.visibility(this.connectStatus ? Visibility.None : Visibility.Visible)
.animation({
duration: 250,
curve: Curve.EaseInOut,
iterations: 1,
playMode: PlayMode.Normal
})
}
.width('100%')
.backgroundColor(ToolKits.chat_page_title_background_color)
)
// radius: 6,
// color: "#ffff0000",
// offsetX: 0,
// offsetY: 10
)
}
@Builder
BottomLine() {
Line()
.height('1px')
.width('100%')
.backgroundColor('#dbdbdb')
}
}
|
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/components/ChatTitleBar.ets#L19-L157
|
6cad832276fbe059d3bfdf2ad27741e7beefa84a
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/MonthDataSource.ets
|
arkts
|
should be insert by ui-plugins
|
export interface Month {
month: string; // 具体年月
num: number; // 月份
days: number[]; // 该月日期
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Month AST#object_type#Left { AST#type_member#Left month : 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 num : 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 days : 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#type_member#Right ; // 该月日期 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface Month {
month: string;
num: number;
days: number[];
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/MonthDataSource.ets#L35-L39
|
47193cf84e7c69b83796feabf2b6aa8a8e2c41ad
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets
|
arkts
|
SubCategoryGrid
|
子分类网格
|
@Builder
SubCategoryGrid(children: CategoryChild[]) {
Grid() {
ForEach(children, (child: CategoryChild) => {
GridItem() {
Column({ space: AppDimensions.spaceXSmall }) {
Image(child.pic)
.width('100%')
.aspectRatio(1)
.borderRadius(AppDimensions.radiusMedium)
.objectFit(ImageFit.Cover)
Text(child.name)
.fontSize(AppTypography.fontSizeSmall)
.fontColor(AppColors.textPrimary)
.textAlign(TextAlign.Center)
.width('100%')
}
.width('100%')
.padding(AppDimensions.paddingSmall)
}
})
}
.columnsTemplate('1fr 1fr 1fr')
.rowsGap(AppDimensions.spaceMedium)
.columnsGap(AppDimensions.spaceMedium)
.width('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SubCategoryGrid AST#parameter_list#Left ( AST#parameter#Left children : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CategoryChild [ ] AST#array_type#Right 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 Grid ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left children AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left child : AST#type_annotation#Left AST#primary_type#Left CategoryChild 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 GridItem ( ) 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 AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceXSmall 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left child AST#expression#Right . pic AST#member_expression#Right 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 . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . radiusMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover 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 child AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeSmall AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary 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#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 '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . paddingSmall 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#ui_element_with_modifiers#Right AST#arkts_ui_element#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 . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceMedium AST#member_expression#Right 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#builder_function_body#Right AST#method_declaration#Right
|
@Builder
SubCategoryGrid(children: CategoryChild[]) {
Grid() {
ForEach(children, (child: CategoryChild) => {
GridItem() {
Column({ space: AppDimensions.spaceXSmall }) {
Image(child.pic)
.width('100%')
.aspectRatio(1)
.borderRadius(AppDimensions.radiusMedium)
.objectFit(ImageFit.Cover)
Text(child.name)
.fontSize(AppTypography.fontSizeSmall)
.fontColor(AppColors.textPrimary)
.textAlign(TextAlign.Center)
.width('100%')
}
.width('100%')
.padding(AppDimensions.paddingSmall)
}
})
}
.columnsTemplate('1fr 1fr 1fr')
.rowsGap(AppDimensions.spaceMedium)
.columnsGap(AppDimensions.spaceMedium)
.width('100%')
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets#L142-L169
|
67e3b0da3a0135dccdbf0a74244f6d9c19accdb2
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
GraphicImage/GestureScreenshot/entry/src/main/ets/view/AreaScreenshot.ets
|
arkts
|
AreaScreenShot
|
Custom component to determine the screenshot area.
|
@Component
export default struct AreaScreenShot {
@Link showScreen: boolean;
@Link pixelMap: image.PixelMap;
@Link scaleNum: ScaleInterface;
private screenAspectRatio: number = 0;
dialogController: CustomDialogController = new CustomDialogController({
builder: ScreenshotDialog({
pixelMap: this.pixelMap,
screenAspectRatio: this.screenAspectRatio
}),
alignment: DialogAlignment.BottomEnd,
customStyle: true
});
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private canvasRenderingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private systemBarHeight: number = 0;
aboutToAppear() {
window.getLastWindow(getContext(this))
.then((window) => {
let property = window.getWindowProperties();
this.systemBarHeight = property.windowRect.top;
drawUtil.initDrawUtil(
this.canvasRenderingContext,
px2vp(property.windowRect.width),
px2vp(property.windowRect.height)
);
offsetModel.initOffsetModel(
px2vp(property.windowRect.width),
px2vp(property.windowRect.height)
);
this.screenAspectRatio = px2vp(property.windowRect.height) / px2vp(property.windowRect.width);
})
.catch((err: Error) => {
Logger.error(`window loading has error: ${JSON.stringify(err)}`);
})
}
private resetParameter() {
this.showScreen = false;
this.scaleNum = {
x: CommonConstants.NO_SCALE_DOWN,
y: CommonConstants.NO_SCALE_DOWN
};
offsetModel.resetDefaultOffSet();
}
build() {
if (this.showScreen) {
Stack() {
Canvas(this.canvasRenderingContext)
.width(CommonConstants.FULL_PARAM)
.height(CommonConstants.FULL_PARAM)
.onReady(() => {
drawUtil.draw();
})
Row() {
Row() {
Image($r('app.media.ic_back'))
.height($r('app.float.toolbar_item_height'))
.onClick(() => {
this.resetParameter();
})
Button($r('app.string.cancel_areaScreenshot'))
.backgroundColor($r('app.color.toolbar_color'))
.fontSize($r('app.float.cancel_font_size'))
.fontColor($r('app.color.cancel_font_color'))
.onClick(() => {
this.resetParameter();
})
}
.backgroundColor($r('app.color.toolbar_color'))
Image($r('app.media.ic_save'))
.onClick(() => {
let screenshotOptions: screenshot.ScreenshotOptions = {
screenRect: {
left: vp2px(offsetModel.getXLeft()),
top: vp2px(offsetModel.getYTop()) + this.systemBarHeight,
width: vp2px(offsetModel.getWidth()),
height: vp2px(offsetModel.getHeight())
} as screenshot.Rect,
imageSize: {
width: vp2px(offsetModel.getWidth()),
height: vp2px(offsetModel.getHeight())
} as screenshot.Size,
rotation: 0,
displayId: 0
};
screenshot.save(screenshotOptions, (err: Error, data: image.PixelMap) => {
if (err) {
Logger.error(`Failed to save the screenshot. Error:${JSON.stringify(err)}`);
}
if (this.pixelMap !== undefined) {
this.pixelMap.release();
}
this.pixelMap = data;
this.dialogController.open();
});
this.resetParameter();
})
.height($r('app.float.toolbar_item_height'))
}
.backgroundColor($r('app.color.toolbar_color'))
.width(CommonConstants.TOOLBAR_WIDTH)
.justifyContent(FlexAlign.SpaceBetween)
}
.width(CommonConstants.FULL_PARAM)
.height(CommonConstants.FULL_PARAM)
.alignContent(Alignment.Top)
.onTouch((event: TouchEvent) => {
switch (event.type) {
case TouchType.Down:
offsetModel.setXLocationType(event.touches[0].screenX);
offsetModel.setYLocationType(event.touches[0].screenY);
break;
case TouchType.Move:
offsetModel.resetOffsetXY(event.touches[0].screenX, event.touches[0].screenY);
drawUtil.draw();
break;
default:
break;
}
})
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct AreaScreenShot AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right showScreen : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right scaleNum : AST#type_annotation#Left AST#primary_type#Left ScaleInterface AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private screenAspectRatio : 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 dialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController 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 CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( 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 ScreenshotDialog AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left pixelMap AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left screenAspectRatio AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . screenAspectRatio AST#member_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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . BottomEnd AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customStyle 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#property_declaration#Right AST#property_declaration#Left private settings : AST#type_annotation#Left AST#primary_type#Left RenderingContextSettings 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 RenderingContextSettings AST#expression#Right AST#new_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#property_declaration#Right AST#property_declaration#Left private canvasRenderingContext : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D 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 CanvasRenderingContext2D AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . settings AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private systemBarHeight : 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 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 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 window AST#expression#Right . getLastWindow AST#member_expression#Right AST#expression#Right AST#argument_list#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 ) AST#argument_list#Right AST#call_expression#Right 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 window AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left property = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . getWindowProperties 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . systemBarHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left property AST#expression#Right . windowRect AST#member_expression#Right AST#expression#Right . top 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 drawUtil AST#expression#Right . initDrawUtil 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 . canvasRenderingContext AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left property AST#expression#Right . windowRect AST#member_expression#Right AST#expression#Right . width AST#member_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 px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left property AST#expression#Right . windowRect 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#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 offsetModel AST#expression#Right . initOffsetModel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left property AST#expression#Right . windowRect AST#member_expression#Right AST#expression#Right . width AST#member_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 px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left property AST#expression#Right . windowRect 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#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 . screenAspectRatio AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left property AST#expression#Right . windowRect 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#Left px2vp AST#expression#Right AST#binary_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 property AST#expression#Right . windowRect AST#member_expression#Right AST#expression#Right . width 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#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#type_annotation#Left AST#primary_type#Left Error 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` window loading has error: 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#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#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private resetParameter AST#parameter_list#Left ( ) 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 . showScreen 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 . scaleNum AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . NO_SCALE_DOWN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . NO_SCALE_DOWN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_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 offsetModel AST#expression#Right . resetDefaultOffSet 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 AST#ERROR#Left build ( ) AST#ERROR#Left { if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showScreen AST#member_expression#Right AST#expression#Right ) { AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . canvasRenderingContext 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 CommonConstants AST#expression#Right . FULL_PARAM AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARAM AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onReady ( 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 drawUtil AST#expression#Right . draw 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#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 Row ( ) AST#container_content_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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_back' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.toolbar_item_height' AST#expression#Right ) AST#resource_expression#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 this AST#expression#Right . resetParameter 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#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#resource_expression#Left $r ( AST#expression#Left 'app.string.cancel_areaScreenshot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.toolbar_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.cancel_font_size' 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.cancel_font_color' AST#expression#Right ) AST#resource_expression#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 this AST#expression#Right . resetParameter 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#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.toolbar_color' 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#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.ic_save' AST#expression#Right ) AST#resource_expression#Right 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#variable_declaration#Left let AST#variable_declarator#Left screenshotOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left screenshot . ScreenshotOptions 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 screenRect AST#property_name#Right : AST#expression#Left AST#as_expression#Left 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 vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offsetModel AST#expression#Right . getXLeft 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offsetModel AST#expression#Right . getYTop 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#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . systemBarHeight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offsetModel AST#expression#Right . getWidth 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offsetModel AST#expression#Right . getHeight 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left screenshot . Rect AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageSize AST#property_name#Right : AST#expression#Left AST#as_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offsetModel AST#expression#Right . getWidth 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left vp2px AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left offsetModel AST#expression#Right . getHeight 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left screenshot . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left rotation AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left displayId AST#property_name#Right : AST#expression#Left 0 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 screenshot AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left screenshotOptions AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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 err 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to save the screenshot. Error: 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#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 this AST#expression#Right . pixelMap 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#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 . pixelMap AST#member_expression#Right 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#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 . pixelMap AST#member_expression#Right = AST#expression#Left data 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 . dialogController AST#member_expression#Right AST#expression#Right . open 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 this AST#expression#Right . resetParameter 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.toolbar_item_height' 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#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.toolbar_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOOLBAR_WIDTH 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 . SpaceBetween 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 } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARAM AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PARAM AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onTouch AST#ERROR#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#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 AST#member_expression#Left AST#expression#Left event AST#expression#Right . type 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#property_name#Left case AST#property_name#Right Touch Type AST#ERROR#Right AST#modifier_chain_expression#Left . Down 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#ERROR#Left AST#qualified_type#Left offsetModel . setXLocationType AST#qualified_type#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left event . touches AST#ERROR#Left [ 0 ] AST#ERROR#Right . screenX AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; of fsetModel . setYLocation Type AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left event . touches AST#ERROR#Left [ 0 ] AST#ERROR#Right . screenY AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; break ; case Touch Type . Move : AST#ERROR#Left AST#qualified_type#Left offsetModel . resetOffsetXY AST#qualified_type#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left event . touches AST#ERROR#Left [ 0 ] AST#ERROR#Right . screenX AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right , event . touches AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#ERROR#Left 0 AST#ERROR#Right ] AST#tuple_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left . screenY AST#ERROR#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; drawUtil . draw AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; break ; default AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left break AST#primary_type#Right AST#type_annotation#Right ; } } ) } } AST#ERROR#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct AreaScreenShot {
@Link showScreen: boolean;
@Link pixelMap: image.PixelMap;
@Link scaleNum: ScaleInterface;
private screenAspectRatio: number = 0;
dialogController: CustomDialogController = new CustomDialogController({
builder: ScreenshotDialog({
pixelMap: this.pixelMap,
screenAspectRatio: this.screenAspectRatio
}),
alignment: DialogAlignment.BottomEnd,
customStyle: true
});
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private canvasRenderingContext: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private systemBarHeight: number = 0;
aboutToAppear() {
window.getLastWindow(getContext(this))
.then((window) => {
let property = window.getWindowProperties();
this.systemBarHeight = property.windowRect.top;
drawUtil.initDrawUtil(
this.canvasRenderingContext,
px2vp(property.windowRect.width),
px2vp(property.windowRect.height)
);
offsetModel.initOffsetModel(
px2vp(property.windowRect.width),
px2vp(property.windowRect.height)
);
this.screenAspectRatio = px2vp(property.windowRect.height) / px2vp(property.windowRect.width);
})
.catch((err: Error) => {
Logger.error(`window loading has error: ${JSON.stringify(err)}`);
})
}
private resetParameter() {
this.showScreen = false;
this.scaleNum = {
x: CommonConstants.NO_SCALE_DOWN,
y: CommonConstants.NO_SCALE_DOWN
};
offsetModel.resetDefaultOffSet();
}
build() {
if (this.showScreen) {
Stack() {
Canvas(this.canvasRenderingContext)
.width(CommonConstants.FULL_PARAM)
.height(CommonConstants.FULL_PARAM)
.onReady(() => {
drawUtil.draw();
})
Row() {
Row() {
Image($r('app.media.ic_back'))
.height($r('app.float.toolbar_item_height'))
.onClick(() => {
this.resetParameter();
})
Button($r('app.string.cancel_areaScreenshot'))
.backgroundColor($r('app.color.toolbar_color'))
.fontSize($r('app.float.cancel_font_size'))
.fontColor($r('app.color.cancel_font_color'))
.onClick(() => {
this.resetParameter();
})
}
.backgroundColor($r('app.color.toolbar_color'))
Image($r('app.media.ic_save'))
.onClick(() => {
let screenshotOptions: screenshot.ScreenshotOptions = {
screenRect: {
left: vp2px(offsetModel.getXLeft()),
top: vp2px(offsetModel.getYTop()) + this.systemBarHeight,
width: vp2px(offsetModel.getWidth()),
height: vp2px(offsetModel.getHeight())
} as screenshot.Rect,
imageSize: {
width: vp2px(offsetModel.getWidth()),
height: vp2px(offsetModel.getHeight())
} as screenshot.Size,
rotation: 0,
displayId: 0
};
screenshot.save(screenshotOptions, (err: Error, data: image.PixelMap) => {
if (err) {
Logger.error(`Failed to save the screenshot. Error:${JSON.stringify(err)}`);
}
if (this.pixelMap !== undefined) {
this.pixelMap.release();
}
this.pixelMap = data;
this.dialogController.open();
});
this.resetParameter();
})
.height($r('app.float.toolbar_item_height'))
}
.backgroundColor($r('app.color.toolbar_color'))
.width(CommonConstants.TOOLBAR_WIDTH)
.justifyContent(FlexAlign.SpaceBetween)
}
.width(CommonConstants.FULL_PARAM)
.height(CommonConstants.FULL_PARAM)
.alignContent(Alignment.Top)
.onTouch((event: TouchEvent) => {
switch (event.type) {
case TouchType.Down:
offsetModel.setXLocationType(event.touches[0].screenX);
offsetModel.setYLocationType(event.touches[0].screenY);
break;
case TouchType.Move:
offsetModel.resetOffsetXY(event.touches[0].screenX, event.touches[0].screenY);
drawUtil.draw();
break;
default:
break;
}
})
}
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/GraphicImage/GestureScreenshot/entry/src/main/ets/view/AreaScreenshot.ets#L29-L160
|
6494a7ea4deed3fc67fcf1119e942ca9286b367d
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/Swiper/BasicDataSource.ets
|
arkts
|
deleteData
|
在index位置删除1个数据
|
public deleteData(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
}
|
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 . 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 deleteData(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/Swiper/BasicDataSource.ets#L97-L100
|
8fe90a8ff3a6907909b04f28b18aa98f0f21c8b7
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
渲染布局
@returns {void} 无返回值
@example
RowStartCenter() { Text("Hi"); }
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Start,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#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#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Start,
alignItems: VerticalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L284-L299
|
afc8260adb570aeb60952e6e6b516b8f842f3ecc
|
github
|
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
RowCenterTop
|
横向居中 + 垂直顶部
|
@ComponentV2
export struct RowCenterTop {
/**
* Row 构造参数
*/
@Param
options: RowOptions | RowOptionsV2 = {};
/**
* 宽度
*/
@Param
widthValue: Length | undefined = undefined;
/**
* 高度
*/
@Param
heightValue: Length | undefined = undefined;
/**
* 尺寸(对应官方 size 属性)
*/
@Param
sizeValue: SizeOptions | undefined = undefined;
/**
* 内边距
*/
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
/**
* 外边距
*/
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
/**
* 是否填充最大宽高
*/
@Param
fillMaxSize: boolean = false;
/**
* 背景颜色
*/
@Param
bgColor: ResourceColor | undefined = undefined;
/**
* 点击事件
*/
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
/**
* 内容构建函数
*/
@BuilderParam
content: CustomBuilder;
/**
* 渲染布局
* @returns {void} 无返回值
* @example
* RowCenterTop() { Text("Hi"); }
*/
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowCenterTop AST#component_body#Left { /**
* Row 构造参数
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RowOptions AST#primary_type#Right | AST#primary_type#Left RowOptionsV2 AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 宽度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 高度
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right heightValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 尺寸(对应官方 size 属性)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right sizeValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SizeOptions AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedPadding AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 外边距
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedMargin AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 是否填充最大宽高
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right fillMaxSize : 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#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 点击事件
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent 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#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /**
* 内容构建函数
*/ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 渲染布局
* @returns {void} 无返回值
* @example
* RowCenterTop() { Text("Hi"); }
*/ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct RowCenterTop {
@Param
options: RowOptions | RowOptionsV2 = {};
@Param
widthValue: Length | undefined = undefined;
@Param
heightValue: Length | undefined = undefined;
@Param
sizeValue: SizeOptions | undefined = undefined;
@Param
paddingValue: Padding | Length | LocalizedPadding | undefined = undefined;
@Param
marginValue: Margin | Length | LocalizedMargin | undefined = undefined;
@Param
fillMaxSize: boolean = false;
@Param
bgColor: ResourceColor | undefined = undefined;
@Param
onTap: ((event: ClickEvent) => void) | undefined = undefined;
@BuilderParam
content: CustomBuilder;
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: VerticalAlign.Top,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L625-L700
|
029079df4a527599e1c13845d1d17b7f47fd71b1
|
github
|
batiluoxuanwan/MomentFlow.git
|
e57aa461223abca74f48893afc2ccf7c2d73e9b8
|
frontend/entry/src/main/ets/utils/ExportUtil.ets
|
arkts
|
💡 导入文件 URI 转换工具
|
export class ExportUtil {
static async downloadAndSharePdf(diaryId: number, context: common.UIAbilityContext): Promise<void> {
const httpRequest: http.HttpRequest = http.createHttp();
try {
// 1. 获取 PDF 数据
const res: http.HttpResponse = await httpRequest.request(
`http://10.0.2.2:8080/api/diary/export/pdf/${diaryId}`,
{
method: http.RequestMethod.GET,
expectDataType: http.HttpDataType.ARRAY_BUFFER
}
);
if (res.result instanceof ArrayBuffer) {
const pdfData: ArrayBuffer = res.result;
// 2. 在沙箱生成文件(文件名写死,解决手动输入烦恼)
const fileName = `Diary_Export_${diaryId}.pdf`;
const filePath = `${context.filesDir}/${fileName}`; // 使用 filesDir 更稳妥
// 3. 写入文件
const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC);
fs.writeSync(file.fd, pdfData);
fs.closeSync(file);
// 4. 💡 将路径转换为系统分享可识别的 URI
const uriString = fileUri.getUriFromPath(filePath);
// 5. 构造分享数据
const data: systemShare.SharedData = new systemShare.SharedData({
utd: 'com.adobe.pdf',
uri: uriString,
title: fileName
});
// 6. 💡 修正调用:去掉不支持的 preview 属性
const controller: systemShare.ShareController = new systemShare.ShareController(data);
// 如果这里还报错,尝试直接调用 controller.show(context) 而不传第二个参数
controller.show(context, {
// 这里保持空对象,或根据 DevEco 提示添加可用属性(如 selectionMode)
});
promptAction.showToast({ message: '导出成功,请选择分享/保存方式' });
}
} catch (err) {
const error: Error = err as Error;
promptAction.showToast({ message: '操作失败: ' + error.message });
console.error('Share Error:', error.message);
} finally {
httpRequest.destroy();
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ExportUtil AST#class_body#Left { AST#method_declaration#Left static async downloadAndSharePdf AST#parameter_list#Left ( AST#parameter#Left diaryId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 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#variable_declaration#Left const AST#variable_declarator#Left httpRequest : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpRequest 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 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 { // 1. 获取 PDF 数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left res : 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#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 AST#template_literal#Left ` http://10.0.2.2:8080/api/diary/export/pdf/ AST#template_substitution#Left $ { AST#expression#Left diaryId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#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 expectDataType 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 . HttpDataType AST#member_expression#Right AST#expression#Right . ARRAY_BUFFER AST#member_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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . result AST#member_expression#Right AST#expression#Right instanceof AST#expression#Left ArrayBuffer 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 pdfData : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . result AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 2. 在沙箱生成文件(文件名写死,解决手动输入烦恼) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileName = AST#expression#Left AST#template_literal#Left ` Diary_Export_ AST#template_substitution#Left $ { AST#expression#Left diaryId AST#expression#Right } AST#template_substitution#Right .pdf ` AST#template_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 filePath = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left fileName 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 // 使用 filesDir 更稳妥 // 3. 写入文件 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . TRUNC 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . writeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left pdfData 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 fs AST#expression#Right . closeSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 4. 💡 将路径转换为系统分享可识别的 URI AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uriString = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileUri AST#expression#Right . getUriFromPath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath 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 // 5. 构造分享数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . SharedData 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#new_expression#Left new AST#expression#Left systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . SharedData 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 utd AST#property_name#Right : AST#expression#Left 'com.adobe.pdf' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uriString AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left fileName 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 // 6. 💡 修正调用:去掉不支持的 preview 属性 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . ShareController 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#new_expression#Left new AST#expression#Left systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . ShareController 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 如果这里还报错,尝试直接调用 controller.show(context) 而不传第二个参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left controller AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#object_literal#Left { // 这里保持空对象,或根据 DevEco 提示添加可用属性(如 selectionMode) } AST#object_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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left '导出成功,请选择分享/保存方式' 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#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 ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left error : AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left err AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error 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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '操作失败: ' AST#expression#Right + AST#expression#Left error AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_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#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 'Share Error:' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message 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#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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ExportUtil {
static async downloadAndSharePdf(diaryId: number, context: common.UIAbilityContext): Promise<void> {
const httpRequest: http.HttpRequest = http.createHttp();
try {
const res: http.HttpResponse = await httpRequest.request(
`http://10.0.2.2:8080/api/diary/export/pdf/${diaryId}`,
{
method: http.RequestMethod.GET,
expectDataType: http.HttpDataType.ARRAY_BUFFER
}
);
if (res.result instanceof ArrayBuffer) {
const pdfData: ArrayBuffer = res.result;
const fileName = `Diary_Export_${diaryId}.pdf`;
const filePath = `${context.filesDir}/${fileName}`;
const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE | fs.OpenMode.TRUNC);
fs.writeSync(file.fd, pdfData);
fs.closeSync(file);
const uriString = fileUri.getUriFromPath(filePath);
const data: systemShare.SharedData = new systemShare.SharedData({
utd: 'com.adobe.pdf',
uri: uriString,
title: fileName
});
const controller: systemShare.ShareController = new systemShare.ShareController(data);
controller.show(context, {
});
promptAction.showToast({ message: '导出成功,请选择分享/保存方式' });
}
} catch (err) {
const error: Error = err as Error;
promptAction.showToast({ message: '操作失败: ' + error.message });
console.error('Share Error:', error.message);
} finally {
httpRequest.destroy();
}
}
}
|
https://github.com/batiluoxuanwan/MomentFlow.git/blob/e57aa461223abca74f48893afc2ccf7c2d73e9b8/frontend/entry/src/main/ets/utils/ExportUtil.ets#L8-L62
|
7650253557b3a0a5eb1e7fb06f45a24d6d6b634d
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets
|
arkts
|
draw
|
RenderNode进行绘制时会调用draw方法
|
draw(context: DrawContext): void {
const canvas = context.canvas;
// 设置画笔的颜色混合模式,根据不同的混合模式实现涂鸦和擦除效果
this.pen.setBlendMode(this.blendMode);
// 设置画笔的线宽,单位px
this.pen.setStrokeWidth(this.lineStrokeWidth);
// 将Pen画笔设置到canvas中
canvas.attachPen(this.pen);
// 绘制path
canvas.drawPath(this.path);
}
|
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext 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 const AST#variable_declarator#Left canvas = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . canvas 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setBlendMode 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 . blendMode 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 // 设置画笔的线宽,单位px 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 . pen AST#member_expression#Right AST#expression#Right . setStrokeWidth 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 . lineStrokeWidth 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 // 将Pen画笔设置到canvas中 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left canvas AST#expression#Right . attachPen 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 . pen 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 // 绘制path AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left canvas AST#expression#Right . drawPath 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 . path 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#method_declaration#Right
|
draw(context: DrawContext): void {
const canvas = context.canvas;
this.pen.setBlendMode(this.blendMode);
this.pen.setStrokeWidth(this.lineStrokeWidth);
canvas.attachPen(this.pen);
canvas.drawPath(this.path);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets#L50-L60
|
2a2441c7a996297f6df09df8401a76b0fbdb87b4
|
gitee
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets
|
arkts
|
WaterFlowView
|
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.
|
@Component
export struct WaterFlowView {
@Link _position: Position;
private componentKey: string;
@State minSize: number = 50;
@State maxSize: number = 100;
@State fontSize: number = 24;
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F];
scroller: Scroller = new Scroller();
private itemWidthArray: number[] = [];
private itemHeightArray: number[] = [];
getSize() {
let ret = Math.floor(Math.random() * this.maxSize)
return (ret > this.minSize ? ret : this.minSize)
}
getItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize())
this.itemHeightArray.push(this.getSize())
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WaterFlowView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private componentKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right minSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 50 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right maxSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right colors : 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 0xFFC0CB AST#expression#Right , AST#expression#Left 0xDA70D6 AST#expression#Right , AST#expression#Left 0x6B8E23 AST#expression#Right , AST#expression#Left 0x6A5ACD AST#expression#Right , AST#expression#Left 0x00FFFF AST#expression#Right , AST#expression#Left 0x00FF7F AST#expression#Right ] AST#array_literal#Right AST#expression#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#property_declaration#Left private itemWidthArray : 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#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private itemHeightArray : 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#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left getSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ERROR#Left let ret = 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#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 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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxSize AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left return AST#ERROR#Right ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ret AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . minSize AST#member_expression#Right AST#expression#Right ? AST#ERROR#Left ret : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . minSize AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) } getItemSizeArray AST#parameter_list#Left ( ) AST#parameter_list#Right { for AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left let AST#ERROR#Left i AST#ERROR#Right = AST#expression#Left AST#update_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left ; i AST#ERROR#Right < AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ; i AST#ERROR#Right ++ AST#update_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#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#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 this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . itemWidthArray AST#member_expression#Right AST#expression#Right . push 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 this AST#expression#Right . getSize 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#ERROR#Left this AST#ERROR#Right . itemHeightArray AST#member_expression#Right AST#expression#Right . push 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 this AST#expression#Right . getSize 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#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct WaterFlowView {
@Link _position: Position;
private componentKey: string;
@State minSize: number = 50;
@State maxSize: number = 100;
@State fontSize: number = 24;
@State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F];
scroller: Scroller = new Scroller();
private itemWidthArray: number[] = [];
private itemHeightArray: number[] = [];
getSize() {
let ret = Math.floor(Math.random() * this.maxSize)
return (ret > this.minSize ? ret : this.minSize)
}
getItemSizeArray() {
for (let i = 0; i < 100; i++) {
this.itemWidthArray.push(this.getSize())
this.itemHeightArray.push(this.getSize())
}
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/view/position/WaterFlowView.ets#L16-L38
|
d48813f8410499f4165671061d94462675ddf550
|
gitee
|
hqj201013136012/HarmonyMiliUiPro.git
|
0625e681e07b771998a0ac4430824627d0eb60ed
|
entry/src/main/ets/viewmodel/SecurityData.ets
|
arkts
|
安防模式Item实体
|
export class SecurityModeItemType {
type: string = ""
name: string
imageSrc: ResourceStr
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class SecurityModeItemType { type AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right name : string imageSrc AST#ERROR#Right : ResourceStr AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export class SecurityModeItemType {
type: string = ""
name: string
imageSrc: ResourceStr
constructor
|
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/SecurityData.ets#L41-L46
|
f6a8825394b05ddc8c31a9059e035d00fe27d6ae
|
github
|
|
wasd09090030/MyHongmengProject.git
|
a8ed386b658ceeac69ef5bc42a92d78c7980821c
|
entry/src/main/ets/models/UserModel.ets
|
arkts
|
login
|
用户登录
|
static async login(username: string, password: string): Promise<OperationResult> {
if (!username || !password) {
const result: OperationResult = { success: false, message: '用户名和密码不能为空' };
return result;
}
try {
const users = await UserManager.getAllUsers();
const user = users[username];
if (!user) {
const result: OperationResult = { success: false, message: '用户不存在' };
return result;
}
if (user.password !== password) {
const result: OperationResult = { success: false, message: '密码错误' };
return result;
}
// 更新最后登录时间
user.lastLoginAt = Date.now();
users[username] = user;
await UserManager.saveUsers(users);
await UserManager.setCurrentUser(username);
const result: OperationResult = { success: true, message: '登录成功' };
return result;
} catch (error) {
console.error('Login error:', error);
const result: OperationResult = { success: false, message: '登录失败,请重试' };
return result;
}
}
|
AST#method_declaration#Left static async login AST#parameter_list#Left ( AST#parameter#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left password : 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 OperationResult 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#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left username AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left password 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#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left OperationResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success 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 message AST#property_name#Right : AST#expression#Left '用户名和密码不能为空' 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 result 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left users = 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 UserManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getAllUsers 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 user = AST#expression#Left AST#subscript_expression#Left AST#expression#Left users AST#expression#Right [ AST#expression#Left username 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#unary_expression#Left ! AST#expression#Left user AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left OperationResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success 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 message AST#property_name#Right : AST#expression#Left '用户不存在' 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 result 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 user AST#expression#Right . password AST#member_expression#Right AST#expression#Right !== AST#expression#Left password 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#type_annotation#Left AST#primary_type#Left OperationResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success 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 message AST#property_name#Right : AST#expression#Left '密码错误' 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 result 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . lastLoginAt 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#subscript_expression#Left AST#expression#Left users AST#expression#Right [ AST#expression#Left username AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = user AST#ERROR#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#await_expression#Left await AST#expression#Left UserManager AST#expression#Right AST#await_expression#Right AST#expression#Right . saveUsers AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left users 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#await_expression#Left await AST#expression#Left UserManager AST#expression#Right AST#await_expression#Right AST#expression#Right . setCurrentUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left username 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 result : AST#type_annotation#Left AST#primary_type#Left OperationResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success 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 message AST#property_name#Right : AST#expression#Left '登录成功' 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 result AST#expression#Right ; AST#return_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 'Login 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left OperationResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success 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 message AST#property_name#Right : AST#expression#Left '登录失败,请重试' 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 result 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 AST#method_declaration#Right
|
static async login(username: string, password: string): Promise<OperationResult> {
if (!username || !password) {
const result: OperationResult = { success: false, message: '用户名和密码不能为空' };
return result;
}
try {
const users = await UserManager.getAllUsers();
const user = users[username];
if (!user) {
const result: OperationResult = { success: false, message: '用户不存在' };
return result;
}
if (user.password !== password) {
const result: OperationResult = { success: false, message: '密码错误' };
return result;
}
user.lastLoginAt = Date.now();
users[username] = user;
await UserManager.saveUsers(users);
await UserManager.setCurrentUser(username);
const result: OperationResult = { success: true, message: '登录成功' };
return result;
} catch (error) {
console.error('Login error:', error);
const result: OperationResult = { success: false, message: '登录失败,请重试' };
return result;
}
}
|
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L84-L117
|
833e8044d84a7ca33da8253b9cdeacaf80b67c21
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/utils/ui_tools.ets
|
arkts
|
Continue
Determines if the url is ok to be continued on another device.
@param url The url.
@param storage The LocalStorage. If filled then the result is saved to 'sharable_continuable'.
@returns True or false.
|
export function is_address_continuable(url: string, storage?: LocalStorage) {
let result = true;
if (url.substring(0, 7) == 'meow://') {
// Is internal page
console.log('[is_address_continuable] False! [' + url + '].');
result = false
} else {
console.log('[is_address_continuable] True! [' + url + '].');
}
storage?.setOrCreate('sharable_continuable', result);
return result;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function is_address_continuable 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 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#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#boolean_literal#Left true AST#boolean_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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left url AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 7 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 'meow://' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // Is internal page 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#binary_expression#Left AST#expression#Left '[is_address_continuable] False! [' AST#expression#Right + AST#expression#Left url AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '].' 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#assignment_expression#Left result = 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 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 . log 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 '[is_address_continuable] True! [' AST#expression#Right + AST#expression#Left url AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left '].' 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#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 storage AST#expression#Right ?. setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sharable_continuable' 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#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function is_address_continuable(url: string, storage?: LocalStorage) {
let result = true;
if (url.substring(0, 7) == 'meow://') {
console.log('[is_address_continuable] False! [' + url + '].');
result = false
} else {
console.log('[is_address_continuable] True! [' + url + '].');
}
storage?.setOrCreate('sharable_continuable', result);
return result;
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L122-L133
|
8d68462d2a6d4aaa2867db4771c4688b553c70dc
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/toolbox/Index.ets
|
arkts
|
FloatingWindow
|
Copyright (c) 2024 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 { FloatingWindow } from './src/main/ets/utils/FloatingWindow'
|
AST#export_declaration#Left export { FloatingWindow } from './src/main/ets/utils/FloatingWindow' AST#export_declaration#Right
|
export { FloatingWindow } from './src/main/ets/utils/FloatingWindow'
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/Index.ets#L16-L16
|
f0cf82f4058fef317289540f000c267b4b61c1f6
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
|
arkts
|
deleteAllData
|
清除Web SQL数据库当前使用的所有存储。
@param incognito 清除Web SQL数据库当前使用的所有存储。
|
static deleteAllData(incognito?: boolean): void {
webview.WebStorage.deleteAllData(incognito);
}
|
AST#method_declaration#Left static deleteAllData AST#parameter_list#Left ( AST#parameter#Left incognito ? : 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#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 webview AST#expression#Right . WebStorage AST#member_expression#Right AST#expression#Right . deleteAllData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left incognito 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 deleteAllData(incognito?: boolean): void {
webview.WebStorage.deleteAllData(incognito);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L266-L268
|
35866fcfdbd9d2a9320093ea39acd18741cf8dd9
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
|
arkts
|
getBaseWordByText
|
========================================================== 根据英文文本查询 BaseWord(带编码/去盐处理) ==========================================================
|
async getBaseWordByText(enText: string): Promise<BaseWord | null> {
if (!this.db) return null;
const encodedText = StringEncoder.encodedToBase64(enText);
if (!encodedText) return null;
const sql = `
SELECT *
FROM ${Table.Name.baseWord}
WHERE SUBSTR(${Table.Col.titleEn}, ${DB.salt + 1}, LENGTH(${Table.Col.titleEn}) - ${DB.salt}) = ?
`;
return await this.db.getData(sql, [encodedText], rs => this.createBaseWordFromRs(rs));
}
|
AST#method_declaration#Left async getBaseWordByText AST#parameter_list#Left ( AST#parameter#Left enText : 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#union_type#Left AST#primary_type#Left BaseWord AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_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 this AST#expression#Right AST#unary_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left encodedText = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . encodedToBase64 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enText 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#unary_expression#Left ! AST#expression#Left encodedText AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left `
SELECT *
FROM AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Table AST#expression#Right . Name AST#member_expression#Right AST#expression#Right . baseWord AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
WHERE SUBSTR( AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Table AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . titleEn AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DB AST#expression#Right . salt AST#member_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right , LENGTH( AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Table AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . titleEn 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 DB AST#expression#Right . salt 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#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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left encodedText AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createBaseWordFromRs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs 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
|
async getBaseWordByText(enText: string): Promise<BaseWord | null> {
if (!this.db) return null;
const encodedText = StringEncoder.encodedToBase64(enText);
if (!encodedText) return null;
const sql = `
SELECT *
FROM ${Table.Name.baseWord}
WHERE SUBSTR(${Table.Col.titleEn}, ${DB.salt + 1}, LENGTH(${Table.Col.titleEn}) - ${DB.salt}) = ?
`;
return await this.db.getData(sql, [encodedText], rs => this.createBaseWordFromRs(rs));
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L88-L100
|
834d8a51ee5e3c6cab7e975850a448f7b1f7eae3
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
|
arkts
|
getInstance
|
Obtaining a class instance.
@returns Class instance.
|
static getInstance(): RemoteDeviceUtil {
if (RemoteDeviceUtil.dmInstance === undefined) {
RemoteDeviceUtil.dmInstance = new RemoteDeviceUtil();
}
return RemoteDeviceUtil.dmInstance;
}
|
AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RemoteDeviceUtil 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 RemoteDeviceUtil AST#expression#Right . dmInstance AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined 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 RemoteDeviceUtil AST#expression#Right . dmInstance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left RemoteDeviceUtil 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 RemoteDeviceUtil AST#expression#Right . dmInstance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static getInstance(): RemoteDeviceUtil {
if (RemoteDeviceUtil.dmInstance === undefined) {
RemoteDeviceUtil.dmInstance = new RemoteDeviceUtil();
}
return RemoteDeviceUtil.dmInstance;
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets#L43-L48
|
f5dd4c9f6fdb71deb40f4230afcecc0739e4ae1b
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.file.PhotoPickerComponent.d.ets
|
arkts
|
AnimatorParams
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12
|
export declare class AnimatorParams {
/**
* Animate duration
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
duration?: number;
/**
* Animate curve
*
* @type { ?Curve | ICurve | string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
curve?: Curve | ICurve | string;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AnimatorParams AST#class_body#Left { /**
* Animate duration
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#property_declaration#Left duration ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Animate curve
*
* @type { ?Curve | ICurve | string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#property_declaration#Left curve ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Curve AST#primary_type#Right | AST#primary_type#Left ICurve AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class AnimatorParams {
duration?: number;
curve?: Curve | ICurve | string;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L696-L716
|
1fad4c84e56940eeffc9480f58ccac40e83d39d6
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets
|
arkts
|
createPreviewOutputFn
|
Create the previewOutput output object
|
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile,
surfaceId: string): camera.PreviewOutput | undefined {
let previewOutput: camera.PreviewOutput | undefined = undefined;
try {
previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId);
Logger.info(TAG, `createPreviewOutput success: ${previewOutput}`);
} catch (error) {
Logger.error(TAG, `createPreviewOutput failed: ${JSON.stringify(error)}`);
}
return previewOutput;
}
|
AST#method_declaration#Left createPreviewOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left previewProfileObj : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . Profile AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left surfaceId : 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#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . PreviewOutput AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left previewOutput : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . PreviewOutput AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined 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 previewOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cameraManager AST#expression#Right . createPreviewOutput AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left previewProfileObj AST#expression#Right , AST#expression#Left surfaceId 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#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#template_literal#Left ` createPreviewOutput success: AST#template_substitution#Left $ { AST#expression#Left previewOutput 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 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 ` createPreviewOutput 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 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 previewOutput AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile,
surfaceId: string): camera.PreviewOutput | undefined {
let previewOutput: camera.PreviewOutput | undefined = undefined;
try {
previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId);
Logger.info(TAG, `createPreviewOutput success: ${previewOutput}`);
} catch (error) {
Logger.error(TAG, `createPreviewOutput failed: ${JSON.stringify(error)}`);
}
return previewOutput;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L277-L287
|
f1fb8dee7d1255b756eb08878757c24977e7e03a
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/component/TextInputDialogView.ets
|
arkts
|
getMaxWidth
|
获取底部类弹框的最大宽度
@param maxWidth 默认360vp
@returns 单位vp
|
private getMaxWidth(maxWidth: Length = 360): number {
if (this.isLargeScreen()) {
let oldWidth = 360;
try {
if (typeof maxWidth === 'number') { //number
oldWidth = maxWidth;
} else if (typeof maxWidth === 'string') { //string
oldWidth = this.getVpByStr(maxWidth);
} else {
try { //number资源
oldWidth = this.getNumber(maxWidth);
} catch (e) { //string资源
let strWidth = this.getString(maxWidth);
oldWidth = this.getVpByStr(strWidth);
}
}
} catch (e) {
let error = e as BusinessError;
console.log(`getMaxWidth-Error ~ code: ${error.code} -·- message: ${error.message}`);
}
const width = this.getDisplayWidth();
if (width < oldWidth + 40) { //当宽度大于屏幕宽度,默认为宽度。
return width;
}
return oldWidth + 40;
} else { //小屏幕直接获取屏幕宽度。
return this.getDisplayWidth();
}
}
|
AST#method_declaration#Left private getMaxWidth AST#parameter_list#Left ( AST#parameter#Left maxWidth : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 360 AST#expression#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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLargeScreen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left oldWidth = AST#expression#Left 360 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left maxWidth AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //number AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left oldWidth = AST#expression#Left maxWidth AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left maxWidth AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { //string AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left oldWidth = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getVpByStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxWidth 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 else AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { //number资源 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left oldWidth = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxWidth 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 ( e ) AST#block_statement#Left { //string资源 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left strWidth = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left maxWidth 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 oldWidth = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getVpByStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strWidth 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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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#variable_declaration#Left let AST#variable_declarator#Left error = AST#expression#Left AST#as_expression#Left AST#expression#Left e 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 console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getMaxWidth-Error ~ code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right -·- message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left width = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getDisplayWidth 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 width AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left oldWidth AST#expression#Right + AST#expression#Left 40 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#return_statement#Left return AST#expression#Left width 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#binary_expression#Left AST#expression#Left oldWidth AST#expression#Right + AST#expression#Left 40 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else 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 this AST#expression#Right . getDisplayWidth 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getMaxWidth(maxWidth: Length = 360): number {
if (this.isLargeScreen()) {
let oldWidth = 360;
try {
if (typeof maxWidth === 'number') {
oldWidth = maxWidth;
} else if (typeof maxWidth === 'string') {
oldWidth = this.getVpByStr(maxWidth);
} else {
try { 资源
oldWidth = this.getNumber(maxWidth);
} catch (e) { 资源
let strWidth = this.getString(maxWidth);
oldWidth = this.getVpByStr(strWidth);
}
}
} catch (e) {
let error = e as BusinessError;
console.log(`getMaxWidth-Error ~ code: ${error.code} -·- message: ${error.message}`);
}
const width = this.getDisplayWidth();
if (width < oldWidth + 40) {
return width;
}
return oldWidth + 40;
} else {
return this.getDisplayWidth();
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L191-L219
|
58f56963f5b91cf6a9a8830d999d86335e68b800
|
gitee
|
LiuAnclouds/Harmony-ArkTS-App.git
|
2119ce333927599b81a31081bc913e1416837308
|
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
|
arkts
|
getSortedLetters
|
获取排序后的字母列表
|
private getSortedLetters(): string[] {
let cityGroups = this.groupCitiesByLetter();
return Array.from(cityGroups.keys()).sort();
}
|
AST#method_declaration#Left private getSortedLetters AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cityGroups = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . groupCitiesByLetter 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#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 Array AST#expression#Right . from 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 cityGroups AST#expression#Right . keys 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 . sort 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
|
private getSortedLetters(): string[] {
let cityGroups = this.groupCitiesByLetter();
return Array.from(cityGroups.keys()).sort();
}
|
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L896-L899
|
83e9de8033bfc9c573ca42f63b6cd26b5124a168
|
github
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/exception_throw/exception_finally_001_T.ets
|
arkts
|
Introduction 异常抛出-finally块
|
export function exception_finally_001_T(taint_src : string) {
try {}
catch (e) {}
finally {
taint.Sink(taint_src);
}
}
|
AST#export_declaration#Left export AST#function_declaration#Left function exception_finally_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#try_statement#Left try AST#block_statement#Left { } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { } 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 taint AST#expression#Right . Sink AST#member_expression#Right 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#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function exception_finally_001_T(taint_src : string) {
try {}
catch (e) {}
finally {
taint.Sink(taint_src);
}
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/exception_throw/exception_finally_001_T.ets#L6-L12
|
3c73cfbafc6330069edbcdf135ccb11610d6d7ae
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/social/CommunityService.ets
|
arkts
|
followUser
|
关注用户
|
async followUser(userId: string): Promise<boolean> {
try {
if (!this.currentUser || userId === this.currentUser.id) return false;
// TODO: 关注用户
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `User followed: ${userId}`);
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to follow user: ${error}`);
return false;
}
}
|
AST#method_declaration#Left async followUser AST#parameter_list#Left ( AST#parameter#Left userId : 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 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#try_statement#Left try 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 AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . currentUser AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left userId AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentUser AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) 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#if_statement#Right AST#statement#Right // TODO: 关注用户 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 ` User followed: AST#template_substitution#Left $ { AST#expression#Left userId 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#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_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 follow user: 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#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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async followUser(userId: string): Promise<boolean> {
try {
if (!this.currentUser || userId === this.currentUser.id) return false;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `User followed: ${userId}`);
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to follow user: ${error}`);
return false;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L608-L620
|
f684825d43ed8ecb3482543c620b89fcb8a1fc1c
|
github
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/common/utils/DataSyncVerifier.ets
|
arkts
|
simulatePomodoroSessions
|
模拟番茄钟执行过程
|
async simulatePomodoroSessions(taskId: number, sessionCount: number): Promise<string[]> {
const results: string[] = [];
try {
const task = this.taskViewModel.getTaskById(taskId);
if (!task) {
results.push(`❌ 任务 ${taskId} 不存在`);
return results;
}
results.push(`🍅 开始模拟任务「${task.title}」的番茄钟执行...`);
// 开始任务
await this.taskViewModel.startTask(taskId);
results.push(`▶️ 任务状态变更为: in-progress`);
// 模拟多个番茄钟会话
for (let i = 1; i <= sessionCount; i++) {
// 增加番茄钟计数
await this.taskViewModel.incrementPomodoroCount(taskId);
// 记录到统计系统
this.statsManager.recordPomodoroSession();
results.push(`🍅 完成第 ${i} 个番茄钟 (25分钟)`);
// 增加专注时间
await this.taskViewModel.updateFocusTime(taskId, 25);
}
// 如果完成了预估的番茄钟数量,标记任务完成
if (sessionCount >= (task.estimatedPomodoros || 1)) {
await this.taskViewModel.completeTask(taskId);
results.push(`✅ 任务完成! 实际使用 ${sessionCount} 个番茄钟`);
}
return results;
} catch (error) {
results.push(`❌ 模拟番茄钟执行失败: ${(error as Error).message}`);
return results;
}
}
|
AST#method_declaration#Left async simulatePomodoroSessions AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sessionCount : 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#array_type#Left string [ ] AST#array_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 results : 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left task = 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 . taskViewModel AST#member_expression#Right AST#expression#Right . getTaskById AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taskId 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#unary_expression#Left ! AST#expression#Left task AST#expression#Right AST#unary_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 results 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 taskId 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 results 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 results 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#member_expression#Left AST#expression#Left task AST#expression#Right . title 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . taskViewModel AST#member_expression#Right AST#expression#Right . startTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taskId 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 results AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` ▶️ 任务状态变更为: in-progress ` 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 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 sessionCount 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . taskViewModel AST#member_expression#Right AST#expression#Right . incrementPomodoroCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taskId 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 . statsManager AST#member_expression#Right AST#expression#Right . recordPomodoroSession 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 results 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 i AST#expression#Right } AST#template_substitution#Right 个番茄钟 (25分钟) ` 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . taskViewModel AST#member_expression#Right AST#expression#Right . updateFocusTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taskId AST#expression#Right , AST#expression#Left 25 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left sessionCount 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 task AST#expression#Right . estimatedPomodoros 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#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 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 . taskViewModel AST#member_expression#Right AST#expression#Right . completeTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taskId 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 results 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 sessionCount 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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left results AST#expression#Right ; AST#return_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 results 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#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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#statement#Left AST#return_statement#Left return AST#expression#Left results 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 AST#method_declaration#Right
|
async simulatePomodoroSessions(taskId: number, sessionCount: number): Promise<string[]> {
const results: string[] = [];
try {
const task = this.taskViewModel.getTaskById(taskId);
if (!task) {
results.push(`❌ 任务 ${taskId} 不存在`);
return results;
}
results.push(`🍅 开始模拟任务「${task.title}」的番茄钟执行...`);
await this.taskViewModel.startTask(taskId);
results.push(`▶️ 任务状态变更为: in-progress`);
for (let i = 1; i <= sessionCount; i++) {
await this.taskViewModel.incrementPomodoroCount(taskId);
this.statsManager.recordPomodoroSession();
results.push(`🍅 完成第 ${i} 个番茄钟 (25分钟)`);
await this.taskViewModel.updateFocusTime(taskId, 25);
}
if (sessionCount >= (task.estimatedPomodoros || 1)) {
await this.taskViewModel.completeTask(taskId);
results.push(`✅ 任务完成! 实际使用 ${sessionCount} 个番茄钟`);
}
return results;
} catch (error) {
results.push(`❌ 模拟番茄钟执行失败: ${(error as Error).message}`);
return results;
}
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DataSyncVerifier.ets#L109-L151
|
16894a8bcfcb895054798d598a707648692ed6e0
|
github
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
|
arkts
|
setSpaceTop
|
Sets the top axis space in percent of the full range. Default 10f
@param percent
|
public setSpaceTop(percent: number): void {
this.mSpacePercentTop = percent;
}
|
AST#method_declaration#Left public setSpaceTop AST#parameter_list#Left ( AST#parameter#Left percent : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mSpacePercentTop AST#member_expression#Right = AST#expression#Left percent AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setSpaceTop(percent: number): void {
this.mSpacePercentTop = percent;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L272-L274
|
eb691c2fbaa7d8b59345c784658d9ab8b0a8a38e
|
gitee
|
XiangRui_FuZi/harmony-oscourse
|
da885f9a777a1eace7a07e1cd81137746687974b
|
class1/entry/src/main/ets/pages/Protocol.ets
|
arkts
|
aboutToAppear(): void { const componentContent = new ComponentContent( this.uiContext, wrapBuilder<[Params]>(builderOverlay), new Params(this.uiContext, { x: '2%', y: '3%', }) ) this.overlayNode.addComponentContent(componentContent, 100) // 设置较高层级 this.overlayContent.push(componentContent) } aboutToDisappear(): void { const componentContent = this.overlayContent.pop() if (componentContent) { this.overlayNode.removeComponentContent(componentContent) } }
|
build() {
Column() {
// 资源文件route.html存放路径src/main/resources/rawfile
Web({ src: $rawfile('Protocol.html'), controller: this.webviewController })
}
}
|
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 { // 资源文件route.html存放路径src/main/resources/rawfile AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Protocol.html' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webviewController AST#member_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 AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
Web({ src: $rawfile('Protocol.html'), controller: this.webviewController })
}
}
|
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/Protocol.ets#L53-L59
|
eba8d9a78158bba21d9ed15dc18738ab9bc658a6
|
gitee
|
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/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 = uiContext!.getHostContext()!.resourceManager.getStringSync(resource.id);
} catch (error) {
Logger.error(TAG, `getResourceString failed, error code: ${(error as BusinessError).code},
message: ${(error as BusinessError).message}.`);
}
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#non_null_assertion_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left uiContext AST#expression#Right ! AST#non_null_assertion_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 ! AST#non_null_assertion_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 code: AST#template_substitution#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 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#parenthesized_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
message: AST#template_substitution#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 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#parenthesized_expression#Right 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#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 = uiContext!.getHostContext()!.resourceManager.getStringSync(resource.id);
} catch (error) {
Logger.error(TAG, `getResourceString failed, error code: ${(error as BusinessError).code},
message: ${(error as BusinessError).message}.`);
}
return resourceString;
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L146-L155
|
1768a64604b20099e43f83436b8005d853bdaa77
|
github
|
L1rics06/arkTS-.git
|
991fd131bfdb11e2933152133c97453d86092ac0
|
entry/src/main/ets/pages/NetworkUtil.ets
|
arkts
|
通知列表请求参数
|
export interface NoticeListParams {
id: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface NoticeListParams AST#object_type#Left { AST#type_member#Left id : 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 NoticeListParams {
id: string;
}
|
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L195-L197
|
2e37003a35a8e4add74fcd083109f1e47f9ce9eb
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/CommonTypes.ets
|
arkts
|
搜索参数接口
|
export interface SearchParams {
keyword?: string;
relationType?: RelationType;
gender?: Gender;
tags?: string[];
isLunar?: boolean;
sortBy?: string;
sortOrder?: 'asc' | 'desc';
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface SearchParams AST#object_type#Left { AST#type_member#Left keyword ? : 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 relationType ? : AST#type_annotation#Left AST#primary_type#Left RelationType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left gender ? : AST#type_annotation#Left AST#primary_type#Left Gender AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tags ? : 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#type_member#Right ; AST#type_member#Left isLunar ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left sortBy ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#ERROR#Left sortOrder ? : 'asc' | 'desc' ; AST#ERROR#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface SearchParams {
keyword?: string;
relationType?: RelationType;
gender?: Gender;
tags?: string[];
isLunar?: boolean;
sortBy?: string;
sortOrder?: 'asc' | 'desc';
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L164-L172
|
34c15bfd70605ba485583a331e38d234d3500d45
|
github
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
BptaUseResources/entry/src/main/ets/pages/music/AudioRenderer.ets
|
arkts
|
onForeground
|
Create an AudioRenderer based on the service requirements at the foreground
|
onForeground(): void {
audio.createAudioRenderer(audioRendererOptions, ((err: BusinessError) => {}));
}
|
AST#method_declaration#Left onForeground 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left audio AST#expression#Right . createAudioRenderer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left audioRendererOptions AST#expression#Right , AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#parenthesized_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
|
onForeground(): void {
audio.createAudioRenderer(audioRendererOptions, ((err: BusinessError) => {}));
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/music/AudioRenderer.ets#L43-L45
|
619fe713b1139959d2c3adc58b1460e4ed994897
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/IPC/ObjectTransfer/IPC_Client/entry/src/main/ets/client/cnn/IPC_Client.ets
|
arkts
|
sendArrayBuffer
|
处理arraybuffer数据,调用sendData发送至服务端
|
static sendArrayBuffer(str: string) {
if (proxy == undefined) {
hilog.info(DOMAIN, TAG, 'undefined proxy');
return;
}
let option = new rpc.MessageOption();
let data = rpc.MessageSequence.create();
let reply = rpc.MessageSequence.create();
// 将str转为ArrayBuffer
const encoder = new util.TextEncoder('utf-8');
// 使用TextEncoder将字符串编码为Uint8Array
const uint8Array = encoder.encodeInto(str);
// 将Uint8Array转换为ArrayBuffer
const arrayBuffer = uint8Array.buffer;
try {
// 进行校验
data.writeInterfaceToken(proxy.getDescriptor());
// 写入ArrayBuffer
hilog.error(DOMAIN, TAG, 'arraybuffer:' + uint8Array.toString());
data.writeArrayBuffer(arrayBuffer, rpc.TypeCode.UINT8_ARRAY);
} catch (error) {
let e: BusinessError = error as BusinessError;
hilog.error(DOMAIN, TAG, 'ipc write parcelable fail, errorCode ' + e.code + 'errorMessage:' + e.message);
}
sendData(proxy, 1002, data, reply, option);
}
|
AST#method_declaration#Left static sendArrayBuffer 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_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left proxy 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'undefined proxy' 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#variable_declaration#Left let AST#variable_declarator#Left option = 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 rpc AST#expression#Right AST#new_expression#Right AST#expression#Right . MessageOption 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 data = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rpc AST#expression#Right . MessageSequence AST#member_expression#Right AST#expression#Right . create 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 reply = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rpc AST#expression#Right . MessageSequence AST#member_expression#Right AST#expression#Right . create 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 // 将str转为ArrayBuffer AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left encoder = 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#expression#Left 'utf-8' 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 // 使用TextEncoder将字符串编码为Uint8Array AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uint8Array = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encoder 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 将Uint8Array转换为ArrayBuffer AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left arrayBuffer = AST#expression#Left AST#member_expression#Left AST#expression#Left uint8Array AST#expression#Right . buffer AST#member_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . writeInterfaceToken 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 proxy AST#expression#Right . getDescriptor 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 // 写入ArrayBuffer 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 DOMAIN AST#expression#Right , 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 'arraybuffer:' AST#expression#Right + AST#expression#Left uint8Array 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 data AST#expression#Right . writeArrayBuffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left arrayBuffer AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rpc AST#expression#Right . TypeCode AST#member_expression#Right AST#expression#Right . UINT8_ARRAY 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 let AST#variable_declarator#Left e : 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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left DOMAIN AST#expression#Right , AST#expression#Left TAG AST#expression#Right , 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 AST#binary_expression#Left AST#expression#Left 'ipc write parcelable fail, errorCode ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right + AST#expression#Left 'errorMessage:' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right . message 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#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sendData AST#expression#Right AST#argument_list#Left ( AST#expression#Left proxy AST#expression#Right , AST#expression#Left 1002 AST#expression#Right , AST#expression#Left data AST#expression#Right , AST#expression#Left reply AST#expression#Right , AST#expression#Left option 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
|
static sendArrayBuffer(str: string) {
if (proxy == undefined) {
hilog.info(DOMAIN, TAG, 'undefined proxy');
return;
}
let option = new rpc.MessageOption();
let data = rpc.MessageSequence.create();
let reply = rpc.MessageSequence.create();
const encoder = new util.TextEncoder('utf-8');
const uint8Array = encoder.encodeInto(str);
const arrayBuffer = uint8Array.buffer;
try {
data.writeInterfaceToken(proxy.getDescriptor());
hilog.error(DOMAIN, TAG, 'arraybuffer:' + uint8Array.toString());
data.writeArrayBuffer(arrayBuffer, rpc.TypeCode.UINT8_ARRAY);
} catch (error) {
let e: BusinessError = error as BusinessError;
hilog.error(DOMAIN, TAG, 'ipc write parcelable fail, errorCode ' + e.code + 'errorMessage:' + e.message);
}
sendData(proxy, 1002, data, reply, option);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/IPC/ObjectTransfer/IPC_Client/entry/src/main/ets/client/cnn/IPC_Client.ets#L93-L122
|
f8e4ee647728e707bd71bb560e900427588d3d2f
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets
|
arkts
|
push
|
通过获取页面栈跳转到指定页面
|
public static async push(url: string): Promise<void>{
// 分解url
// 获取包名、路由名、页面名
let params = url.split("/");
const harName = params[0];
let context = params[params.length - 1].split("-");
const routerName = context[0];
const builderName = context[1];
// 获取路径
let path = ".";
for (let i = 1; i < params.length - 1; i++) {
path += "/" + params[i];
}
// 动态引入要跳转的页面
let ns: ESObject = await import(harName);
ns.harInit(path);
RouterModule.getRouter(routerName).pushPathByName(builderName, null);
}
|
AST#method_declaration#Left public static async push 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_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 { // 分解url // 获取包名、路由名、页面名 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left url 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#variable_declaration#Left const AST#variable_declarator#Left harName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left 0 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#variable_declaration#Left let AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params 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#subscript_expression#Right 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#variable_declaration#Left const AST#variable_declarator#Left routerName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left context AST#expression#Right [ AST#expression#Left 0 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#variable_declaration#Left const AST#variable_declarator#Left builderName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left context AST#expression#Right [ AST#expression#Left 1 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#variable_declaration#Left let AST#variable_declarator#Left path = AST#expression#Left "." 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 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_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 params AST#expression#Right AST#binary_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#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#assignment_expression#Left path += AST#expression#Left AST#binary_expression#Left AST#expression#Left "/" AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right 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#for_statement#Right AST#statement#Right // 动态引入要跳转的页面 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ns : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#await_expression#Left await AST#expression#Left AST#import_expression#Left import ( AST#expression#Left harName AST#expression#Right ) AST#import_expression#Right AST#expression#Right AST#await_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 ns AST#expression#Right . harInit 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#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 RouterModule AST#expression#Right . getRouter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left routerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . pushPathByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left builderName 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#block_statement#Right AST#method_declaration#Right
|
public static async push(url: string): Promise<void>{
let params = url.split("/");
const harName = params[0];
let context = params[params.length - 1].split("-");
const routerName = context[0];
const builderName = context[1];
let path = ".";
for (let i = 1; i < params.length - 1; i++) {
path += "/" + params[i];
}
let ns: ESObject = await import(harName);
ns.harInit(path);
RouterModule.getRouter(routerName).pushPathByName(builderName, null);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L42-L59
|
9e6486b4183ed181d1e1ce99b0ceb4ff87270a60
|
gitee
|
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
|
72954bea19e7e7f93567487b036c0664457bdaf3
|
huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets
|
arkts
|
onEvent
|
事件处理。收到平台下发的事件时此接口被自动调用。默认为空实现
@param deviceEvent 服务事件
|
onEvent(deviceEvent: DeviceEvent): void {
LogUtil.log("onEvent")
}
|
AST#method_declaration#Left onEvent AST#parameter_list#Left ( AST#parameter#Left deviceEvent : AST#type_annotation#Left AST#primary_type#Left DeviceEvent 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 LogUtil AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "onEvent" 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
|
onEvent(deviceEvent: DeviceEvent): void {
LogUtil.log("onEvent")
}
|
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets#L218-L220
|
56ef0a67b852debbfcf0d047052c73d50fe1d41e
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
|
arkts
|
notifyDataDelete
|
通知控制器数据删除
|
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
|
AST#method_declaration#Left notifyDataDelete 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 . listeners AST#member_expression#Right AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left listener => 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 listener AST#expression#Right . onDataDelete 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#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#builder_function_body#Right AST#method_declaration#Right
|
notifyDataDelete(index: number): void {
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L54-L58
|
8d49b91477640a17db210e2ca0f2d1518ed4524c
|
gitee
|
wuyuanwuhui99/harmony-arkts-music-app-ui.git
|
fc75b993b76293666f9122f527ea3bc6caf7f75c
|
entry/src/main/ets/pages/MusicClassifyListPage.ets
|
arkts
|
useMusicListByClassifyId
|
@description: 根据分类id查询音乐列表
@date: 2024-07-25 23:18
@author wuwenqiang
|
useMusicListByClassifyId(){
getMusicListByClassifyIdService(this.musicClassify.id,this.pageNum,PAGE_SIZE).then((res) => {
this.musicList.push(...res.data);
this.total = res.total;
})
}
|
AST#method_declaration#Left useMusicListByClassifyId 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 getMusicListByClassifyIdService ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . musicClassify AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pageNum AST#member_expression#Right AST#expression#Right , AST#expression#Left PAGE_SIZE AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . then ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res 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#member_expression#Left AST#expression#Left this AST#expression#Right . musicList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . data AST#member_expression#Right AST#expression#Right AST#spread_element#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 . total AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . total 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
useMusicListByClassifyId(){
getMusicListByClassifyIdService(this.musicClassify.id,this.pageNum,PAGE_SIZE).then((res) => {
this.musicList.push(...res.data);
this.total = res.total;
})
}
|
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/pages/MusicClassifyListPage.ets#L48-L53
|
e2de49f5288742c879719ee3f5ae8248f21617a2
|
github
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
|
arkts
|
getSm4DeryptProperties
|
SM4 解密密钥属性
|
function getSm4DeryptProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM4
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128,
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_CBC
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_PADDING,
value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_IV,
value: stringToUint8Array(IV)
};
return;
}
|
AST#function_declaration#Left function getSm4DeryptProperties AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HuksProperties [ ] 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 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 index = AST#expression#Left 0 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 properties 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#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_ALGORITHM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyAlg AST#member_expression#Right AST#expression#Right . HUKS_ALG_SM4 AST#member_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#subscript_expression#Left AST#expression#Left properties 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#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_KEY_SIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeySize AST#member_expression#Right AST#expression#Right . HUKS_SM4_KEY_SIZE_128 AST#member_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#subscript_expression#Left AST#expression#Left properties 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#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_PURPOSE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyPurpose AST#member_expression#Right AST#expression#Right . HUKS_KEY_PURPOSE_DECRYPT AST#member_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#subscript_expression#Left AST#expression#Left properties 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#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_BLOCK_MODE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksCipherMode AST#member_expression#Right AST#expression#Right . HUKS_MODE_CBC AST#member_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#subscript_expression#Left AST#expression#Left properties 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#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyPadding AST#member_expression#Right AST#expression#Right . HUKS_PADDING_PKCS7 AST#member_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#subscript_expression#Left AST#expression#Left properties 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#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_IV AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left stringToUint8Array AST#expression#Right AST#argument_list#Left ( AST#expression#Left IV 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#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function getSm4DeryptProperties(properties: HuksProperties[]): void {
let index = 0;
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_ALGORITHM,
value: huks.HuksKeyAlg.HUKS_ALG_SM4
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_KEY_SIZE,
value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128,
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_PURPOSE,
value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE,
value: huks.HuksCipherMode.HUKS_MODE_CBC
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_PADDING,
value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7
};
properties[index++] = {
tag: huks.HuksTag.HUKS_TAG_IV,
value: stringToUint8Array(IV)
};
return;
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L264-L291
|
252078df36cd6f8663dd03afd1e783b1cb0d890e
|
gitee
|
JackJiang2011/harmonychat.git
|
bca3f3e1ce54d763720510f99acf595a49e37879
|
entry/src/main/ets/pages/utils/ToolKits.ets
|
arkts
|
getTimeHH24Human
|
获取仅包含“时间:分钟”部分的字符串,24小时制,且可以显示“上午”、“下午”、“晚上”这样的描述。
@param srcDateObj 原始日期对象
@param timeWithSegmentStr 表示在时间字符串前带上“上午”、“下午”、“晚上”这样的描述
@return 如果成功则返回结果,否则返回空字符串""(不是null)
|
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string {
let ret: string = '';
try {
let timePattern: string = 'hh:mm';
// 原始的时间分钟字符串
let timeStr: string = ToolKits.formatDate(srcDateObj, timePattern);
// 时间段描述(形如:“上午”、“下午”、“晚上”这样的描述),只在中文语言下生效
let timeSegmentStr: string = '';
if(timeWithSegmentStr)
timeSegmentStr = ToolKits.getTimeSegmentStr(timeStr);
// 组合成最终的人性化时间分钟字符串形式
ret = timeSegmentStr+timeStr;
} catch (e) {
ClientCoreSDK.Log.warn("【DEBUG-getTimeHH24Human】计算出错:"+ JSON.stringify(e) +" 【NO】");
}
return ret;
}
|
AST#method_declaration#Left static getTimeHH24Human AST#parameter_list#Left ( AST#parameter#Left srcDateObj : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeWithSegmentStr : 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 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 ret : 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#variable_declaration#Left let AST#variable_declarator#Left timePattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'hh:mm' 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 timeStr : AST#type_annotation#Left AST#primary_type#Left string 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 ToolKits AST#expression#Right . formatDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left srcDateObj AST#expression#Right , AST#expression#Left timePattern 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 timeSegmentStr : 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#if_statement#Left if ( AST#expression#Left timeWithSegmentStr AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left timeSegmentStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToolKits AST#expression#Right . getTimeSegmentStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left timeStr 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#if_statement#Right AST#statement#Right // 组合成最终的人性化时间分钟字符串形式 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ret = AST#expression#Left AST#binary_expression#Left AST#expression#Left timeSegmentStr AST#expression#Right + AST#expression#Left timeStr 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#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 AST#member_expression#Left AST#expression#Left ClientCoreSDK AST#expression#Right . Log AST#member_expression#Right AST#expression#Right . warn 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 AST#binary_expression#Left AST#expression#Left "【DEBUG-getTimeHH24Human】计算出错:" 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 e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left " 【NO】" 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#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left ret AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string {
let ret: string = '';
try {
let timePattern: string = 'hh:mm';
let timeStr: string = ToolKits.formatDate(srcDateObj, timePattern);
let timeSegmentStr: string = '';
if(timeWithSegmentStr)
timeSegmentStr = ToolKits.getTimeSegmentStr(timeStr);
ret = timeSegmentStr+timeStr;
} catch (e) {
ClientCoreSDK.Log.warn("【DEBUG-getTimeHH24Human】计算出错:"+ JSON.stringify(e) +" 【NO】");
}
return ret;
}
|
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L277-L296
|
2bea59b10360c9e6f5ad13691a7bdcf3a94ea5a7
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/ar/ARCardService.ets
|
arkts
|
关键帧接口
|
export interface Keyframe {
time: number;
position?: Vector3D;
rotation?: Vector3D;
scale?: Vector3D;
opacity?: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Keyframe AST#object_type#Left { AST#type_member#Left time : 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 position ? : AST#type_annotation#Left AST#primary_type#Left Vector3D AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left rotation ? : AST#type_annotation#Left AST#primary_type#Left Vector3D AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left scale ? : AST#type_annotation#Left AST#primary_type#Left Vector3D AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left opacity ? : 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 Keyframe {
time: number;
position?: Vector3D;
rotation?: Vector3D;
scale?: Vector3D;
opacity?: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L133-L139
|
498be9142085d33526bdbbe39461a510330ae3b9
|
github
|
|
tomorrowKreswell/Ledger.git
|
1f2783ae70b8540d677af8a27f29db1b4089ea69
|
ledger/entry/src/main/ets/common/database/tables/AccountTable.ets
|
arkts
|
类构造函数,用于初始化数据库表
|
constructor(callback: Function = () => {
}) {
// 获取数据库表的 RdbStore 对象,并调用回调函数
this.accountTable.getRdbStore(callback);
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_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 { // 获取数据库表的 RdbStore 对象,并调用回调函数 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 . accountTable AST#member_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left callback 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#constructor_declaration#Right
|
constructor(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback);
}
|
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/tables/AccountTable.ets#L19-L23
|
8dcd35c4a9cd1134986af24d1630fa16f5c17211
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/CrashUtil.ets
|
arkts
|
restartApp
|
重启APP,并拉起应用启动时第一个Ability,可以配合errorManager相关接口使用。
如果该Ability存在已经保存的状态,这些状态数据会在Ability的OnCreate生命周期回调的want参数中作为wantParam属性传入。
API10时将启动由setRestartWant指定的Ability。如果没有指定则按以下规则启动:
如果当前应用前台的Ability支持恢复,则重新拉起该Ability。
如果存在多个支持恢复的Ability处于前台,则只拉起最后一个。
如果没有Ability处于前台,则不拉起。
|
static restartApp() {
appRecovery.restartApp();
}
|
AST#method_declaration#Left static restartApp 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 appRecovery AST#expression#Right . restartApp 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
|
static restartApp() {
appRecovery.restartApp();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L181-L183
|
8ff9ff1e9ff95071279bd85f779ad8ae1eb73de5
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/web/UploadInWeb/entry/src/main/ets/pages/Index.ets
|
arkts
|
selectFile
|
选择上传的文件
|
async selectFile(): Promise<boolean> {
//资源文件中的demo.txt
if (this.uploadFileType == 0) {
return this.copyResFile2Sandbox("demo.txt")
} else if (this.uploadFileType == 1) {//选择图像文件
let imgPicker = new picker.PhotoViewPicker();
let result = await imgPicker.select();
if (result.photoUris.length > 0) {
return this.copySelFile2Sandbox(result.photoUris[0])
}
return false
} else {//选择任意文件
let filePicker = new picker.DocumentViewPicker();
let result = await filePicker.select();
if (result.length > 0) {
return this.copySelFile2Sandbox(result[0])
}
return false
}
}
|
AST#method_declaration#Left async selectFile 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 { //资源文件中的demo.txt 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 . uploadFileType 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . copyResFile2Sandbox AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "demo.txt" 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 else 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 . uploadFileType AST#member_expression#Right 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#variable_declaration#Left let AST#variable_declarator#Left imgPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker 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 result = 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 imgPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . photoUris 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#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 this AST#expression#Right . copySelFile2Sandbox AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . photoUris AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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#if_statement#Right AST#statement#Right 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 else AST#block_statement#Left { //选择任意文件 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker 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 result = 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 filePicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select 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 AST#member_expression#Left AST#expression#Left result 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . copySelFile2Sandbox AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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#if_statement#Right AST#statement#Right 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async selectFile(): Promise<boolean> {
if (this.uploadFileType == 0) {
return this.copyResFile2Sandbox("demo.txt")
} else if (this.uploadFileType == 1) {
let imgPicker = new picker.PhotoViewPicker();
let result = await imgPicker.select();
if (result.photoUris.length > 0) {
return this.copySelFile2Sandbox(result.photoUris[0])
}
return false
} else {
let filePicker = new picker.DocumentViewPicker();
let result = await filePicker.select();
if (result.length > 0) {
return this.copySelFile2Sandbox(result[0])
}
return false
}
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/web/UploadInWeb/entry/src/main/ets/pages/Index.ets#L135-L154
|
aa575a373f5211ce797eb71ed8d71efd57aac4d6
|
gitee
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/strings/BruteForce.ets
|
arkts
|
findNonOverlappingMatches
|
查找所有不重叠的匹配位置
@param text 文本字符串
@param pattern 模式串
@returns 不重叠的匹配位置数组
|
static findNonOverlappingMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const n = text.length;
const m = pattern.length;
let i = 0;
while (i <= n - m) {
let j = 0;
while (j < m && text[i + j] === pattern[j]) {
j++;
}
if (j === m) {
result.push(i);
i += m; // 跳过已匹配的部分
} else {
i++;
}
}
return result;
}
|
AST#method_declaration#Left static findNonOverlappingMatches 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 pattern : 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#array_type#Left number [ ] AST#array_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#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#unary_expression#Left ! AST#expression#Left text AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left pattern AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left pattern 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#return_statement#Left return AST#expression#Left AST#array_literal#Left [ ] AST#array_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#variable_declaration#Left const AST#variable_declarator#Left result : 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#array_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 n = AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . length 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 m = AST#expression#Left AST#member_expression#Left AST#expression#Left pattern AST#expression#Right . length 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 let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right <= AST#expression#Left AST#binary_expression#Left AST#expression#Left n AST#expression#Right - AST#expression#Left m 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 j = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right < AST#expression#Left m AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left text AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left j AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left AST#subscript_expression#Left AST#expression#Left pattern AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right 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#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left j AST#expression#Right ++ AST#update_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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right === AST#expression#Left m 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 result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i 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 i += AST#expression#Left m AST#expression#Right AST#assignment_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 i 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#block_statement#Right AST#while_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 AST#method_declaration#Right
|
static findNonOverlappingMatches(text: string, pattern: string): number[] {
if (!text || !pattern || pattern.length === 0) {
return [];
}
const result: number[] = [];
const n = text.length;
const m = pattern.length;
let i = 0;
while (i <= n - m) {
let j = 0;
while (j < m && text[i + j] === pattern[j]) {
j++;
}
if (j === m) {
result.push(i);
i += m;
} else {
i++;
}
}
return result;
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/BruteForce.ets#L112-L137
|
7470a2a75cfe7b78f3c2e4c66bbeb33090e620d9
|
github
|
WinWang/HarmoneyOpenEye.git
|
57f0542795336009aa0d46fd9fa5b07facc2ae87
|
entry/src/main/ets/http/apiService.ets
|
arkts
|
获取分类详情接口
@param id
@param start
|
export function getCategoryDetailList(id: number, start: number) {
return axiosClient.get<HomeModel>(
{
url: baseUrl + "api/v4/categories/videoList",
params: {
"id": id,
"start": start,
"udid": CommonConstants.UUID,
deviceModel: CommonConstants.DEVICE_NUM
}
}
)
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getCategoryDetailList AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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 { 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 HomeModel 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#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left "api/v4/categories/videoList" AST#expression#Right AST#binary_expression#Right 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 "id" AST#property_name#Right : AST#expression#Left id AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "start" AST#property_name#Right : AST#expression#Left start AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left "udid" AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . UUID AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left deviceModel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DEVICE_NUM 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#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 getCategoryDetailList(id: number, start: number) {
return axiosClient.get<HomeModel>(
{
url: baseUrl + "api/v4/categories/videoList",
params: {
"id": id,
"start": start,
"udid": CommonConstants.UUID,
deviceModel: CommonConstants.DEVICE_NUM
}
}
)
}
|
https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/apiService.ets#L122-L134
|
47be6870b9e4cd87cecbfc4cfa4c7b01bb7e1bdb
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/A.ets
|
arkts
|
c
|
[End export_variable_a]
|
export { c };
|
AST#export_declaration#Left export { c } ; AST#export_declaration#Right
|
export { c };
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/A.ets#L22-L22
|
bcd9d2495e848320897ffbe19323d6df482d0ee5
|
gitee
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets
|
arkts
|
getDetailListItems
|
Get detail list item info.
@return {Array<DetailListItem>} detailListItems
|
getDetailListItems() {
let detailListItems: Array<DetailListItem> = [];
for (let i = 0; i < CommonConstants.LIST_SIZE; i++) {
let detailListItem = new DetailListItem();
detailListItem.title = $r('app.string.detail_list_item_text');
detailListItem.gridItemData = this.getGridItems();
detailListItems.push(detailListItem);
}
return detailListItems;
}
|
AST#method_declaration#Left getDetailListItems AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left detailListItems : 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 DetailListItem 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#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 CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . LIST_SIZE 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 let AST#variable_declarator#Left detailListItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DetailListItem 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left detailListItem AST#expression#Right . title AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.detail_list_item_text' AST#expression#Right ) AST#resource_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 detailListItem AST#expression#Right . gridItemData AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getGridItems 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left detailListItems AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left detailListItem 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 detailListItems AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getDetailListItems() {
let detailListItems: Array<DetailListItem> = [];
for (let i = 0; i < CommonConstants.LIST_SIZE; i++) {
let detailListItem = new DetailListItem();
detailListItem.title = $r('app.string.detail_list_item_text');
detailListItem.gridItemData = this.getGridItems();
detailListItems.push(detailListItem);
}
return detailListItems;
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategorySample/entry/src/main/ets/viewmodel/CategoryViewModel.ets#L49-L58
|
49613e5f2bef6a704f826bd23d014d89f79d5d2d
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
|
arkts
|
TODO 剪贴板工具类
需要权限:ohos.permission.READ_PASTEBOARD //允许应用读取剪贴板。
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01
|
export class PasteboardUtil {
/**
* 申请剪贴板权限
* @returns
*/
static async requestPermissions(): Promise<boolean> {
return await PermissionUtil.requestPermissionsEasy('ohos.permission.READ_PASTEBOARD');
}
/**
* 获取系统剪贴板对象
* @returns
*/
static getSystemPasteboard(): pasteboard.SystemPasteboard {
const systemPasteboard: pasteboard.SystemPasteboard = pasteboard.getSystemPasteboard();
return systemPasteboard;
}
/**
* 判断系统剪贴板中是否有内容,使用Promise异步回调。
* @returns
*/
static async hasData(): Promise<boolean> {
return PasteboardUtil.getSystemPasteboard().hasData();
}
/**
* 判断系统剪贴板中是否有内容。
* @returns
*/
static hasDataSync(): boolean {
return PasteboardUtil.getSystemPasteboard().hasDataSync();
}
/**
* 将数据写入系统剪贴板,使用Promise异步回调。
* @param mimeType 剪贴板数据对应的MIME类型,可以是常量中已定义的类型,包括HTML类型,WANT类型,纯文本类型,URI类型,PIXELMAP类型;也可以是自定义的MIME类型。
* @param value 自定义数据内容。
* @returns
*/
static async setData(mimeType: string, value: pasteboard.ValueType): Promise<void> {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setData(pasteData);
}
/**
* 将数据写入系统剪贴板。
* @param mimeType 剪贴板数据对应的MIME类型,可以是常量中已定义的类型,包括HTML类型,WANT类型,纯文本类型,URI类型,PIXELMAP类型;也可以是自定义的MIME类型。
* @param value 自定义数据内容。
* @returns
*/
static setDataSync(mimeType: string, value: pasteboard.ValueType) {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setDataSync(pasteData);
}
/**
* 读取系统剪贴板内容,使用Promise异步回调。
* @returns
*/
static async getData(): Promise<pasteboard.PasteData> {
return PasteboardUtil.getSystemPasteboard().getData();
}
/**
* 读取系统剪贴板内容
* @returns
*/
static getDataSync(): pasteboard.PasteData {
return PasteboardUtil.getSystemPasteboard().getDataSync();
}
/**
* 将纯文本数据写入系统剪贴板,使用Promise异步回调。
* @param text 纯文本数据
* @returns
*/
static async setDataText(text: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
}
/**
* 将纯文本数据写入系统剪贴板。
* @param text 纯文本数据
* @returns
*/
static setDataTextSync(text: string) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_PLAIN, text);
}
/**
* 读取系统剪贴板纯文本内容,使用Promise异步回调。
* @returns
*/
static async getDataText(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryText();
}
/**
* 读取系统剪贴板纯文本内容。
* @returns
*/
static getDataTextSync(): string {
return PasteboardUtil.getDataSync().getPrimaryText();
}
/**
* 将HTML数据写入系统剪贴板,使用Promise异步回调。
* @param html HTML内容
* @returns
*/
static async setDataHtml(html: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_HTML, html);
}
/**
* 将HTML数据写入系统剪贴板。
* @param html HTML内容
* @returns
*/
static async setDataHtmlSync(html: string) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_HTML, html);
}
/**
* 读取系统剪贴板HTML内容,使用Promise异步回调。
* @returns
*/
static async getDataHtml(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryHtml();
}
/**
* 读取系统剪贴板HTML内容。
* @returns
*/
static getDataHtmlSync(): string {
return PasteboardUtil.getDataSync().getPrimaryHtml();
}
/**
* 将URI数据写入系统剪贴板,使用Promise异步回调。
* @param uri URI内容
* @returns
*/
static async setDataUri(uri: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_URI, uri);
}
/**
* 将URI数据写入系统剪贴板。
* @param uri URI内容
* @returns
*/
static setDataUriSync(uri: string) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_URI, uri);
}
/**
* 读取系统剪贴板URI内容,使用Promise异步回调。
* @returns
*/
static async getDataUri(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryUri();
}
/**
* 读取系统剪贴板URI内容。
* @returns
*/
static getDataUriSync(): string {
return PasteboardUtil.getDataSync().getPrimaryUri();
}
/**
* 将Want数据写入系统剪贴板,使用Promise异步回调。
* @param want Want内容
* @returns
*/
static async setDataWant(want: Want): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_WANT, want);
}
/**
* 将Want数据写入系统剪贴板。
* @param want Want内容
* @returns
*/
static setDataWantSync(want: Want) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_WANT, want);
}
/**
* 读取系统剪贴板Want内容,使用Promise异步回调。
* @returns
*/
static async getDataWant(): Promise<Want> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryWant();
}
/**
* 读取系统剪贴板Want内容。
* @returns
*/
static getDataWantSync(): Want {
return PasteboardUtil.getDataSync().getPrimaryWant();
}
/**
* 将PixelMap数据写入系统剪贴板,使用Promise异步回调。
* @param pixelMap PixelMap
* @returns
*/
static async setDataPixelMap(pixelMap: image.PixelMap): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
}
/**
* 将PixelMap数据写入系统剪贴板。
* @param pixelMap PixelMap
* @returns
*/
static setDataPixelMapSync(pixelMap: image.PixelMap) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
}
/**
* 读取系统剪贴板PixelMap内容,使用Promise异步回调。
* @returns
*/
static async getDataPixelMap(): Promise<image.PixelMap> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryPixelMap();
}
/**
* 读取系统剪贴板PixelMap内容。
* @returns
*/
static getDataPixelMapSync(): image.PixelMap {
return PasteboardUtil.getDataSync().getPrimaryPixelMap();
}
/**
* 读取系统剪贴板里的字符串(),使用Promise异步回调。
* @returns
*/
static async getDataStr(): Promise<string> {
if (PasteboardUtil.hasDataSync()) {
let pasteData = await PasteboardUtil.getData();
let mimeType = pasteData.getPrimaryMimeType();
if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) {
return pasteData.getPrimaryText();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_HTML) {
return pasteData.getPrimaryHtml();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_URI) {
return pasteData.getPrimaryUri();
}
}
return "";
}
/**
* 读取系统剪贴板里的字符串。
* @returns
*/
static getDataStrSync(): string {
if (PasteboardUtil.hasDataSync()) {
let pasteData = PasteboardUtil.getDataSync();
let mimeType = pasteData.getPrimaryMimeType();
if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) {
return pasteData.getPrimaryText();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_HTML) {
return pasteData.getPrimaryHtml();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_URI) {
return pasteData.getPrimaryUri();
}
}
return "";
}
/**
* 读取系统剪贴板里的内容(纯文本内容、HTML内容、URI内容、Want内容、PixelMap内容)。
* @returns
*/
static getDataEasy(): string | Want | image.PixelMap | undefined {
if (PasteboardUtil.hasDataSync()) {
let pasteData = PasteboardUtil.getDataSync();
let mimeType = pasteData.getPrimaryMimeType();
if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) {
return pasteData.getPrimaryText();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_HTML) {
return pasteData.getPrimaryHtml();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_URI) {
return pasteData.getPrimaryUri();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_WANT) {
return pasteData.getPrimaryWant();
} else if (mimeType === pasteboard.MIMETYPE_PIXELMAP) {
return pasteData.getPrimaryPixelMap();
}
}
return undefined;
}
/**
* 清空系统剪贴板内容,使用Promise异步回调。
* @returns
*/
static async clearData(): Promise<void> {
PasteboardUtil.getSystemPasteboard().clearData();
}
/**
* 清空系统剪贴板内容。
* @returns
*/
static clearDataSync() {
PasteboardUtil.getSystemPasteboard().clearDataSync();
}
/**
* 读取系统剪贴板里的字符串。该方法已废弃,建议使用getDataStrSync()。
* @returns
*/
static getDataSyncStr(): string {
return PasteboardUtil.getDataStrSync();
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class PasteboardUtil AST#class_body#Left { /**
* 申请剪贴板权限
* @returns
*/ AST#method_declaration#Left static async requestPermissions 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PermissionUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . requestPermissionsEasy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ohos.permission.READ_PASTEBOARD' 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 /**
* 获取系统剪贴板对象
* @returns
*/ AST#method_declaration#Left static getSystemPasteboard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . SystemPasteboard AST#qualified_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 systemPasteboard : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . SystemPasteboard 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 pasteboard 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left systemPasteboard AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 判断系统剪贴板中是否有内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async hasData 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#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 . hasData 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 /**
* 判断系统剪贴板中是否有内容。
* @returns
*/ AST#method_declaration#Left static hasDataSync 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#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 . hasDataSync 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 /**
* 将数据写入系统剪贴板,使用Promise异步回调。
* @param mimeType 剪贴板数据对应的MIME类型,可以是常量中已定义的类型,包括HTML类型,WANT类型,纯文本类型,URI类型,PIXELMAP类型;也可以是自定义的MIME类型。
* @param value 自定义数据内容。
* @returns
*/ AST#method_declaration#Left static async setData AST#parameter_list#Left ( AST#parameter#Left mimeType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . ValueType 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 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#variable_declaration#Left const AST#variable_declarator#Left pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . createData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mimeType AST#expression#Right , AST#expression#Left value 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#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 . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pasteData 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 /**
* 将数据写入系统剪贴板。
* @param mimeType 剪贴板数据对应的MIME类型,可以是常量中已定义的类型,包括HTML类型,WANT类型,纯文本类型,URI类型,PIXELMAP类型;也可以是自定义的MIME类型。
* @param value 自定义数据内容。
* @returns
*/ AST#method_declaration#Left static setDataSync AST#parameter_list#Left ( AST#parameter#Left mimeType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . ValueType 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 pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . createData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mimeType AST#expression#Right , AST#expression#Left value 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#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 . setDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pasteData 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 /**
* 读取系统剪贴板内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getData 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 AST#qualified_type#Left pasteboard . PasteData 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#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 . getData 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 /**
* 读取系统剪贴板内容
* @returns
*/ 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 /**
* 将纯文本数据写入系统剪贴板,使用Promise异步回调。
* @param text 纯文本数据
* @returns
*/ AST#method_declaration#Left static async setDataText 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_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#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 PasteboardUtil AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#Right , AST#expression#Left text 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 /**
* 将纯文本数据写入系统剪贴板。
* @param text 纯文本数据
* @returns
*/ AST#method_declaration#Left static setDataTextSync 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_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 PasteboardUtil AST#expression#Right . setDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#Right , AST#expression#Left text 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 /**
* 读取系统剪贴板纯文本内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getDataText 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#variable_declaration#Left const AST#variable_declarator#Left pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PasteboardUtil AST#expression#Right AST#await_expression#Right 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#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 pasteData AST#expression#Right . getPrimaryText 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 /**
* 读取系统剪贴板纯文本内容。
* @returns
*/ AST#method_declaration#Left static getDataTextSync AST#parameter_list#Left ( ) 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil 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 . getPrimaryText 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 /**
* 将HTML数据写入系统剪贴板,使用Promise异步回调。
* @param html HTML内容
* @returns
*/ AST#method_declaration#Left static async setDataHtml AST#parameter_list#Left ( AST#parameter#Left html : 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#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 PasteboardUtil AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_HTML AST#member_expression#Right AST#expression#Right , AST#expression#Left html 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 /**
* 将HTML数据写入系统剪贴板。
* @param html HTML内容
* @returns
*/ AST#method_declaration#Left static async setDataHtmlSync AST#parameter_list#Left ( AST#parameter#Left html : 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#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 PasteboardUtil AST#expression#Right . setDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_HTML AST#member_expression#Right AST#expression#Right , AST#expression#Left html 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 /**
* 读取系统剪贴板HTML内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getDataHtml 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#variable_declaration#Left const AST#variable_declarator#Left pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PasteboardUtil AST#expression#Right AST#await_expression#Right 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#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 pasteData AST#expression#Right . getPrimaryHtml 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 /**
* 读取系统剪贴板HTML内容。
* @returns
*/ AST#method_declaration#Left static getDataHtmlSync AST#parameter_list#Left ( ) 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil 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 . getPrimaryHtml 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 /**
* 将URI数据写入系统剪贴板,使用Promise异步回调。
* @param uri URI内容
* @returns
*/ AST#method_declaration#Left static async setDataUri AST#parameter_list#Left ( AST#parameter#Left uri : 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#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 PasteboardUtil AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_URI AST#member_expression#Right AST#expression#Right , AST#expression#Left uri 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 /**
* 将URI数据写入系统剪贴板。
* @param uri URI内容
* @returns
*/ AST#method_declaration#Left static setDataUriSync AST#parameter_list#Left ( AST#parameter#Left uri : 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#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 PasteboardUtil AST#expression#Right . setDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_URI AST#member_expression#Right AST#expression#Right , AST#expression#Left uri 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 /**
* 读取系统剪贴板URI内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getDataUri 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#variable_declaration#Left const AST#variable_declarator#Left pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PasteboardUtil AST#expression#Right AST#await_expression#Right 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#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 pasteData AST#expression#Right . getPrimaryUri 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 /**
* 读取系统剪贴板URI内容。
* @returns
*/ AST#method_declaration#Left static getDataUriSync AST#parameter_list#Left ( ) 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil 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 . getPrimaryUri 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 /**
* 将Want数据写入系统剪贴板,使用Promise异步回调。
* @param want Want内容
* @returns
*/ AST#method_declaration#Left static async setDataWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want 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#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 PasteboardUtil AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_WANT AST#member_expression#Right AST#expression#Right , AST#expression#Left want 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 /**
* 将Want数据写入系统剪贴板。
* @param want Want内容
* @returns
*/ AST#method_declaration#Left static setDataWantSync AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want 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 PasteboardUtil AST#expression#Right . setDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_TEXT_WANT AST#member_expression#Right AST#expression#Right , AST#expression#Left want 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 /**
* 读取系统剪贴板Want内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getDataWant 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 Want 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 pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PasteboardUtil AST#expression#Right AST#await_expression#Right 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#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 pasteData AST#expression#Right . getPrimaryWant 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 /**
* 读取系统剪贴板Want内容。
* @returns
*/ AST#method_declaration#Left static getDataWantSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Want 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 . getDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getPrimaryWant 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 /**
* 将PixelMap数据写入系统剪贴板,使用Promise异步回调。
* @param pixelMap PixelMap
* @returns
*/ AST#method_declaration#Left static async setDataPixelMap AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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 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#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 PasteboardUtil AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_PIXELMAP AST#member_expression#Right AST#expression#Right , AST#expression#Left pixelMap 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 /**
* 将PixelMap数据写入系统剪贴板。
* @param pixelMap PixelMap
* @returns
*/ AST#method_declaration#Left static setDataPixelMapSync AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_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 PasteboardUtil AST#expression#Right . setDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left pasteboard AST#expression#Right . MIMETYPE_PIXELMAP AST#member_expression#Right AST#expression#Right , AST#expression#Left pixelMap 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 /**
* 读取系统剪贴板PixelMap内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getDataPixelMap 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 AST#qualified_type#Left image . PixelMap 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pasteData : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PasteboardUtil AST#expression#Right AST#await_expression#Right 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#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 pasteData AST#expression#Right . getPrimaryPixelMap 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 /**
* 读取系统剪贴板PixelMap内容。
* @returns
*/ AST#method_declaration#Left static getDataPixelMapSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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 . getDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getPrimaryPixelMap 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 /**
* 读取系统剪贴板里的字符串(),使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async getDataStr 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil AST#expression#Right . hasDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pasteData = 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 PasteboardUtil AST#expression#Right AST#await_expression#Right 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mimeType = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteData AST#expression#Right . getPrimaryMimeType 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryText 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_HTML AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryHtml 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_URI AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryUri 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#if_statement#Right AST#if_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#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 读取系统剪贴板里的字符串。
* @returns
*/ AST#method_declaration#Left static getDataStrSync AST#parameter_list#Left ( ) 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil AST#expression#Right . hasDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pasteData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mimeType = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteData AST#expression#Right . getPrimaryMimeType 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryText 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_HTML AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryHtml 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_URI AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryUri 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#if_statement#Right AST#if_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#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 读取系统剪贴板里的内容(纯文本内容、HTML内容、URI内容、Want内容、PixelMap内容)。
* @returns
*/ AST#method_declaration#Left static getDataEasy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Want AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_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 PasteboardUtil AST#expression#Right . hasDataSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pasteData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PasteboardUtil 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left mimeType = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pasteData AST#expression#Right . getPrimaryMimeType 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_PLAIN AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryText 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_HTML AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryHtml 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_URI AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryUri 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_TEXT_WANT AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryWant 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left mimeType AST#expression#Right === AST#expression#Left pasteboard AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIMETYPE_PIXELMAP AST#member_expression#Right AST#expression#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 pasteData AST#expression#Right . getPrimaryPixelMap 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#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_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 undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 清空系统剪贴板内容,使用Promise异步回调。
* @returns
*/ AST#method_declaration#Left static async clearData 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#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#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 . clearData 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 /**
* 清空系统剪贴板内容。
* @returns
*/ AST#method_declaration#Left static clearDataSync 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#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 . clearDataSync 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 /**
* 读取系统剪贴板里的字符串。该方法已废弃,建议使用getDataStrSync()。
* @returns
*/ AST#method_declaration#Left static getDataSyncStr AST#parameter_list#Left ( ) 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 PasteboardUtil AST#expression#Right . getDataStrSync 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class PasteboardUtil {
static async requestPermissions(): Promise<boolean> {
return await PermissionUtil.requestPermissionsEasy('ohos.permission.READ_PASTEBOARD');
}
static getSystemPasteboard(): pasteboard.SystemPasteboard {
const systemPasteboard: pasteboard.SystemPasteboard = pasteboard.getSystemPasteboard();
return systemPasteboard;
}
static async hasData(): Promise<boolean> {
return PasteboardUtil.getSystemPasteboard().hasData();
}
static hasDataSync(): boolean {
return PasteboardUtil.getSystemPasteboard().hasDataSync();
}
static async setData(mimeType: string, value: pasteboard.ValueType): Promise<void> {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setData(pasteData);
}
static setDataSync(mimeType: string, value: pasteboard.ValueType) {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setDataSync(pasteData);
}
static async getData(): Promise<pasteboard.PasteData> {
return PasteboardUtil.getSystemPasteboard().getData();
}
static getDataSync(): pasteboard.PasteData {
return PasteboardUtil.getSystemPasteboard().getDataSync();
}
static async setDataText(text: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
}
static setDataTextSync(text: string) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_PLAIN, text);
}
static async getDataText(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryText();
}
static getDataTextSync(): string {
return PasteboardUtil.getDataSync().getPrimaryText();
}
static async setDataHtml(html: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_HTML, html);
}
static async setDataHtmlSync(html: string) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_HTML, html);
}
static async getDataHtml(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryHtml();
}
static getDataHtmlSync(): string {
return PasteboardUtil.getDataSync().getPrimaryHtml();
}
static async setDataUri(uri: string): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_URI, uri);
}
static setDataUriSync(uri: string) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_URI, uri);
}
static async getDataUri(): Promise<string> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryUri();
}
static getDataUriSync(): string {
return PasteboardUtil.getDataSync().getPrimaryUri();
}
static async setDataWant(want: Want): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_TEXT_WANT, want);
}
static setDataWantSync(want: Want) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_WANT, want);
}
static async getDataWant(): Promise<Want> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryWant();
}
static getDataWantSync(): Want {
return PasteboardUtil.getDataSync().getPrimaryWant();
}
static async setDataPixelMap(pixelMap: image.PixelMap): Promise<void> {
PasteboardUtil.setData(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
}
static setDataPixelMapSync(pixelMap: image.PixelMap) {
PasteboardUtil.setDataSync(pasteboard.MIMETYPE_PIXELMAP, pixelMap);
}
static async getDataPixelMap(): Promise<image.PixelMap> {
const pasteData: pasteboard.PasteData = await PasteboardUtil.getData();
return pasteData.getPrimaryPixelMap();
}
static getDataPixelMapSync(): image.PixelMap {
return PasteboardUtil.getDataSync().getPrimaryPixelMap();
}
static async getDataStr(): Promise<string> {
if (PasteboardUtil.hasDataSync()) {
let pasteData = await PasteboardUtil.getData();
let mimeType = pasteData.getPrimaryMimeType();
if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) {
return pasteData.getPrimaryText();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_HTML) {
return pasteData.getPrimaryHtml();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_URI) {
return pasteData.getPrimaryUri();
}
}
return "";
}
static getDataStrSync(): string {
if (PasteboardUtil.hasDataSync()) {
let pasteData = PasteboardUtil.getDataSync();
let mimeType = pasteData.getPrimaryMimeType();
if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) {
return pasteData.getPrimaryText();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_HTML) {
return pasteData.getPrimaryHtml();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_URI) {
return pasteData.getPrimaryUri();
}
}
return "";
}
static getDataEasy(): string | Want | image.PixelMap | undefined {
if (PasteboardUtil.hasDataSync()) {
let pasteData = PasteboardUtil.getDataSync();
let mimeType = pasteData.getPrimaryMimeType();
if (mimeType === pasteboard.MIMETYPE_TEXT_PLAIN) {
return pasteData.getPrimaryText();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_HTML) {
return pasteData.getPrimaryHtml();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_URI) {
return pasteData.getPrimaryUri();
} else if (mimeType === pasteboard.MIMETYPE_TEXT_WANT) {
return pasteData.getPrimaryWant();
} else if (mimeType === pasteboard.MIMETYPE_PIXELMAP) {
return pasteData.getPrimaryPixelMap();
}
}
return undefined;
}
static async clearData(): Promise<void> {
PasteboardUtil.getSystemPasteboard().clearData();
}
static clearDataSync() {
PasteboardUtil.getSystemPasteboard().clearDataSync();
}
static getDataSyncStr(): string {
return PasteboardUtil.getDataStrSync();
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L27-L379
|
5b4b91fd99a6e00a82cf123c5105aaf68ae90041
|
gitee
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/arkui/component/gesture.d.ets
|
arkts
|
onActionStart
|
Pinch gesture recognition success callback.
@param { Callback<GestureEvent> } event
@returns { PinchGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20
|
onActionStart(event: Callback<GestureEvent>): PinchGesture;
|
AST#method_declaration#Left onActionStart AST#parameter_list#Left ( AST#parameter#Left event : 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 GestureEvent 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 PinchGesture AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
onActionStart(event: Callback<GestureEvent>): PinchGesture;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L603-L603
|
1148a85e41f786bf58067a331936ab97edeb0c1a
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/design/DesignSystem.ets
|
arkts
|
withOpacity
|
获取带透明度的颜色
|
static withOpacity(color: string, opacity: number): string {
// 简单的透明度处理,实际项目中可以使用更复杂的颜色处理库
const alpha = Math.round(opacity * 255).toString(16).padStart(2, '0');
return `${color}${alpha}`;
}
|
AST#method_declaration#Left static withOpacity 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#Left opacity : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 简单的透明度处理,实际项目中可以使用更复杂的颜色处理库 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left alpha = 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 Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left opacity AST#expression#Right * AST#expression#Left 255 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left '0' 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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left color AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left alpha AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static withOpacity(color: string, opacity: number): string {
const alpha = Math.round(opacity * 255).toString(16).padStart(2, '0');
return `${color}${alpha}`;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/design/DesignSystem.ets#L206-L210
|
78f16dfbeff1b356523cc392096b0389ab44ef26
|
github
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets
|
arkts
|
getYPx
|
returns the y-position of the highlight in pixels
|
public getYPx(): number {
return this.mYPx;
}
|
AST#method_declaration#Left public getYPx 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 . mYPx AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public getYPx(): number {
return this.mYPx;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/Highlight.ets#L128-L130
|
dac2fd34453b55761bd2e1061be73d4f741e91f4
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/database/ContactDAO.ets
|
arkts
|
getAllContacts
|
获取所有联系人
@returns 联系人数组
|
async getAllContacts(): Promise<ContactEntity[]> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore.RdbPredicates('contacts');
predicates.orderByAsc('name'); // 按姓名排序
const resultSet = await rdbStore.query(predicates);
const contacts: ContactEntity[] = [];
if (resultSet.goToFirstRow()) {
do {
contacts.push(this.mapResultSetToContact(resultSet));
} while (resultSet.goToNextRow());
}
resultSet.close();
return contacts;
}
|
AST#method_declaration#Left async getAllContacts 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 AST#array_type#Left ContactEntity [ ] AST#array_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 rdbStore = 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 . dbManager AST#member_expression#Right AST#expression#Right . getRdbStore 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#unary_expression#Left ! AST#expression#Left rdbStore AST#expression#Right AST#unary_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 'Database not initialized' 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left predicates = 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 relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'contacts' 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 predicates AST#expression#Right . orderByAsc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'name' 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 resultSet = 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 rdbStore AST#expression#Right AST#await_expression#Right AST#expression#Right . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates 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 contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContactEntity [ ] 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToFirstRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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 do 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#object_literal#Left { AST#property_assignment#Left contacts AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . push 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 this AST#expression#Right . mapResultSetToContact AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet 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#while_statement#Left while ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . goToNextRow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#try_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 resultSet AST#expression#Right . close 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#return_statement#Left return AST#expression#Left contacts AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getAllContacts(): Promise<ContactEntity[]> {
const rdbStore = this.dbManager.getRdbStore();
if (!rdbStore) {
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore.RdbPredicates('contacts');
predicates.orderByAsc('name');
const resultSet = await rdbStore.query(predicates);
const contacts: ContactEntity[] = [];
if (resultSet.goToFirstRow()) {
do {
contacts.push(this.mapResultSetToContact(resultSet));
} while (resultSet.goToNextRow());
}
resultSet.close();
return contacts;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/ContactDAO.ets#L94-L115
|
373ae029d462edbc5a661932b75b82c41540a20f
|
github
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.file.AlbumPickerComponent.d.ets
|
arkts
|
The callback of onEmptyAreaClick event
@typedef { function } EmptyAreaClickCallback
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 13
|
export type EmptyAreaClickCallback = () => void;
|
AST#export_declaration#Left export AST#type_declaration#Left type EmptyAreaClickCallback = AST#type_annotation#Left AST#function_type#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#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
|
export type EmptyAreaClickCallback = () => void;
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.AlbumPickerComponent.d.ets#L66-L66
|
8ab67c3fa785a9ed554cca35cc3f70d37ff73b69
|
github
|
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/components/menu/VHInviteDialog.ets
|
arkts
|
VHInviteDialog
|
邀请底部弹窗视图
|
@CustomDialog
export struct VHInviteDialog {
controller: CustomDialogController
@Consume inviteCard: VHInviteCard;
@Require webinars: VHWebinarData;
@Require inviteCode: string;
@State selectedCardId: string = '-1';
// 选中的图片资源
@State selectedImage: string ='';
// 预览图是否显示
@State showPreview: boolean = true;
// 操作菜单是否显示
@State showActionMenu: boolean = false;
// 操作菜单位置
@State menuPosition: Position = { x: 0, y: 0 };
private rqCodeUrl: string = '';
@State filePath: string = ''; // 保存图片后的文件路径
private targetId: string = "contentToCapture"; // 目标组件ID
aboutToAppear() {
let liveDetailUrl = VHSaaSDK.getInstance()
.getLiveDetailUrl(this.webinars?.webinar!.id.toString(), this.webinars?.join_info!.user_id.toString(),
this.inviteCard?.invite_code!);
this.rqCodeUrl = 'https://aliqr.e.vhall.com/qr.png?s=7&t=' + encodeURIComponent(liveDetailUrl);
}
// 关闭弹窗
private closePopup() {
this.resetState();
this.controller.close()
}
// 处理长按事件
private handleLongPress(event: GestureEvent) {
this.menuPosition = {
x: event.velocityX,
y: event.velocityY
};
this.showActionMenu = true;
}
// 重置状态
private resetState() {
this.selectedCardId = '-1';
this.selectedImage = '';
this.showPreview = false;
this.showActionMenu = false;
}
// 图片分享
private async shareImage() {
this.showActionMenu = false;
const uiContext: UIContext = this.getUIContext();
if(this.filePath === ''){
try {
// 等待截图完成并保存文件
await new Promise<void>((resolve, reject) => {
componentSnapshot.get(this.targetId)
.then(async (pixmap: image.PixelMap) => {
if (pixmap !== null) {
// 处理获取到的快照
const context = getContext(this) as common.UIAbilityContext;
this.filePath = await this.saveFile(context, pixmap);
resolve();
} else {
reject(new Error("未能获取到截图"));
}
}).catch((err: Error) => {
console.log("错误: " + err);
reject(err);
});
});
} catch (error) {
promptAction.showToast({ message: "截图保存失败" });
return;
}
}
let utdTypeId = utd.getUniformDataTypeByFilenameExtension('.jpg', utd.UniformDataType.IMAGE);
let shareData: systemShare.SharedData = new systemShare.SharedData({
utd: utdTypeId,
uri: this.filePath,
title: this.inviteCard.title,
description: '分享图片' + this.inviteCard.title,
});
let controller: systemShare.ShareController = new systemShare.ShareController(shareData);
const context: common.UIAbilityContext = uiContext.getHostContext() as common.UIAbilityContext;
controller.show(context, {
selectionMode: systemShare.SelectionMode.SINGLE,
previewMode: systemShare.SharePreviewMode.DETAIL,
}).then(() => {
console.info('分享成功.');
promptAction.showToast({ message: "分享成功!" });
}).catch((error: BusinessError) => {
console.error(`ShareController show error. code: ${error?.code}, message: ${error?.message}`);
promptAction.showToast({
message: '分享失败,请重试',
duration: 2000
});
});
}
// 保存图片到本地像册
private async saveImage() {
this.showActionMenu = false;
componentSnapshot.get(this.targetId)
.then(async (pixmap: image.PixelMap) => {
if (pixmap !== null) {
// 处理获取到的快照
const context = getContext(this) as common.UIAbilityContext;
this.filePath = await this.saveFile(context, pixmap);
console.log('保存路径:', this.filePath);
promptAction.showToast({ message: "保存路径!" + this.filePath });
}
}).catch((err: Error) => {
console.log("错误: " + err);
})
}
/**
* packing获取图片的ArrayBuffer数据,再使用fs库将图片写入文件
*/
async saveFile(context: Context, pixelMap: PixelMap): Promise<string> {
// 添加权限检查
let hasPermission = await this.requestMediaPermission();
if (!hasPermission) {
promptAction.showToast({ message: '未获得相册访问权限,无法保存图片' });
throw new Error('Permission denied');
}
// 创建图像编码ImagePacker对象
const imagePackerApi = image.createImagePacker();
// 设置编码输出流和编码参数。format为图像的编码格式;quality为图像质量,范围从0-100,100为最佳质量
const options: image.PackingOption = { format: 'image/jpeg', quality: 100 };
// 图片写入的沙箱路径
const filePath: string = `${context.filesDir}/${this.inviteCard.title}.jpg`;
// 使用packing打包获取图片的ArrayBuffer
const data: ArrayBuffer = await imagePackerApi.packing(pixelMap, options);
// 保存相册获得URI
let helper = photoAccessHelper.getPhotoAccessHelper(context);
let uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg');
// 写入相册
let file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
await fs.write(file.fd, data);
await fs.close(file.fd);
return uri;
}
/**
* 获取当前时间的拼接字符串,用于图片命名
*/
private getTimeStr(): string {
const now: Date = new Date();
const year: number = now.getFullYear();
const month: number = now.getMonth() + 1;
const day: number = now.getDate();
const hours: number = now.getHours();
const minutes: number = now.getMinutes();
const seconds: number = now.getSeconds();
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
}
// 检查并请求媒体库权限
async requestMediaPermission() {
let atManager = abilityAccessCtrl.createAtManager();
// 2. 获取应用Bundle信息(含令牌相关信息)
const bundleInfo =
await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
const tokenId = bundleInfo.appInfo.accessTokenId; // 从应用信息中获取tokenID
let result = atManager.verifyAccessTokenSync(tokenId, 'ohos.permission.WRITE_MEDIA');
if (result === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
// 已获得权限,可以进行媒体库操作
return true;
} else {
// 申请权限
let requestResult = await atManager.requestPermissionsFromUser(
getContext(),
['ohos.permission.WRITE_MEDIA']
);
return requestResult.authResults[0] === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED;
}
}
// 使用示例
async accessMediaLibrary() {
let hasPermission = await this.requestMediaPermission();
if (hasPermission) {
// 执行媒体库操作
console.log("已获得媒体库访问权限");
} else {
console.log("未获得媒体库访问权限,无法执行操作");
}
}
build() {
Column(){
Column() {
Row(){
Image($r('app.media.fingerprint'))
.width(24)
.height(24)
Text('按图片保存或分享')
.fontSize(14)
.fontColor(Color.White)
}
}
.width('100%')
.height(20)
.margin({ bottom: 10 })
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
Column({ space: 8 }) {
Column() {
Row() {
Image(this.webinars?.join_info?.avatar)
.width(30)
.height(30)
.borderRadius(20)
.margin(10)
Column() {
Text(ChatTools.getLimitString(this.webinars?.join_info?.nickname!, 8))
.fontSize(12)
Text('邀请您一起参与')
.fontSize(12)
}.width('100%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Center)
}.width('100%').alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Start)
}
Column({ space: 4 }) {
Image(this.inviteCard.cover_img)
.width(260)
.height(130)
.objectFit(ImageFit.Cover)
.borderRadius(2)
Text(this.inviteCard.title)
.margin({top:20,bottom:20})
.fontSize(20)
.textAlign(TextAlign.Center)
Text('时间')
.fontSize(12)
.textAlign(TextAlign.Center)
Text(this.inviteCard.date_time)
.fontSize(12)
.textAlign(TextAlign.Center)
Divider()
.strokeWidth(0.5)
.color('#e5e5e5')
.borderWidth(0.5)
.borderStyle(BorderStyle.Dashed)
.margin({top:40,bottom:8,left:12,right:12})
Image(this.rqCodeUrl)
.width(80)
.height(80)
.margin({ top:12})
Text('扫码观看直播')
.fontSize(12)
.fontColor(Color.Gray)
.textAlign(TextAlign.Center)
}.width(280)
.height(450)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
.borderRadius(8)
.backgroundColor(Color.White)
}
.id(this.targetId)
.width(300)
.height(550)
.borderRadius(8)
.backgroundImage($r('app.media.poster_bg'))
.backgroundImageSize(ImageSize.Cover)
.gesture(
LongPressGesture()
.onAction((event) => {
this.handleLongPress(event);
})
)
// 长按操作菜单
if (this.showActionMenu)
Column()
{
Text('保存图片')
.width('100%')
.padding(12)
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => this.saveImage())
Divider().height(1).color('#EEEEEE')
Text('分享')
.width('100%')
.padding(12)
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => this.shareImage())
Divider().height(1).color('#EEEEEE')
Text('关闭')
.width('100%')
.padding(12)
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => this.showActionMenu=false)
}
.width(160)
.backgroundColor('#FFFFFF')
.borderRadius(8)
.shadow({ radius: 10, color: '#44000000' })
.zIndex(14)
.position({
x: (this.menuPosition.x ?? 0) + 50,
y: (this.menuPosition.y ?? 0) + 100
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct VHInviteDialog AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right inviteCard : AST#type_annotation#Left AST#primary_type#Left VHInviteCard AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right webinars : AST#type_annotation#Left AST#primary_type#Left VHWebinarData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right inviteCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedCardId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '-1' AST#expression#Right ; AST#property_declaration#Right // 选中的图片资源 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right selectedImage : 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 AST#decorator#Left @ State AST#decorator#Right showPreview : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 操作菜单是否显示 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right showActionMenu : 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#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right menuPosition : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y 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 rqCodeUrl : 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 AST#decorator#Left @ State AST#decorator#Right filePath : 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 private targetId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "contentToCapture" AST#expression#Right ; AST#property_declaration#Right // 目标组件ID AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left liveDetailUrl = 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 VHSaaSDK 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 . getLiveDetailUrl 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 AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webinars AST#member_expression#Right AST#expression#Right ?. webinar AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . id AST#member_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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . webinars AST#member_expression#Right AST#expression#Right ?. join_info AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . user_id AST#member_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 AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inviteCard AST#member_expression#Right AST#expression#Right ?. invite_code AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rqCodeUrl AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'https://aliqr.e.vhall.com/qr.png?s=7&t=' AST#expression#Right + AST#expression#Left encodeURIComponent AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left liveDetailUrl 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 // 关闭弹窗 AST#method_declaration#Left private closePopup 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 . resetState 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 . controller AST#member_expression#Right AST#expression#Right . close 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 // 处理长按事件 AST#method_declaration#Left private handleLongPress AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent 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 . menuPosition AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . velocityX AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . velocityY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_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 . showActionMenu 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#builder_function_body#Right AST#method_declaration#Right // 重置状态 AST#method_declaration#Left private resetState AST#parameter_list#Left ( ) 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 . selectedCardId AST#member_expression#Right = AST#expression#Left '-1' 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 . selectedImage AST#member_expression#Right = AST#expression#Left '' 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 . showPreview 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 . showActionMenu 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 // 图片分享 AST#method_declaration#Left private async shareImage 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 . showActionMenu 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext 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 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 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 this AST#expression#Right . filePath 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#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 AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#await_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject 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#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 componentSnapshot AST#expression#Right . get 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 . targetId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left pixmap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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#binary_expression#Left AST#expression#Left pixmap 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#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#as_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 as 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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filePath AST#member_expression#Right = 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 . saveFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left pixmap 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#call_expression#Left AST#expression#Left resolve 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#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( 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#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#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#type_annotation#Left AST#primary_type#Left Error 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#binary_expression#Left AST#expression#Left "错误: " AST#expression#Right + AST#expression#Left err 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 reject 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#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#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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left "截图保存失败" 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#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#catch_clause#Right AST#try_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 utdTypeId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . getUniformDataTypeByFilenameExtension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '.jpg' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . IMAGE 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 shareData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . SharedData 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#new_expression#Left new AST#expression#Left systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . SharedData 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 utd AST#property_name#Right : AST#expression#Left utdTypeId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filePath AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title 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 . inviteCard AST#member_expression#Right AST#expression#Right . title AST#member_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#member_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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . inviteCard AST#member_expression#Right AST#expression#Right . title AST#member_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 controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . ShareController 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#new_expression#Left new AST#expression#Left systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . ShareController AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left shareData 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 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#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left uiContext 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 as 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#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 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 controller AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left selectionMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left systemShare AST#expression#Right . SelectionMode AST#member_expression#Right AST#expression#Right . SINGLE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left previewMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left systemShare AST#expression#Right . SharePreviewMode AST#member_expression#Right AST#expression#Right . DETAIL AST#member_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 . 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_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#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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left "分享成功!" 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#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 . 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 error : 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#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 ` ShareController show error. code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right ?. code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left '分享失败,请重试' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 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#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 // 保存图片到本地像册 AST#method_declaration#Left private async saveImage AST#parameter_list#Left ( ) 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 . showActionMenu 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#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 componentSnapshot AST#expression#Right . get 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 . targetId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left pixmap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap 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#binary_expression#Left AST#expression#Left pixmap 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#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#as_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 as 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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filePath AST#member_expression#Right = 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 . saveFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left pixmap 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#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . filePath 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "保存路径!" AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . filePath AST#member_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#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#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#type_annotation#Left AST#primary_type#Left Error 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#binary_expression#Left AST#expression#Left "错误: " AST#expression#Right + AST#expression#Left err 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#arrow_function#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 /**
* packing获取图片的ArrayBuffer数据,再使用fs库将图片写入文件
*/ AST#method_declaration#Left async saveFile AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap 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 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#variable_declaration#Left let AST#variable_declarator#Left hasPermission = 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 . requestMediaPermission 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#unary_expression#Left ! AST#expression#Left hasPermission AST#expression#Right AST#unary_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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left '未获得相册访问权限,无法保存图片' 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#expression_statement#Right AST#statement#Right 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 'Permission denied' 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 // 创建图像编码ImagePacker对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imagePackerApi = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImagePacker 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 // 设置编码输出流和编码参数。format为图像的编码格式;quality为图像质量,范围从0-100,100为最佳质量 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PackingOption 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 format AST#property_name#Right : AST#expression#Left 'image/jpeg' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left quality AST#property_name#Right : AST#expression#Left 100 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 filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . filesDir 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . inviteCard AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right .jpg ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 使用packing打包获取图片的ArrayBuffer AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer 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#await_expression#Left await AST#expression#Left imagePackerApi AST#expression#Right AST#await_expression#Right AST#expression#Right . packing AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right , AST#expression#Left options 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 // 保存相册获得URI AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left helper = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . getPhotoAccessHelper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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 uri = 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 helper AST#expression#Right AST#await_expression#Right AST#expression#Right . createAsset 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 photoAccessHelper AST#expression#Right . PhotoType AST#member_expression#Right AST#expression#Right . IMAGE AST#member_expression#Right AST#expression#Right , AST#expression#Left 'jpg' 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 file = 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 fs AST#expression#Right AST#await_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri 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 fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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#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 fs AST#expression#Right AST#await_expression#Right AST#expression#Right . write AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left data 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#await_expression#Left await AST#expression#Left fs AST#expression#Right AST#await_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd 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 uri AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取当前时间的拼接字符串,用于图片命名
*/ AST#method_declaration#Left private getTimeStr AST#parameter_list#Left ( ) 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 const AST#variable_declarator#Left now : AST#type_annotation#Left AST#primary_type#Left Date 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 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left year : 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 AST#member_expression#Left AST#expression#Left now AST#expression#Right . getFullYear 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 month : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now 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 day : 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 AST#member_expression#Left AST#expression#Left now 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#variable_declaration#Left const AST#variable_declarator#Left hours : 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 AST#member_expression#Left AST#expression#Left now AST#expression#Right . getHours 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 minutes : 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 AST#member_expression#Left AST#expression#Left now AST#expression#Right . getMinutes 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 seconds : 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 AST#member_expression#Left AST#expression#Left now AST#expression#Right . getSeconds 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#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left month AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left day AST#expression#Right } AST#template_substitution#Right _ AST#template_substitution#Left $ { AST#expression#Left hours AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left minutes AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left seconds AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 检查并请求媒体库权限 AST#method_declaration#Left async requestMediaPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left atManager = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left abilityAccessCtrl AST#expression#Right . createAtManager 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 // 2. 获取应用Bundle信息(含令牌相关信息) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left bundleInfo = 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 bundleManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getBundleInfoForSelf 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 bundleManager AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_APPLICATION 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 const AST#variable_declarator#Left tokenId = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleInfo AST#expression#Right . appInfo AST#member_expression#Right AST#expression#Right . accessTokenId AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 从应用信息中获取tokenID 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 atManager AST#expression#Right . verifyAccessTokenSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tokenId AST#expression#Right , AST#expression#Left 'ohos.permission.WRITE_MEDIA' 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left result AST#expression#Right === AST#expression#Left abilityAccessCtrl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GrantStatus AST#member_expression#Right AST#expression#Right . PERMISSION_GRANTED AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 已获得权限,可以进行媒体库操作 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 else AST#block_statement#Left { // 申请权限 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left requestResult = 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 atManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestPermissionsFromUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'ohos.permission.WRITE_MEDIA' AST#expression#Right ] AST#array_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 AST#member_expression#Left AST#expression#Left AST#member_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 requestResult AST#expression#Right . authResults AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left abilityAccessCtrl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GrantStatus AST#member_expression#Right AST#expression#Right . PERMISSION_GRANTED 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#block_statement#Right AST#method_declaration#Right // 使用示例 AST#method_declaration#Left async accessMediaLibrary AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hasPermission = 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 . requestMediaPermission 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 hasPermission 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 . log 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#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 console AST#expression#Right . log 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#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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 Column ( ) AST#container_content_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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.fingerprint' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 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 . fontSize ( AST#expression#Left 14 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#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#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 20 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center 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 . 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#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 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#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 Image ( 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 . webinars AST#member_expression#Right AST#expression#Right ?. join_info AST#member_expression#Right AST#expression#Right ?. avatar AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 10 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#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ChatTools AST#expression#Right . getLimitString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_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 . webinars AST#member_expression#Right AST#expression#Right ?. join_info AST#member_expression#Right AST#expression#Right ?. nickname AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right , AST#expression#Left 8 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 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#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 . Center 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 } 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 VerticalAlign AST#expression#Right . Center 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 . Start 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 } AST#container_content_body#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 Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . inviteCard AST#member_expression#Right AST#expression#Right . cover_img AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 260 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 130 AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 2 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . inviteCard AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#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 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 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#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 . fontSize ( AST#expression#Left 12 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . inviteCard AST#member_expression#Right AST#expression#Right . date_time AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 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#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 . strokeWidth ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#e5e5e5' AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left 0.5 AST#expression#Right ) AST#modifier_chain_expression#Left . borderStyle ( AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Dashed AST#member_expression#Right 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 40 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rqCodeUrl AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 80 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 12 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#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 . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray 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#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 280 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 450 AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center 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 . Center AST#member_expression#Right 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 Color AST#expression#Right . White 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . targetId AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 300 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 550 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImage ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.poster_bg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImageSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageSize AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . gesture ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left LongPressGesture AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onAction 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 event 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 this AST#expression#Right . handleLongPress AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showActionMenu AST#member_expression#Right AST#expression#Right AST#ERROR#Left ) Column ( AST#ERROR#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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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 . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . saveImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#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#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 . height ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#EEEEEE' 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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 . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . shareImage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#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#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 . height ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#EEEEEE' 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 . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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 . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showActionMenu 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#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#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 160 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#44000000' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . menuPosition AST#member_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#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 50 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . menuPosition AST#member_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#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 100 AST#expression#Right AST#binary_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#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
|
@CustomDialog
export struct VHInviteDialog {
controller: CustomDialogController
@Consume inviteCard: VHInviteCard;
@Require webinars: VHWebinarData;
@Require inviteCode: string;
@State selectedCardId: string = '-1';
@State selectedImage: string ='';
@State showPreview: boolean = true;
@State showActionMenu: boolean = false;
@State menuPosition: Position = { x: 0, y: 0 };
private rqCodeUrl: string = '';
@State filePath: string = '';
private targetId: string = "contentToCapture";
aboutToAppear() {
let liveDetailUrl = VHSaaSDK.getInstance()
.getLiveDetailUrl(this.webinars?.webinar!.id.toString(), this.webinars?.join_info!.user_id.toString(),
this.inviteCard?.invite_code!);
this.rqCodeUrl = 'https://aliqr.e.vhall.com/qr.png?s=7&t=' + encodeURIComponent(liveDetailUrl);
}
private closePopup() {
this.resetState();
this.controller.close()
}
private handleLongPress(event: GestureEvent) {
this.menuPosition = {
x: event.velocityX,
y: event.velocityY
};
this.showActionMenu = true;
}
private resetState() {
this.selectedCardId = '-1';
this.selectedImage = '';
this.showPreview = false;
this.showActionMenu = false;
}
private async shareImage() {
this.showActionMenu = false;
const uiContext: UIContext = this.getUIContext();
if(this.filePath === ''){
try {
await new Promise<void>((resolve, reject) => {
componentSnapshot.get(this.targetId)
.then(async (pixmap: image.PixelMap) => {
if (pixmap !== null) {
const context = getContext(this) as common.UIAbilityContext;
this.filePath = await this.saveFile(context, pixmap);
resolve();
} else {
reject(new Error("未能获取到截图"));
}
}).catch((err: Error) => {
console.log("错误: " + err);
reject(err);
});
});
} catch (error) {
promptAction.showToast({ message: "截图保存失败" });
return;
}
}
let utdTypeId = utd.getUniformDataTypeByFilenameExtension('.jpg', utd.UniformDataType.IMAGE);
let shareData: systemShare.SharedData = new systemShare.SharedData({
utd: utdTypeId,
uri: this.filePath,
title: this.inviteCard.title,
description: '分享图片' + this.inviteCard.title,
});
let controller: systemShare.ShareController = new systemShare.ShareController(shareData);
const context: common.UIAbilityContext = uiContext.getHostContext() as common.UIAbilityContext;
controller.show(context, {
selectionMode: systemShare.SelectionMode.SINGLE,
previewMode: systemShare.SharePreviewMode.DETAIL,
}).then(() => {
console.info('分享成功.');
promptAction.showToast({ message: "分享成功!" });
}).catch((error: BusinessError) => {
console.error(`ShareController show error. code: ${error?.code}, message: ${error?.message}`);
promptAction.showToast({
message: '分享失败,请重试',
duration: 2000
});
});
}
private async saveImage() {
this.showActionMenu = false;
componentSnapshot.get(this.targetId)
.then(async (pixmap: image.PixelMap) => {
if (pixmap !== null) {
const context = getContext(this) as common.UIAbilityContext;
this.filePath = await this.saveFile(context, pixmap);
console.log('保存路径:', this.filePath);
promptAction.showToast({ message: "保存路径!" + this.filePath });
}
}).catch((err: Error) => {
console.log("错误: " + err);
})
}
async saveFile(context: Context, pixelMap: PixelMap): Promise<string> {
let hasPermission = await this.requestMediaPermission();
if (!hasPermission) {
promptAction.showToast({ message: '未获得相册访问权限,无法保存图片' });
throw new Error('Permission denied');
}
const imagePackerApi = image.createImagePacker();
const options: image.PackingOption = { format: 'image/jpeg', quality: 100 };
const filePath: string = `${context.filesDir}/${this.inviteCard.title}.jpg`;
const data: ArrayBuffer = await imagePackerApi.packing(pixelMap, options);
let helper = photoAccessHelper.getPhotoAccessHelper(context);
let uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg');
let file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
await fs.write(file.fd, data);
await fs.close(file.fd);
return uri;
}
private getTimeStr(): string {
const now: Date = new Date();
const year: number = now.getFullYear();
const month: number = now.getMonth() + 1;
const day: number = now.getDate();
const hours: number = now.getHours();
const minutes: number = now.getMinutes();
const seconds: number = now.getSeconds();
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
}
async requestMediaPermission() {
let atManager = abilityAccessCtrl.createAtManager();
const bundleInfo =
await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);
const tokenId = bundleInfo.appInfo.accessTokenId;
let result = atManager.verifyAccessTokenSync(tokenId, 'ohos.permission.WRITE_MEDIA');
if (result === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
return true;
} else {
let requestResult = await atManager.requestPermissionsFromUser(
getContext(),
['ohos.permission.WRITE_MEDIA']
);
return requestResult.authResults[0] === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED;
}
}
async accessMediaLibrary() {
let hasPermission = await this.requestMediaPermission();
if (hasPermission) {
console.log("已获得媒体库访问权限");
} else {
console.log("未获得媒体库访问权限,无法执行操作");
}
}
build() {
Column(){
Column() {
Row(){
Image($r('app.media.fingerprint'))
.width(24)
.height(24)
Text('按图片保存或分享')
.fontSize(14)
.fontColor(Color.White)
}
}
.width('100%')
.height(20)
.margin({ bottom: 10 })
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
Column({ space: 8 }) {
Column() {
Row() {
Image(this.webinars?.join_info?.avatar)
.width(30)
.height(30)
.borderRadius(20)
.margin(10)
Column() {
Text(ChatTools.getLimitString(this.webinars?.join_info?.nickname!, 8))
.fontSize(12)
Text('邀请您一起参与')
.fontSize(12)
}.width('100%').alignItems(HorizontalAlign.Start).justifyContent(FlexAlign.Center)
}.width('100%').alignItems(VerticalAlign.Center).justifyContent(FlexAlign.Start)
}
Column({ space: 4 }) {
Image(this.inviteCard.cover_img)
.width(260)
.height(130)
.objectFit(ImageFit.Cover)
.borderRadius(2)
Text(this.inviteCard.title)
.margin({top:20,bottom:20})
.fontSize(20)
.textAlign(TextAlign.Center)
Text('时间')
.fontSize(12)
.textAlign(TextAlign.Center)
Text(this.inviteCard.date_time)
.fontSize(12)
.textAlign(TextAlign.Center)
Divider()
.strokeWidth(0.5)
.color('#e5e5e5')
.borderWidth(0.5)
.borderStyle(BorderStyle.Dashed)
.margin({top:40,bottom:8,left:12,right:12})
Image(this.rqCodeUrl)
.width(80)
.height(80)
.margin({ top:12})
Text('扫码观看直播')
.fontSize(12)
.fontColor(Color.Gray)
.textAlign(TextAlign.Center)
}.width(280)
.height(450)
.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
.borderRadius(8)
.backgroundColor(Color.White)
}
.id(this.targetId)
.width(300)
.height(550)
.borderRadius(8)
.backgroundImage($r('app.media.poster_bg'))
.backgroundImageSize(ImageSize.Cover)
.gesture(
LongPressGesture()
.onAction((event) => {
this.handleLongPress(event);
})
)
if (this.showActionMenu)
Column()
{
Text('保存图片')
.width('100%')
.padding(12)
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => this.saveImage())
Divider().height(1).color('#EEEEEE')
Text('分享')
.width('100%')
.padding(12)
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => this.shareImage())
Divider().height(1).color('#EEEEEE')
Text('关闭')
.width('100%')
.padding(12)
.fontSize(16)
.textAlign(TextAlign.Center)
.onClick(() => this.showActionMenu=false)
}
.width(160)
.backgroundColor('#FFFFFF')
.borderRadius(8)
.shadow({ radius: 10, color: '#44000000' })
.zIndex(14)
.position({
x: (this.menuPosition.x ?? 0) + 50,
y: (this.menuPosition.y ?? 0) + 100
})
}
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/menu/VHInviteDialog.ets#L26-L352
|
1ccc02bf015c13fc52ae22fc2a08d005724d562c
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets
|
arkts
|
drawExtras
|
Draws any kind of additional information (e.g. line-circles).
@param c
|
public abstract drawExtras(): Paint[];
|
AST#method_declaration#Left public abstract drawExtras AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Paint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
public abstract drawExtras(): Paint[];
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L185-L185
|
afdc948bafcef048f413e1047ab5e661f8c45b03
|
gitee
|
ChangweiZhang/chardet-arkts.git
|
3a214882ec6a2753c0fed84162952aa659341c19
|
src/main/ets/components/encoding/mbcs.ets
|
arkts
|
match
|
Test the match of this charset with the input text data
which is obtained via the CharsetDetector object.
@param det The CharsetDetector, which contains the input text
to be checked for being in this charset.
@return Two values packed into one int (Damn java, anyhow)
bits 0-7: the match confidence, ranging from 0-100
bits 8-15: The match reason, an enum-like value.
|
match(det: Context): Match | null {
let doubleByteCharCount = 0,
commonCharCount = 0,
badCharCount = 0,
totalCharCount = 0,
confidence = 0;
const iter = new IteratedChar();
detectBlock: {
for (iter.reset(); this.nextChar(iter, det); ) {
totalCharCount++;
if (iter.error) {
badCharCount++;
} else {
const cv = iter.charValue & 0xffffffff;
if (cv > 0xff) {
doubleByteCharCount++;
if (this.commonChars != null) {
// NOTE: This assumes that there are no 4-byte common chars.
if (binarySearch(this.commonChars, cv) >= 0) {
commonCharCount++;
}
}
}
}
if (badCharCount >= 2 && badCharCount * 5 >= doubleByteCharCount) {
// //console.log('its here!')
// Bail out early if the byte data is not matching the encoding scheme.
break detectBlock;
}
}
if (doubleByteCharCount <= 10 && badCharCount == 0) {
// Not many multi-byte chars.
if (doubleByteCharCount == 0 && totalCharCount < 10) {
// There weren't any multibyte sequences, and there was a low density of non-ASCII single bytes.
// We don't have enough data to have any confidence.
// Statistical analysis of single byte non-ASCII characters would probably help here.
confidence = 0;
} else {
// ASCII or ISO file? It's probably not our encoding,
// but is not incompatible with our encoding, so don't give it a zero.
confidence = 10;
}
break detectBlock;
}
//
// No match if there are too many characters that don't fit the encoding scheme.
// (should we have zero tolerance for these?)
//
if (doubleByteCharCount < 20 * badCharCount) {
confidence = 0;
break detectBlock;
}
if (this.commonChars == null) {
// We have no statistics on frequently occurring characters.
// Assess confidence purely on having a reasonable number of
// multi-byte characters (the more the better
confidence = 30 + doubleByteCharCount - 20 * badCharCount;
if (confidence > 100) {
confidence = 100;
}
} else {
// Frequency of occurrence statistics exist.
const maxVal = Math.log(doubleByteCharCount / 4);
const scaleFactor = 90.0 / maxVal;
confidence = Math.floor(
Math.log(commonCharCount + 1) * scaleFactor + 10
);
confidence = Math.min(confidence, 100);
}
}
|
AST#method_declaration#Left match AST#parameter_list#Left ( AST#parameter#Left det : AST#type_annotation#Left AST#primary_type#Left Context 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 Match 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#variable_declaration#Left let AST#variable_declarator#Left doubleByteCharCount = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right , AST#variable_declarator#Left commonCharCount = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right , AST#variable_declarator#Left badCharCount = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right , AST#variable_declarator#Left totalCharCount = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right , AST#variable_declarator#Left confidence = AST#expression#Left 0 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 iter = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left IteratedChar 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#expression_statement#Left AST#expression#Left detectBlock AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : { AST#ERROR#Right AST#statement#Left AST#for_statement#Left for ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left iter 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#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nextChar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iter AST#expression#Right , AST#expression#Left det 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#update_expression#Left AST#expression#Left totalCharCount AST#expression#Right ++ AST#update_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 iter AST#expression#Right . error AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left badCharCount 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#variable_declaration#Left const AST#variable_declarator#Left cv = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left iter AST#expression#Right . charValue AST#member_expression#Right AST#expression#Right & AST#expression#Left 0xffffffff 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left cv AST#expression#Right > AST#expression#Left 0xff 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#update_expression#Left AST#expression#Left doubleByteCharCount AST#expression#Right ++ AST#update_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 . commonChars 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 { // NOTE: This assumes that there are no 4-byte common chars. AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left binarySearch AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commonChars AST#member_expression#Right AST#expression#Right , AST#expression#Left cv AST#expression#Right ) AST#argument_list#Right AST#call_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#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left commonCharCount 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#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#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#binary_expression#Left AST#expression#Left badCharCount AST#expression#Right >= AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left badCharCount AST#expression#Right * AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right >= AST#expression#Left doubleByteCharCount AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // //console.log('its here!') // Bail out early if the byte data is not matching the encoding scheme. AST#statement#Left AST#break_statement#Left break detectBlock ; 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left doubleByteCharCount AST#expression#Right <= AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left badCharCount AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // Not many multi-byte chars. 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#binary_expression#Left AST#expression#Left doubleByteCharCount AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left totalCharCount AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left 10 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // There weren't any multibyte sequences, and there was a low density of non-ASCII single bytes. // We don't have enough data to have any confidence. // Statistical analysis of single byte non-ASCII characters would probably help here. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confidence = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // ASCII or ISO file? It's probably not our encoding, // but is not incompatible with our encoding, so don't give it a zero. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confidence = AST#expression#Left 10 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#statement#Left AST#break_statement#Left break detectBlock ; AST#break_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // // No match if there are too many characters that don't fit the encoding scheme. // (should we have zero tolerance for these?) // AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left doubleByteCharCount AST#expression#Right < AST#expression#Left AST#binary_expression#Left AST#expression#Left 20 AST#expression#Right * AST#expression#Left badCharCount 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confidence = AST#expression#Left 0 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 detectBlock ; AST#break_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 this AST#expression#Right . commonChars 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 { // We have no statistics on frequently occurring characters. // Assess confidence purely on having a reasonable number of // multi-byte characters (the more the better AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confidence = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 30 AST#expression#Right + AST#expression#Left doubleByteCharCount AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left 20 AST#expression#Right * AST#expression#Left badCharCount AST#expression#Right AST#binary_expression#Right 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left confidence AST#expression#Right > AST#expression#Left 100 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 confidence = AST#expression#Left 100 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 else AST#block_statement#Left { // Frequency of occurrence statistics exist. AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxVal = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math 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 doubleByteCharCount AST#expression#Right / AST#expression#Left 4 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 scaleFactor = AST#expression#Left AST#binary_expression#Left AST#expression#Left 90.0 AST#expression#Right / AST#expression#Left maxVal 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 confidence = 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math 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 commonCharCount AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left scaleFactor AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left 10 AST#expression#Right AST#binary_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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left confidence = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . min AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left confidence AST#expression#Right , AST#expression#Left 100 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
match(det: Context): Match | null {
let doubleByteCharCount = 0,
commonCharCount = 0,
badCharCount = 0,
totalCharCount = 0,
confidence = 0;
const iter = new IteratedChar();
detectBlock: {
for (iter.reset(); this.nextChar(iter, det); ) {
totalCharCount++;
if (iter.error) {
badCharCount++;
} else {
const cv = iter.charValue & 0xffffffff;
if (cv > 0xff) {
doubleByteCharCount++;
if (this.commonChars != null) {
if (binarySearch(this.commonChars, cv) >= 0) {
commonCharCount++;
}
}
}
}
if (badCharCount >= 2 && badCharCount * 5 >= doubleByteCharCount) {
break detectBlock;
}
}
if (doubleByteCharCount <= 10 && badCharCount == 0) {
if (doubleByteCharCount == 0 && totalCharCount < 10) {
confidence = 0;
} else {
confidence = 10;
}
break detectBlock;
}
No match if there are too many characters that don't fit the encoding scheme.
(should we have zero tolerance for these?)
if (doubleByteCharCount < 20 * badCharCount) {
confidence = 0;
break detectBlock;
}
if (this.commonChars == null) {
We have no statistics on frequently occurring characters.
Assess confidence purely on having a reasonable number of
multi-byte characters (the more the better
confidence = 30 + doubleByteCharCount - 20 * badCharCount;
if (confidence > 100) {
confidence = 100;
}
} else {
Frequency of occurrence statistics exist.
const maxVal = Math.log(doubleByteCharCount / 4);
const scaleFactor = 90.0 / maxVal;
confidence = Math.floor(
Math.log(commonCharCount + 1) * scaleFactor + 10
);
confidence = Math.min(confidence, 100);
}
}
|
https://github.com/ChangweiZhang/chardet-arkts.git/blob/3a214882ec6a2753c0fed84162952aa659341c19/src/main/ets/components/encoding/mbcs.ets#L99-L174
|
15bf1b170f3ef8d40fa0dbe25eff460dc41cf14e
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosAdapter.ets
|
arkts
|
Initialize axios object according to configuration and return the object.
|
export function getAxios(): Axios {
let instance: AxiosInstance = axios.create();
if (AxiosGlobalConfig.instance.baseURL) {
instance.defaults.url = AxiosGlobalConfig.instance.baseURL;
}
for (let entry of AxiosGlobalConfig.instance.headers.entries()) {
instance.defaults.headers[entry[0]] = entry[1];
}
if (AxiosGlobalConfig.instance.timeout) {
instance.defaults.timeout = AxiosGlobalConfig.instance.timeout;
}
if (AxiosGlobalConfig.instance.proxy) {
let config: AxiosProxyConfig = {
host: AxiosGlobalConfig.instance.proxy.host,
port: AxiosGlobalConfig.instance.proxy.port,
exclusionList: []
};
instance.defaults.proxy = config;
}
for (let interceptor of AxiosGlobalConfig.instance.requestInterceptors.values()) {
axios.interceptors.request.use((config: InternalAxiosRequestConfig<object>): InternalAxiosRequestConfig<object> |
Promise<InternalAxiosRequestConfig<object>> => interceptor.handle(config),
(error: object) => interceptor.handleError(error));
}
for (let interceptor of AxiosGlobalConfig.instance.responseInterceptors.values()) {
axios.interceptors.response.use((response: AxiosResponse<object, object>): AxiosResponse<object, object> |
Promise<AxiosResponse<object, object>> => interceptor.handle(response),
(error: object) => interceptor.handleError(error));
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getAxios AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Axios AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left instance : AST#type_annotation#Left AST#primary_type#Left AxiosInstance 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 axios AST#expression#Right . create 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . baseURL 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 instance AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . url AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . baseURL 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#if_statement#Right AST#statement#Right AST#ERROR#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left entry AST#ERROR#Left of 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#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right . entries 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left entry AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left entry AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#ERROR#Left } if AST#ERROR#Right AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#ERROR#Left { AST#ERROR#Right in AST#expression#Left stance AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . timeout AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#ERROR#Left } if AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . proxy AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left let AST#property_name#Right AST#ERROR#Left config AST#ERROR#Right : AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#assignment_expression#Left AxiosProxyConfig = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left host AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . proxy AST#member_expression#Right AST#expression#Right . host AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AxiosGlobalConfig AST#expression#Right . instance AST#member_expression#Right AST#expression#Right . proxy AST#member_expression#Right AST#expression#Right . port AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exclusionList AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ; AST#ERROR#Right in AST#expression#Left stance AST#expression#Right AST#binary_expression#Right AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . proxy AST#member_expression#Right = AST#expression#Left config AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#property_assignment#Right AST#ERROR#Left ; AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left for AST#ERROR#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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left let AST#expression#Right in AST#expression#Left terceptor AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left of AxiosGlobalConfig AST#ERROR#Right . instance AST#member_expression#Right AST#expression#Right . requestInterceptors AST#member_expression#Right AST#expression#Right . values 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#Left AST#call_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#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left axios AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . interceptors AST#member_expression#Right AST#expression#Right . request AST#member_expression#Right AST#expression#Right . use 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 config : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left InternalAxiosRequestConfig AST#type_arguments#Left < 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left InternalAxiosRequestConfig AST#type_arguments#Left < 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#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left InternalAxiosRequestConfig AST#type_arguments#Left < 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left interceptor AST#expression#Right . handle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left config AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left object 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 interceptor AST#expression#Right . handleError 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left ; } for AST#ERROR#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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left let AST#expression#Right in AST#expression#Left terceptor AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left of AxiosGlobalConfig AST#ERROR#Right . instance AST#member_expression#Right AST#expression#Right . responseInterceptors AST#member_expression#Right AST#expression#Right . values 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#ERROR#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#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left axios AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . interceptors AST#member_expression#Right AST#expression#Right . response AST#member_expression#Right AST#expression#Right . use 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 response : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left object 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left object 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#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left object 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left interceptor AST#expression#Right . handle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left response AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left object 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 interceptor AST#expression#Right . handleError 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#ERROR#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function getAxios(): Axios {
let instance: AxiosInstance = axios.create();
if (AxiosGlobalConfig.instance.baseURL) {
instance.defaults.url = AxiosGlobalConfig.instance.baseURL;
}
for (let entry of AxiosGlobalConfig.instance.headers.entries()) {
instance.defaults.headers[entry[0]] = entry[1];
}
if (AxiosGlobalConfig.instance.timeout) {
instance.defaults.timeout = AxiosGlobalConfig.instance.timeout;
}
if (AxiosGlobalConfig.instance.proxy) {
let config: AxiosProxyConfig = {
host: AxiosGlobalConfig.instance.proxy.host,
port: AxiosGlobalConfig.instance.proxy.port,
exclusionList: []
};
instance.defaults.proxy = config;
}
for (let interceptor of AxiosGlobalConfig.instance.requestInterceptors.values()) {
axios.interceptors.request.use((config: InternalAxiosRequestConfig<object>): InternalAxiosRequestConfig<object> |
Promise<InternalAxiosRequestConfig<object>> => interceptor.handle(config),
(error: object) => interceptor.handleError(error));
}
for (let interceptor of AxiosGlobalConfig.instance.responseInterceptors.values()) {
axios.interceptors.response.use((response: AxiosResponse<object, object>): AxiosResponse<object, object> |
Promise<AxiosResponse<object, object>> => interceptor.handle(response),
(error: object) => interceptor.handleError(error));
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample7/AxiosAdapter.ets#L21-L49
|
5bb2a0c2f38e43cc050a3a4538b8860c97349ab2
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets
|
arkts
|
画笔线宽
|
constructor() {
super();
// 设置画笔颜色
const pen_color: common2D.Color = {
alpha: 0xFF,
red: 0xFA,
green: 0x64,
blue: 0x00
};
this.pen.setColor(pen_color);
// 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑
this.pen.setAntiAlias(true);
// 开启画笔的抖动绘制效果。抖动绘制可以使得绘制出的颜色更加真实。
this.pen.setDither(true);
// 设置画笔绘制转角的样式为圆头
this.pen.setJoinStyle(drawing.JoinStyle.ROUND_JOIN);
// 设置画笔线帽的样式,即画笔在绘制线段时在线段头尾端点的样式为半圆弧
this.pen.setCapStyle(drawing.CapStyle.ROUND_CAP);
}
|
AST#constructor_declaration#Left constructor 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 super 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#variable_declaration#Left const AST#variable_declarator#Left pen_color : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common2D . Color 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 alpha AST#property_name#Right : AST#expression#Left 0xFF AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left red AST#property_name#Right : AST#expression#Left 0xFA AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left green AST#property_name#Right : AST#expression#Left 0x64 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left blue AST#property_name#Right : AST#expression#Left 0x00 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . pen AST#member_expression#Right AST#expression#Right . setColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pen_color 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 . pen AST#member_expression#Right AST#expression#Right . setAntiAlias 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#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 . pen AST#member_expression#Right AST#expression#Right . setDither 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#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 . pen AST#member_expression#Right AST#expression#Right . setJoinStyle 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 drawing AST#expression#Right . JoinStyle AST#member_expression#Right AST#expression#Right . ROUND_JOIN 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#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 . pen AST#member_expression#Right AST#expression#Right . setCapStyle 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 drawing AST#expression#Right . CapStyle AST#member_expression#Right AST#expression#Right . ROUND_CAP 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#constructor_declaration#Right
|
constructor() {
super();
const pen_color: common2D.Color = {
alpha: 0xFF,
red: 0xFA,
green: 0x64,
blue: 0x00
};
this.pen.setColor(pen_color);
this.pen.setAntiAlias(true);
this.pen.setDither(true);
this.pen.setJoinStyle(drawing.JoinStyle.ROUND_JOIN);
this.pen.setCapStyle(drawing.CapStyle.ROUND_CAP);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/eraser/src/main/ets/model/RenderNodeModel.ets#L29-L47
|
41b2090fb130d4ca68b2f53cb1f188bac3111442
|
gitee
|
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets
|
arkts
|
ConfirmDialog
|
Declare CustomDialog ConfirmDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare CustomDialog ConfirmDialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
@CustomDialog
export declare struct ConfirmDialog {
/**
* Sets the ConfirmDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
controller: CustomDialogController;
/**
* Sets the ConfirmDialog title.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog title.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
title: ResourceStr;
/**
* Sets the ConfirmDialog content.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog content.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
content?: ResourceStr;
/**
* Sets the ConfirmDialog checkbox tips.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog checkbox tips.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
checkTips?: ResourceStr;
/**
* Sets the ConfirmDialog checkbox state.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog checkbox state.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
@Prop
isChecked?: boolean;
/**
* Sets the ConfirmDialog primary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog primary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
primaryButton?: ButtonOptions;
/**
* Sets the ConfirmDialog secondary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the ConfirmDialog secondary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
secondaryButton?: ButtonOptions;
/**
* Custom Theme.
*
* @type { ?(Theme | CustomTheme) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
theme?: Theme | CustomTheme;
/**
* Sets the ConfirmDialog dark or light Mode.
*
* @type { ?ThemeColorMode }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
themeColorMode?: ThemeColorMode;
/**
* Sets the ConfirmDialog CheckBox Callback.
* @type { ?Callback<boolean> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
onCheckedChange?: Callback<boolean>;
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ConfirmDialog AST#component_body#Left { /**
* Sets the ConfirmDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog title.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog title.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog content.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog content.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left content ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog checkbox tips.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog checkbox tips.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left checkTips ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog checkbox state.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog checkbox state.
* @type { ?boolean }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right isChecked ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog primary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog primary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left primaryButton ? : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog secondary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the ConfirmDialog secondary button.
* @type { ?ButtonOptions }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left secondaryButton ? : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Custom Theme.
*
* @type { ?(Theme | CustomTheme) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left theme ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Theme AST#primary_type#Right | AST#primary_type#Left CustomTheme AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog dark or light Mode.
*
* @type { ?ThemeColorMode }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left themeColorMode ? : AST#type_annotation#Left AST#primary_type#Left ThemeColorMode AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the ConfirmDialog CheckBox Callback.
* @type { ?Callback<boolean> }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#property_declaration#Left onCheckedChange ? : 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#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@CustomDialog
export declare struct ConfirmDialog {
controller: CustomDialogController;
title: ResourceStr;
content?: ResourceStr;
checkTips?: ResourceStr;
@Prop
isChecked?: boolean;
primaryButton?: ButtonOptions;
secondaryButton?: ButtonOptions;
theme?: Theme | CustomTheme;
themeColorMode?: ThemeColorMode;
onCheckedChange?: Callback<boolean>;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L436-L565
|
19a51b747913693bbaed3905a7df777c05055da3
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets
|
arkts
|
startRecordingProcess
|
开始录制对应的流程
|
async startRecordingProcess(): Promise<void> {
if (this.avRecorder !== undefined) {
await this.avRecorder.release();
this.avRecorder = undefined;
}
// 1.创建录制实例
this.avRecorder = await media.createAVRecorder();
this.setAudioRecorderCallback();
// 2.获取录制文件fd赋予avConfig里的url;参考FilePicker文档
const context = getContext(this);
const path = context.filesDir;
const filepath = path + '/01.mp3';
const file = fs.openSync(filepath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
const fdNumber = file.fd;
this.avConfig.url = 'fd://' + fdNumber;
// 3.配置录制参数完成准备工作
await this.avRecorder.prepare(this.avConfig);
// 4.开始录制
await this.avRecorder.start();
// TODO:知识点:通过getAudioCapturerMaxAmplitude接口获取声音振幅大小。
this.time = setInterval(() => {
this.avRecorder!.getAudioCapturerMaxAmplitude((_: BusinessError, amplitude: number) => {
this.maxAmplitude = amplitude;
});
}, Const.COLUMN_HEIGHT);
}
|
AST#method_declaration#Left async startRecordingProcess 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#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 this AST#expression#Right . avRecorder AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_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 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 . avRecorder AST#member_expression#Right 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avRecorder AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 1.创建录制实例 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avRecorder AST#member_expression#Right = 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 media AST#expression#Right AST#await_expression#Right AST#expression#Right . createAVRecorder 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setAudioRecorderCallback 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 // 2.获取录制文件fd赋予avConfig里的url;参考FilePicker文档 AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left context = 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 AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left path = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . filesDir 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 const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left filepath = AST#expression#Left AST#binary_expression#Left AST#expression#Left path AST#expression#Right + AST#expression#Left '/01.mp3' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filepath 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 fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left fdNumber = AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . avConfig AST#member_expression#Right AST#expression#Right . url AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left 'fd://' AST#expression#Right + AST#expression#Left fdNumber AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 3.配置录制参数完成准备工作 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 . avRecorder AST#member_expression#Right AST#expression#Right . prepare 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 . avConfig AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 4.开始录制 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 . avRecorder AST#member_expression#Right AST#expression#Right . start 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 // TODO:知识点:通过getAudioCapturerMaxAmplitude接口获取声音振幅大小。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . time 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avRecorder AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . getAudioCapturerMaxAmplitude 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 _ : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left amplitude : 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 . maxAmplitude AST#member_expression#Right = AST#expression#Left amplitude 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 AST#member_expression#Left AST#expression#Left Const AST#expression#Right . COLUMN_HEIGHT 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#builder_function_body#Right AST#method_declaration#Right
|
async startRecordingProcess(): Promise<void> {
if (this.avRecorder !== undefined) {
await this.avRecorder.release();
this.avRecorder = undefined;
}
this.avRecorder = await media.createAVRecorder();
this.setAudioRecorderCallback();
const context = getContext(this);
const path = context.filesDir;
const filepath = path + '/01.mp3';
const file = fs.openSync(filepath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
const fdNumber = file.fd;
this.avConfig.url = 'fd://' + fdNumber;
await this.avRecorder.prepare(this.avConfig);
await this.avRecorder.start();
this.time = setInterval(() => {
this.avRecorder!.getAudioCapturerMaxAmplitude((_: BusinessError, amplitude: number) => {
this.maxAmplitude = amplitude;
});
}, Const.COLUMN_HEIGHT);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/AudioRecorder.ets#L54-L81
|
698820bc4ade47d4e21e8b0736eabc61d0a741e8
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/ar/ARCardService.ets
|
arkts
|
手势识别器接口
|
export interface GestureRecognizer {
name: string;
pattern: HandGesturePattern;
action: InteractionAction;
confidence: number;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface GestureRecognizer AST#object_type#Left { AST#type_member#Left name : 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 pattern : AST#type_annotation#Left AST#primary_type#Left HandGesturePattern AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left action : AST#type_annotation#Left AST#primary_type#Left InteractionAction AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left confidence : 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 GestureRecognizer {
name: string;
pattern: HandGesturePattern;
action: InteractionAction;
confidence: number;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L241-L246
|
848e6718bf3ee31d0b9b0c420ac6273b56da9665
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.