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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/SetAppFontSize/entry/src/main/ets/common/utils/Logger.ets | arkts | Common log for all features. | export class Logger {
private domain: number;
private prefix: string;
private format: string = `%{public}s, %{public}s`;
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: string[]) {
hilog.debug(this.domain, this.prefix, this.format, args);
}
info(... | AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private domain : 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 private pr... | export class Logger {
private domain: number;
private prefix: string;
private format: string = `%{public}s, %{public}s`;
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: string[]) {
hilog.debug(this.domain, this.prefix, this.format, args);
}
info(... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/common/utils/Logger.ets#L21-L54 | 763f868f74530a8f2e3b1e01aa547420c60f61c9 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/extension_actions.ets | arkts | Data
Reads the manifest of extension.
@param id The id of extension.
@returns The manifest object. | export function manifest_of_extension(path: string | undefined) {
if (!path) {
return undefined;
}
let manifest = sandbox_read_text_sync(`${path}/manifest.json`);
let m: object = JSON.parse(manifest);
console.log(`[extension_actions][manifest_of_extension] Read manifest.json! "name"=${m?.['name']}` + '\n'... | AST#export_declaration#Left export AST#function_declaration#Left function manifest_of_extension AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Rig... | export function manifest_of_extension(path: string | undefined) {
if (!path) {
return undefined;
}
let manifest = sandbox_read_text_sync(`${path}/manifest.json`);
let m: object = JSON.parse(manifest);
console.log(`[extension_actions][manifest_of_extension] Read manifest.json! "name"=${m?.['name']}` + '\n'... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L255-L263 | 26cb88716401be5984e02d7d2e3fa68204df28df | gitee | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | getFormattedDate | 格式化日期显示 | getFormattedDate(dateString: string): string {
if (!dateString) return '';
const date = new Date(dateString);
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
} | AST#method_declaration#Left getFormattedDate AST#parameter_list#Left ( AST#parameter#Left dateString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | getFormattedDate(dateString: string): string {
if (!dateString) return '';
const date = new Date(dateString);
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
} | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L244-L248 | 0e60130df52a41cc1df250a2585471a21d1c84ca | github |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/common/dialog/CommonDateDialog.ets | arkts | CommonDateDialog | Icon+Text自定义弹窗 | @CustomDialog
export struct CommonDateDialog {
controller?: CustomDialogController
@Link currentDate:string
@State config: DateTimePickerConfig = {
format: DateTimeFormat.Ymd,
start: '1900-01-01',
end: '2099-12-31',
selected: (this.currentDate=='')?DateUtil.getTodayStr('yyyy-MM-dd'):this.currentDa... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CommonDateDialog 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#pr... | @CustomDialog
export struct CommonDateDialog {
controller?: CustomDialogController
@Link currentDate:string
@State config: DateTimePickerConfig = {
format: DateTimeFormat.Ymd,
start: '1900-01-01',
end: '2099-12-31',
selected: (this.currentDate=='')?DateUtil.getTodayStr('yyyy-MM-dd'):this.currentDa... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/common/dialog/CommonDateDialog.ets#L13-L116 | 12b52ae552bc0315c932df5e9fc1a720b7292554 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/MessageUtil.ets | arkts | warn | 显示警告框
@param cfg | warn(cfg: MessageCfg) {
//设置成功弹框页面内容
let componentContent = new ComponentContent(cfg.context, wrapBuilder(warnView), cfg);
this.buildView(componentContent, cfg);
} | AST#method_declaration#Left warn AST#parameter_list#Left ( AST#parameter#Left cfg : AST#type_annotation#Left AST#primary_type#Left MessageCfg AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { //设置成功弹框页面内容 AST#statement#Left AST#variable_declaratio... | warn(cfg: MessageCfg) {
let componentContent = new ComponentContent(cfg.context, wrapBuilder(warnView), cfg);
this.buildView(componentContent, cfg);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L93-L97 | ce89327b6739bc09651ffd3518332bc32a210024 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets | arkts | deleteLastItem | Delete the last element | public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
} | AST#method_declaration#Left public deleteLastItem 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#ex... | public deleteLastItem(): void {
this.dataArray.splice(-1, 1);
this.notifyDataDelete(this.dataArray.length);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets#L124-L127 | 6990fcc76bd3cc2d2dd97ad963b623e10af36971 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | build | 构建命令数组 | public build(): string[] {
if (this.inputFiles.length === 0) {
throw new Error('At least one input is required');
}
if (this.outputPath === '') {
throw new Error('Output path is required');
}
const cmd: string[] = ['ffmpeg'];
// 硬解码
if (this.useHwDecode) {
cmd.push('-c:v'... | AST#method_declaration#Left public build 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#if_statement#Left if ( AST... | public build(): string[] {
if (this.inputFiles.length === 0) {
throw new Error('At least one input is required');
}
if (this.outputPath === '') {
throw new Error('Output path is required');
}
const cmd: string[] = ['ffmpeg'];
if (this.useHwDecode) {
cmd.push('-c:v', FFmp... | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L154-L235 | 369ab51d1d5c9d6f4a5fd788916d6d5a39792f83 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TempUtil.ets | arkts | C2K | 摄氏度转开尔文
@param c 摄氏度温度值
@returns 开尔文温度值 | static C2K(c: number): number {
return c + 273.15;
} | AST#method_declaration#Left static C2K AST#parameter_list#Left ( AST#parameter#Left c : 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... | static C2K(c: number): number {
return c + 273.15;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TempUtil.ets#L49-L51 | 16f4cec80d53a0a3ee322a6a7cf892b75ccfcaa5 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppDefines.ets | arkts | 本应用的 sqlite声音数据 根目录 ~/app_Database/CloudSoundDatas/ | export const dAppSoundFolderPath = AppConstants.dataBasePath + 'SoundDatas/'
/** 用户sqlite数据目录 ~/app_Database/MyDatas/ */ | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dAppSoundFolderPath = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . dataBasePath AST#member_expression#Right AST#exp... | export const dAppSoundFolderPath = AppConstants.dataBasePath + 'SoundDatas/' | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppDefines.ets#L16-L18 | ec39718b9476e9f00b86c93e65afe37fa2ec5629 | github | |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/pages/Index.ets | arkts | LoadingContent | ASF 发送指令时显示 阻止用户操作 | @Builder
LoadingContent() {
Stack() {
Column()
.width(StyleConstants.FULL_PERCENT)
.height(StyleConstants.FULL_PERCENT)
.backgroundColor($r("app.color.transparent"))
.blur(StyleConstants.BLUE_LEVEL)
.onClick(() => {}... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right LoadingContent 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 Stack ( ) AST#container_content_body#Left { AST#arkts_ui_el... | @Builder
LoadingContent() {
Stack() {
Column()
.width(StyleConstants.FULL_PERCENT)
.height(StyleConstants.FULL_PERCENT)
.backgroundColor($r("app.color.transparent"))
.blur(StyleConstants.BLUE_LEVEL)
.onClick(() => {}... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L276-L310 | 262b138977533896c623047686c08adee5c2470e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | createRdbStore | Create rdb store.
@param {context} Context
@return {rdbStore} return rdbStore RDB database | async createRdbStore(context: Context) {
let rdbStore = GlobalContext.getContext().getObject('rdbStore') as relationalStore.RdbStore;
if (this.isEmpty(rdbStore)) {
rdbStore = await relationalStore.getRdbStore(context, CommonConstants.STORE_CONFIG);
if (!this.isEmpty(rdbStore)) {
rdbStore.exe... | AST#method_declaration#Left async createRdbStore 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declar... | async createRdbStore(context: Context) {
let rdbStore = GlobalContext.getContext().getObject('rdbStore') as relationalStore.RdbStore;
if (this.isEmpty(rdbStore)) {
rdbStore = await relationalStore.getRdbStore(context, CommonConstants.STORE_CONFIG);
if (!this.isEmpty(rdbStore)) {
rdbStore.exe... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets#L37-L49 | 6c3e51c51df659dd3223aa7988a3a9bd9b1550ac | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | isResource | 判断是否是Resource类型 | static isResource(value: Any) {
if (value) {
const res = value as Resource;
return Helper.isNotNull(res?.id) && Helper.isNotNull(res?.bundleName) && Helper.isNotNull(res?.moduleName);
}
return false;
} | AST#method_declaration#Left static isResource AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any 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 ( A... | static isResource(value: Any) {
if (value) {
const res = value as Resource;
return Helper.isNotNull(res?.id) && Helper.isNotNull(res?.bundleName) && Helper.isNotNull(res?.moduleName);
}
return false;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L84-L90 | a4bfe4c8b656413accd67f73ea3a523f62dd27be | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets | arkts | aboutToDisappear | Call back when the NodeContainer corresponding to the controller is Disappear. | aboutToDisappear(): void {
console.log('aboutToDisappear')
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | aboutToDisappear(): void {
console.log('aboutToDisappear')
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/CreateNodeController.ets#L79-L81 | 3c61e474862acb469780279eaaad25db700fe2fd | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getDeviceCapability | 获取设备的DeviceCapability
@returns | static async getDeviceCapability(): Promise<resourceManager.DeviceCapability> {
return ResUtil.getResourceManager().getDeviceCapability();
} | AST#method_declaration#Left static async getDeviceCapability 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 resourceManager . DeviceCapabi... | static async getDeviceCapability(): Promise<resourceManager.DeviceCapability> {
return ResUtil.getResourceManager().getDeviceCapability();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L538-L540 | a95570777c557f46b4b3ac9019c99ab2c587e140 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | generateGreetingStream | 生成个性化祝福语(流式输出) | async generateGreetingStream(
params: GreetingGenerateParams,
onChunk: StreamCallback
): Promise<GreetingGenerationResult> {
const startTime = Date.now();
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Starting streaming greeting generation for ${params.contact.name}`);
... | AST#method_declaration#Left async generateGreetingStream AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GreetingGenerateParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onChunk : AST#type_annotation#Left AST#primary_ty... | async generateGreetingStream(
params: GreetingGenerateParams,
onChunk: StreamCallback
): Promise<GreetingGenerationResult> {
const startTime = Date.now();
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Starting streaming greeting generation for ${params.contact.name}`);
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L134-L182 | b281c806956441711ccd871c2be94961078f4e74 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | initialize | 初始化首选项存储
@param context 应用上下文 | async initialize(context: common.UIAbilityContext): Promise<void> {
try {
if (this.initialized) {
return;
}
this.dataPreferences = await preferences.getPreferences(context, StorageConstants.PREFERENCES_NAME);
this.initialized = true;
hilog.info(LogConstants.DOMAIN_APP, ... | AST#method_declaration#Left async initialize 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 : ... | async initialize(context: common.UIAbilityContext): Promise<void> {
try {
if (this.initialized) {
return;
}
this.dataPreferences = await preferences.getPreferences(context, StorageConstants.PREFERENCES_NAME);
this.initialized = true;
hilog.info(LogConstants.DOMAIN_APP, ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L33-L48 | 2226d983e9ed609875e05c91683318e2d971d56d | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | isNotBlank | 判断字符串是否为非空白符(空白符包括空格、制表符、全角空格和不间断空格)true为非空,否则false
@param str
@returns | static isNotBlank(str: string): boolean {
return false == StrUtil.isBlank(str);
} | AST#method_declaration#Left static isNotBlank 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#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | static isNotBlank(str: string): boolean {
return false == StrUtil.isBlank(str);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L64-L66 | 8cb55f94f9762bf4410ca3490f75a93352772680 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry2/src/main/ets/entry2ability/Entry2Ability.ets | arkts | onDestroy | [End web_module_open_bf_cache] | onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
} | AST#method_declaration#Left onDestroy 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#Lef... | onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L33-L35 | c009b6f9b1b92356865ead6594b6599d5330ef0b | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/constant/CommonConstants.ets | arkts | 通用常量类。 | export class CommonConstants {
/**
* 数据库首选项ID。
*/
static readonly PREFERENCE_ID = 'storageId';
/**
* 数据库闹钟数据键。
*/
static readonly ALARM_KEY = 'alarmData';
/**
* 数据库城市数据键。
*/
static readonly CITY_KEY = 'cityData';
/**
* 通用的全长字符串
*/
static readonly FULL_LENGTH: string = '100%';
... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* 数据库首选项ID。
*/ AST#property_declaration#Left static readonly PREFERENCE_ID = AST#expression#Left 'storageId' AST#expression#Right ; AST#property_declaration#Right /**
* 数据库闹钟数据键。
*/ AST#property_dec... | export class CommonConstants {
static readonly PREFERENCE_ID = 'storageId';
static readonly ALARM_KEY = 'alarmData';
static readonly CITY_KEY = 'cityData';
static readonly FULL_LENGTH: string = '100%';
static readonly DEFAULT_STRING_SPACE: string = ' ';
static readonly DEFAULT_STRING_COMM... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/constant/CommonConstants.ets#L4-L139 | c474bd4c48d5f9e168696ae041084904cf25f4cd | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/DialogUtil.ets | arkts | showDatePicker | 日期滑动选择器弹窗 (DatePickerDialog)
start 指定选择器的起始日期。 默认值:Date(‘1970-1-1’)
end 指定选择器的结束日期。 默认值:Date(‘2100-12-31’)
selected 设置选中项的日期。默认值:当前系统日期。从API version 10开始,该参数支持$$双向绑定变量
lunar 日期是否显示为农历,true表示显示农历,false表示不显示农历。默认值:false
showTime 是否展示时间项,true表示显示时间,false表示不显示时间。默认值:false
useMilitaryTime 展示时间是否为24小时制,true表示显示24小时制,false表示显... | static showDatePicker(options: DatePickerDialogOptions) {
DialogUtil.initPickerDialogDefault(options);
DatePickerDialog.show(options);
} | AST#method_declaration#Left static showDatePicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DatePickerDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_... | static showDatePicker(options: DatePickerDialogOptions) {
DialogUtil.initPickerDialogDefault(options);
DatePickerDialog.show(options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L156-L159 | f424a7eac5374cd19a88415c3690f2ecb9fb0363 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/media/MediaManager.ets | arkts | selectImageFromGallery | 从相册选择图片 | async selectImageFromGallery(): Promise<string> {
if (!this.photoAccessHelper) {
throw new Error('相册访问助手未初始化');
}
try {
const selectOptions: photoAccessHelper.PhotoSelectOptions = {
MIMEType: photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE,
maxSelectNumber: 1
};
con... | AST#method_declaration#Left async selectImageFromGallery 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 > ... | async selectImageFromGallery(): Promise<string> {
if (!this.photoAccessHelper) {
throw new Error('相册访问助手未初始化');
}
try {
const selectOptions: photoAccessHelper.PhotoSelectOptions = {
MIMEType: photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE,
maxSelectNumber: 1
};
con... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L149-L177 | 8e22ce7baf0e5b2f05b8e017404429f00c1ef2af | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets | arkts | CountDownInstallDialogBuilder | 倒计时弹框建造者
@since 2022-06-05 | @CustomDialog
export struct CountDownInstallDialogBuilder {
@StorageProp('configLanguage')
@Watch('onLanguageChange') private configLanguage: string = AppStorage.Get('configLanguage');
/**
* 控制器
*/
controller: CustomDialogController;
/**
* 文本显示内容
*/
textString: Resource | string;
/**
* 取... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CountDownInstallDialogBuilder AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'configLanguage' AST#expression#Right ) AST#decorator#Right AST#decorator... | @CustomDialog
export struct CountDownInstallDialogBuilder {
@StorageProp('configLanguage')
@Watch('onLanguageChange') private configLanguage: string = AppStorage.Get('configLanguage');
controller: CustomDialogController;
textString: Resource | string;
@State cancelBtnText: string = '';
@Stat... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/CountDownInstallDialogBuilder.ets#L24-L188 | 11788167297e594077ea11a6700c5dd41b0198f5 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/AgentService.ets | arkts | executeCreateSchedule | Execute create_schedule function
Creates a new task in the database
@param args - Function arguments
@returns Result message | private async executeCreateSchedule(args: CreateScheduleArgs): Promise<string> {
try {
const normalizedTitle = this.normalizeQuotes(args.title) ?? args.title;
console.info(`[AgentService] ========== 开始创建任务 ==========`);
console.info(`[AgentService] 任务标题: ${normalizedTitle}`);
console.info(`[... | AST#method_declaration#Left private async executeCreateSchedule AST#parameter_list#Left ( AST#parameter#Left args : AST#type_annotation#Left AST#primary_type#Left CreateScheduleArgs AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ... | private async executeCreateSchedule(args: CreateScheduleArgs): Promise<string> {
try {
const normalizedTitle = this.normalizeQuotes(args.title) ?? args.title;
console.info(`[AgentService] ========== 开始创建任务 ==========`);
console.info(`[AgentService] 任务标题: ${normalizedTitle}`);
console.info(`[... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L546-L586 | bdcf2b91c4d004e164b3856d2a5f8b36c61a3d12 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/pages/StartVpn.ets | arkts | 路由配置 构造函数,初始化 VPN 配置 | constructor(tunIp: string, blockedAppName: string) {
// 设置虚拟网卡的 IP 地址,这里使用一个 IPv4 地址和前缀长度 24(即 255.255.255.0)
this.addresses = [
new AddressWithPrefix(new Address(tunIp, 1), 24) // 这里的 `1` 是 IPv4 的地址族
];
this.mtu = 1400; // 设置最大传输单元(MTU),通常用于 VPN 隧道数据包的大小限制
this.dnsAd... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left tunIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left blockedAppName : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | constructor(tunIp: string, blockedAppName: string) {
this.addresses = [
new AddressWithPrefix(new Address(tunIp, 1), 24)
];
this.mtu = 1400;
this.dnsAddresses = ['114.114.114.114'];
this.trustedApplications = [];
this.blockedApplications = [bloc... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/pages/StartVpn.ets#L141-L169 | 59dd1912908919e60e974b4f43259e828e7fc309 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/component/InfoView.ets | arkts | InfoView | Copyright (c) 2022-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,... | @Component
export struct InfoView {
private infoList: Array<any> = []
build() {
Column() {
ForEach(this.infoList, (item, index) => {
Column() {
Text(item.key)
.fontColor(Color.Black)
.fontSize(20)
.width('100%')
Text(item.value)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InfoView AST#component_body#Left { AST#property_declaration#Left private infoList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#pri... | @Component
export struct InfoView {
private infoList: Array<any> = []
build() {
Column() {
ForEach(this.infoList, (item, index) => {
Column() {
Text(item.key)
.fontColor(Color.Black)
.fontSize(20)
.width('100%')
Text(item.value)
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Connectivity/Wlan/entry/src/main/ets/component/InfoView.ets#L16-L44 | d451091243a87ea6d4894e055be2363a6adaf819 | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets | arkts | getPreference | 使用Preferences的get方法读取数据 | async getPreference(key: string) {
let result: string= '';
if (this.dataPreferences === null) {
await this.getPreferencesFromStorage();
} else {
await this.dataPreferences.get(key, '').then((data) => {
result = data.toString();
console.info(`Succeeded in getting value`);
})... | AST#method_declaration#Left async getPreference AST#parameter_list#Left ( AST#parameter#Left key : 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#... | async getPreference(key: string) {
let result: string= '';
if (this.dataPreferences === null) {
await this.getPreferencesFromStorage();
} else {
await this.dataPreferences.get(key, '').then((data) => {
result = data.toString();
console.info(`Succeeded in getting value`);
})... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets#L42-L56 | d80500b0c972697dce7b9c0c7fe287575d5f3173 | gitee |
gouhaoshuang/arkts-booking-software.git | e0254dae0c4cfd3d43c4e3970528d97136fcc69b | demo_bookkeeping/entry/src/main/ets/viewmodel/AccountData.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, softw... | export default class AccountData {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0; //金额
day:number = 0;
month:number = 0;
year:number = 0;
date_string:string = '';
} | AST#export_declaration#Left export default AST#class_declaration#Left class AccountData AST#class_body#Left { AST#property_declaration#Left id : 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 ... | export default class AccountData {
id: number = -1;
accountType: number = 0;
typeText: string = '';
amount: number = 0;
day:number = 0;
month:number = 0;
year:number = 0;
date_string:string = '';
} | https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/viewmodel/AccountData.ets#L16-L25 | d98d814d62b3011a85690c479008906b9c2f1003 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSource.ets | arkts | @file 用户贡献者相关数据源接口
@author Joker.X | export interface UserContributorNetworkDataSource {
/**
* 分页查询用户贡献者
* @param params 分页请求参数
* @returns 用户贡献者分页数据响应
*/
getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserContributorNetworkDataSource AST#object_type#Left { /**
* 分页查询用户贡献者
* @param params 分页请求参数
* @returns 用户贡献者分页数据响应
*/ AST#type_member#Left getUserContributorPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_anno... | export interface UserContributorNetworkDataSource {
getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>>;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSource.ets#L7-L14 | 8c98852ae60fa3d55ac8836aef56044744ab9c42 | github | |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/globals/store.ets | arkts | clearMessage | Clear business | public async clearMessage() {
this.messages.clear()
} | AST#method_declaration#Left public async clearMessage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | public async clearMessage() {
this.messages.clear()
} | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/store.ets#L138-L140 | 6bb2e55564486afaa7118bbcae2fc9b612efad0b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets | arkts | parseResult | 解析网络监听结果,用于打印日志
@param data 网络监听结果
@returns 解析后的结果数据 | parseResult(data: emitter.EventData): string {
if (data.data) {
if (!data.data.eventName) {
logger.info('parseResult data.data.eventName is undefined.');
return '';
}
} else {
logger.info('parseResult data.data is undefined.');
return '';
}
let result = '';
le... | AST#method_declaration#Left parseResult AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left emitter . EventData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left :... | parseResult(data: emitter.EventData): string {
if (data.data) {
if (!data.data.eventName) {
logger.info('parseResult data.data.eventName is undefined.');
return '';
}
} else {
logger.info('parseResult data.data is undefined.');
return '';
}
let result = '';
le... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets#L352-L366 | 662c1309f623f247feeda311b231d627096722bc | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/view/play/PlayView.ets | arkts | PlayView | Video play view. | @Component
export struct PlayView {
private isShow: boolean = false;
// Change the video playing state according to the index and pageShow changes.
@Link @Watch("needPageShow") index: number;
@Link @Watch("needPageShow") pageShow: boolean;
private barPosition: number = 0;
@State item: VideoItem = new VideoI... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PlayView AST#component_body#Left { AST#property_declaration#Left private isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boole... | @Component
export struct PlayView {
private isShow: boolean = false;
@Link @Watch("needPageShow") index: number;
@Link @Watch("needPageShow") pageShow: boolean;
private barPosition: number = 0;
@State item: VideoItem = new VideoItem();
@State private playState: number = PlayState.STOP;
private videoCon... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/play/PlayView.ets#L26-L98 | 56adc7ba2ae9bf8f3aca4898d8b0569a115f5561 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/GlobalInfoApi.ets | arkts | updateData | Update globalInfo.
@param globalInfo
@param callback | updateData(globalInfo: GlobalInfo, callback: Function): void {
const valueBucket = generateBucket(globalInfo);
let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.update(valueBucket, predicates).then((result: n... | AST#method_declaration#Left updateData AST#parameter_list#Left ( AST#parameter#Left globalInfo : AST#type_annotation#Left AST#primary_type#Left GlobalInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#prim... | updateData(globalInfo: GlobalInfo, callback: Function): void {
const valueBucket = generateBucket(globalInfo);
let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : '');
predicates.equalTo('id', 0);
RdbUtils.update(valueBucket, predicates).then((result: n... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/GlobalInfoApi.ets#L44-L52 | a808aae789c2be5353c6c44bbe61e58760a6e79d | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/AppUtils.ets | arkts | getVersionCode | 获取应用版本号。 | static getVersionCode(): number {
return AppUtils.getBundleInfoSync().versionCode
} | AST#method_declaration#Left static getVersionCode 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_ex... | static getVersionCode(): number {
return AppUtils.getBundleInfoSync().versionCode
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L121-L123 | 73decd953396fdad04780548435e62815960c74c | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets | arkts | isQQAppInstalled | 检查QQ是否安装 | public isQQAppInstalled(): boolean {
try {
return this.iQQOpenApi?.isQQInstalled() ?? false;
} catch (error) {
DebugLog.e('Check QQ installation failed: ' + JSON.stringify(error));
return false;
}
} | AST#method_declaration#Left public isQQAppInstalled 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#try_statement#Left try AST#block_statement#Left { AST#state... | public isQQAppInstalled(): boolean {
try {
return this.iQQOpenApi?.isQQInstalled() ?? false;
} catch (error) {
DebugLog.e('Check QQ installation failed: ' + JSON.stringify(error));
return false;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets#L76-L83 | f331eaae9b60a16663569f8ebeb11553d919ad8a | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets | arkts | getCAContent | 加载CA文件内容 | getCAContent(): string {
let caContent = ""
try {
let buf = new ArrayBuffer(1024 * 4);
let file = fs.openSync(this.caFileUri, fs.OpenMode.READ_ONLY);
let readLen = fs.readSync(file.fd, buf, { offset: 0 });
caContent = buf2String(buf.slice(0, readLen))
fs.closeSync(file);
} catc... | AST#method_declaration#Left getCAContent 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 let AST#variable_declarator#Left caContent = ... | getCAContent(): string {
let caContent = ""
try {
let buf = new ArrayBuffer(1024 * 4);
let file = fs.openSync(this.caFileUri, fs.OpenMode.READ_ONLY);
let readLen = fs.readSync(file.fd, buf, { offset: 0 });
caContent = buf2String(buf.slice(0, readLen))
fs.closeSync(file);
} catc... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets#L210-L222 | 50d18be2af01dfff96f3759c1ac5ebb14b6e4229 | gitee |
langwudong/browser.git | f44fff759c50c162739c1585149018e6f0277471 | entry/src/main/ets/pages/Start.ets | arkts | aboutToAppear | 在页面构建完成后启动定时器 | aboutToAppear() {
// 默认 2 秒后跳转
setTimeout(() => {
router.replaceUrl({
url: "pages/Index"
}, router.RouterMode.Single, (err) => {
if (err) {
console.error(`跳转异常, 异常代码: ${err.code}, 异常信息: ${err.message}`);
}
});
}, 2000);
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 默认 2 秒后跳转 AST#ui_custom_component_statement#Left setTimeout ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { ... | aboutToAppear() {
setTimeout(() => {
router.replaceUrl({
url: "pages/Index"
}, router.RouterMode.Single, (err) => {
if (err) {
console.error(`跳转异常, 异常代码: ${err.code}, 异常信息: ${err.message}`);
}
});
}, 2000);
} | https://github.com/langwudong/browser.git/blob/f44fff759c50c162739c1585149018e6f0277471/entry/src/main/ets/pages/Start.ets#L7-L18 | f5dc5a21ec4b1d22ecd6b23f9862c8315e177952 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/TintImage.ets | arkts | getColorFilterMatrix | 根据归一化的 RGBA 值构建颜色滤镜矩阵
@param rgba 归一化的 RGBA 数组 [R, G, B, A],范围 0-1
@returns 4x5 的颜色变换矩阵 | private getColorFilterMatrix(rgba: number[]): number[] {
const r = rgba[0];
const g = rgba[1];
const b = rgba[2];
const a = rgba[3];
return [
r, 0, 0, 0, 0, // R 输出 = tint颜色的R * 1.0
0, g, 0, 0, 0, // G 输出 = tint颜色的G * 1.0
0, 0, b, 0, 0, // B 输出 = tint颜色的B * 1.0
0, 0, 0, a, ... | AST#method_declaration#Left private getColorFilterMatrix AST#parameter_list#Left ( AST#parameter#Left rgba : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot... | private getColorFilterMatrix(rgba: number[]): number[] {
const r = rgba[0];
const g = rgba[1];
const b = rgba[2];
const a = rgba[3];
return [
r, 0, 0, 0, 0,
0, g, 0, 0, 0,
0, 0, b, 0, 0,
0, 0, 0, a, 0
];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/TintImage.ets#L42-L55 | d5ee78899df71f06cccd5451e5ac836620b3f6a3 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/plan/plan.ets | arkts | nowDayTime | 获取当前是第几日 | function nowDayTime(inputDate: Date | string): string{
// 处理日期参数,统一转换为Date对象
const targetDate: Date = typeof inputDate === 'string' ? new Date(inputDate) : new Date(inputDate);
// 验证日期有效性
if (isNaN(targetDate.getTime())) {
throw new Error('Invalid date input: 请提供有效的日期格式');
}
// 获取当前日期是一周中的第几天(0表示周日,1表... | AST#function_declaration#Left function nowDayTime AST#parameter_list#Left ( AST#parameter#Left inputDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Rig... | function nowDayTime(inputDate: Date | string): string{
const targetDate: Date = typeof inputDate === 'string' ? new Date(inputDate) : new Date(inputDate);
if (isNaN(targetDate.getTime())) {
throw new Error('Invalid date input: 请提供有效的日期格式');
}
const day: number = targetDate.getDay();
const d... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/plan/plan.ets#L67-L93 | ede61fd31ef1ccbd31fc9954afd8268886b2d88d | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets | arkts | getMaximumEntryWidth | returns the maximum length in pixels across all legend labels + formsize
+ formtotextspace
@param p the paint object used for rendering the text
@return | public getMaximumEntryWidth(p: Paint): number {
var max: number = 0;
var maxFormSize: number = 0;
var formToTextSpace: number = Utils.convertDpToPixel(this.mFormToTextSpace);
for (let entry of this.mEntries) {
var formSize: number = Utils.convertDpToPixel(Number.isNaN(entry.formSize) ? this.mForm... | AST#method_declaration#Left public getMaximumEntryWidth AST#parameter_list#Left ( AST#parameter#Left p : AST#type_annotation#Left AST#primary_type#Left Paint 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#primar... | public getMaximumEntryWidth(p: Paint): number {
var max: number = 0;
var maxFormSize: number = 0;
var formToTextSpace: number = Utils.convertDpToPixel(this.mFormToTextSpace);
for (let entry of this.mEntries) {
var formSize: number = Utils.convertDpToPixel(Number.isNaN(entry.formSize) ? this.mForm... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets#L162-L186 | ac00980a248c11c0f75a81f716f8820f0c363c3b | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets | arkts | getShadowRange | Returns the overall range (difference) between shadow-high and
shadow-low.
@return | public getShadowRange(): number {
return Math.abs(this.mShadowHigh - this.mShadowLow);
} | AST#method_declaration#Left public getShadowRange 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#call_expr... | public getShadowRange(): number {
return Math.abs(this.mShadowHigh - this.mShadowLow);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets#L55-L57 | 5cf0fca272dd85b65c85a9db0abbd0623b82b7b9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/components/common/LoadingView.ets | arkts | LoadingView | 通用加载视图组件
提供统一的加载状态展示 | @Component
export struct LoadingView {
@Prop message: string = '加载中...';
@Prop size: number = 32;
@Prop textColor: string = '#666666';
@Prop backgroundColor: string = 'transparent';
@Prop showBackground: boolean = false;
build() {
Column({ space: 16 }) {
// 加载动画
LoadingProgress()
.w... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat... | @Component
export struct LoadingView {
@Prop message: string = '加载中...';
@Prop size: number = 32;
@Prop textColor: string = '#666666';
@Prop backgroundColor: string = 'transparent';
@Prop showBackground: boolean = false;
build() {
Column({ space: 16 }) {
LoadingProgress()
.width(th... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/components/common/LoadingView.ets#L6-L34 | b5147de1b59faa99d9b92450fa9e6f93735f529b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets | arkts | onWindowStageDestroy | [StartExclude save_uiContext_to_localstorage_in_entry_ability] | onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement... | onWindowStageDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry4/src/main/ets/entry4ability/Entry4Ability.ets#L48-L51 | bb1181ceb99028a283829720fa7b29c0f54795cd | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ObjectUtil.ets | arkts | setValue | 给对象obj动态添加或者修改属性
@param target 目标对象
@param key
@param value | static setValue<P extends PropertyKey>(target: Object, key: P, value: Object): boolean {
return Reflect.set(target, key, value);
} | AST#method_declaration#Left static setValue AST#type_parameters#Left < AST#type_parameter#Left P extends AST#type_annotation#Left AST#primary_type#Left PropertyKey AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left target : ... | static setValue<P extends PropertyKey>(target: Object, key: P, value: Object): boolean {
return Reflect.set(target, key, value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L163-L165 | 7b1d0f84679e0e95d54cb73bb79f129bf738bd9a | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | style | 弹窗样式
@param style
@returns | style(style: S) {
if (this.builderOptions.style) {
ObjectUtil.assign(this.builderOptions.style, style)
} else {
this.builderOptions.style = style;
}
return this;
} | AST#method_declaration#Left style AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left S AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( ... | style(style: S) {
if (this.builderOptions.style) {
ObjectUtil.assign(this.builderOptions.style, style)
} else {
this.builderOptions.style = style;
}
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L75-L82 | 3d237583c06201d6eb985758d6f35bb5de7c5b34 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/ChatTools.ets | arkts | showAlertDialog | 显示对话框.
@param message 文本显示内容
@param primaryButtonText 主按钮文本
@param primaryButtonTextColor 主按钮文本颜色
@param primaryAction 主按钮Action
@param secondaryButtonText 次按钮文本
@param secondaryButtonTextColor 次按钮文本颜色
@param secondaryAction 次按钮Action | static showAlertDialog(message: ResourceStr
, primaryButtonText: string, primaryButtonTextColor: ResourceColor | undefined, primaryAction: Callback<void>
, secondaryButtonText: string, secondaryButtonTextColor: ResourceColor | undefined, secondaryAction: Callback<void>) {
AlertDialog.show(
{
m... | AST#method_declaration#Left static showAlertDialog AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left primaryButtonText : AST#type_annotation#Left AST#primary_type#Lef... | static showAlertDialog(message: ResourceStr
, primaryButtonText: string, primaryButtonTextColor: ResourceColor | undefined, primaryAction: Callback<void>
, secondaryButtonText: string, secondaryButtonTextColor: ResourceColor | undefined, secondaryAction: Callback<void>) {
AlertDialog.show(
{
m... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L116-L137 | e96c6f1a5990a0cdc6b272ed62410309e800e44a | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/model/LaunchMode.ets | arkts | @author: HZWei
@date: 2025/1/2
@desc: 为了兼容在api11的使用
Defines the mode of stack operation.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export enum LaunchMode {
/**
* The default mode of stack operation.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
STANDARD = 0,
/**
* When the NavDestination with a specified name exists, it will be moved to top of stack,
* otherwise, the... | AST#export_declaration#Left export AST#enum_declaration#Left enum LaunchMode AST#enum_body#Left { /**
* The default mode of stack operation.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#enum_member#Left STANDARD = AST#expression#Left 0 AST#expre... | export enum LaunchMode {
STANDARD = 0,
MOVE_TO_TOP_SINGLETON = 1,
POP_TO_SINGLETON = 2,
NEW_INSTANCE = 3
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/model/LaunchMode.ets#L16-L55 | 0543d828a57c16497d7d147e7ac0aea5d8595609 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderConfirmPage.ets | arkts | BottomBar | 底部操作栏
@returns {void} 无返回值 | @Builder
private BottomBar() {
Column() {
RowSpaceBetweenCenter({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
top: $r("app.float.space_vertical_medium"),
bottom: this.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private BottomBar 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 Column ( ) AST#container_content_body#Left { AST#arkts_u... | @Builder
private BottomBar() {
Column() {
RowSpaceBetweenCenter({
widthValue: P100,
paddingValue: {
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium"),
top: $r("app.float.space_vertical_medium"),
bottom: this.... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L274-L326 | f98aa9a45a0bba13a4d49c056b996f0e0867529a | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets | arkts | constructor. | constructor(noteId: string, title: string, folder: FolderType, time: string, isFavorite: boolean, imageArr: string[],
content: string) {
this.noteId = noteId;
this.title = title;
this.folder = folder;
this.time = time;
this.isFavorite = isFavorite;
this.imageArr = imageArr;
thi... | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left noteId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ... | constructor(noteId: string, title: string, folder: FolderType, time: string, isFavorite: boolean, imageArr: string[],
content: string) {
this.noteId = noteId;
this.title = title;
this.folder = folder;
this.time = time;
this.isFavorite = isFavorite;
this.imageArr = imageArr;
thi... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets#L75-L84 | f9ea657098faf473b187a0feab7b69d1c61057f0 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/TimedReminderService.ets | arkts | createBirthdayReminder | 创建生日提醒 | public async createBirthdayReminder(contact: Contact, triggerTime: Date): Promise<boolean> {
try {
const config: ReminderConfig = {
id: `birthday_${contact.id}_${triggerTime.getTime()}`,
type: ReminderType.BIRTHDAY_TODAY,
title: '🎂 生日提醒',
content: `今天是${contact.name}的生日,记得送上祝福... | AST#method_declaration#Left public async createBirthdayReminder AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left triggerTime : AST#type_annotation#Left AST#primary_type#... | public async createBirthdayReminder(contact: Contact, triggerTime: Date): Promise<boolean> {
try {
const config: ReminderConfig = {
id: `birthday_${contact.id}_${triggerTime.getTime()}`,
type: ReminderType.BIRTHDAY_TODAY,
title: '🎂 生日提醒',
content: `今天是${contact.name}的生日,记得送上祝福... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L52-L70 | 536dcd340aeed66d79bec1eb3fbbef1f54b2d483 | github |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/SettingsStorage.ets | arkts | 批量更新设置 | export async function updateSettings(settings: Partial<AppSettings>): Promise<void> {
if (settings.defaultSiteT !== undefined) {
await setDefaultSite(settings.defaultSiteT);
}
if (settings.vibrationON !== undefined) {
await setVibrationEnabled(settings.vibrationON);
}
if (settings.ho... | AST#export_declaration#Left export AST#function_declaration#Left async function updateSettings AST#parameter_list#Left ( AST#parameter#Left settings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AppSettings AST#pri... | export async function updateSettings(settings: Partial<AppSettings>): Promise<void> {
if (settings.defaultSiteT !== undefined) {
await setDefaultSite(settings.defaultSiteT);
}
if (settings.vibrationON !== undefined) {
await setVibrationEnabled(settings.vibrationON);
}
if (settings.ho... | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L125-L141 | 93a1e536a7605ed7a2326411ffdc2aa76070e102 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | shouldLoadAddress | 是否需要请求地址详情
@returns {boolean} 是否请求 | private shouldLoadAddress(): boolean {
return this.isEditMode && this.addressId > 0;
} | AST#method_declaration#Left private shouldLoadAddress 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#bina... | private shouldLoadAddress(): boolean {
return this.isEditMode && this.addressId > 0;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L295-L297 | 49e80766958b135a1444b644044b053aeb455766 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets | arkts | delGroupById | 删除分组 | async delGroupById(id:number|number[]){
let Ids = toolsUtils.numberArrays(id)
if (Ids.length === 0) return
//删除分组
BookGroupsDao.deleteBook(Ids)
//同时更新书籍分组为未分组
BooksDao.queryBookByGroup(Ids, 3)
} | AST#method_declaration#Left async delGroupById AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#ty... | async delGroupById(id:number|number[]){
let Ids = toolsUtils.numberArrays(id)
if (Ids.length === 0) return
BookGroupsDao.deleteBook(Ids)
BooksDao.queryBookByGroup(Ids, 3)
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L34-L41 | 05469b33b64fd5418f9a4c13aa53fa312b7dcb41 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NdkDrawing/entry/src/main/ets/pages/Index.ets | arkts | resetType | Set the drawing type | resetType(type: DrawType): void {
this.drawType = type;
} | AST#method_declaration#Left resetType AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DrawType 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 A... | resetType(type: DrawType): void {
this.drawType = type;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/pages/Index.ets#L49-L51 | 5731d680b47b1c599360f71caa04b4bddc4b04e1 | gitee |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets | arkts | showProgressLoadingText | / 下载中 - 圆环进度条 | public static showProgressLoadingText(progress: number, loadingText = '正在下载...') {
JhProgressHUD._showProgress(progress, loadingText)
} | AST#method_declaration#Left public static showProgressLoadingText 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#Left loadingText = AST#expression#Left '正在下载...' AST#expres... | public static showProgressLoadingText(progress: number, loadingText = '正在下载...') {
JhProgressHUD._showProgress(progress, loadingText)
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L79-L81 | 502c9842927cdb2a1fe37d5b97cd96db83318903 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/CartBottomBar.ets | arkts | CartBottomBar | @file 购物车底部操作栏组件
@author Joker.X | @ComponentV2
export struct CartBottomBar {
/**
* 是否全选
*/
@Param
isAllSelected: boolean = false;
/**
* 是否处于编辑模式
*/
@Param
isEditing: boolean = false;
/**
* 已选商品数量
*/
@Param
selectedCount: number = 0;
/**
* 已选商品总金额(单位:分)
*/
@Param
totalAmount: number = 0;
/**
* 全选状态变更回... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CartBottomBar AST#component_body#Left { /**
* 是否全选
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right isAllSelected : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri... | @ComponentV2
export struct CartBottomBar {
@Param
isAllSelected: boolean = false;
@Param
isEditing: boolean = false;
@Param
selectedCount: number = 0;
@Param
totalAmount: number = 0;
@Param
onToggleSelectAll: () => void = () => {
};
@Param
onDeleteClick: () => void = () => {
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/CartBottomBar.ets#L11-L149 | 41520554be1ac290ac722a98b59390c58994fc6e | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/feedback/src/main/ets/view/FeedbackListPage.ets | arkts | FeedbackListPage | @file 反馈列表页面视图
@author Joker.X | @ComponentV2
export struct FeedbackListPage {
/**
* 反馈列表页面 ViewModel
*/
@Local
private vm: FeedbackListViewModel = new FeedbackListViewModel();
/**
* 构建反馈列表页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: "反馈列表",
viewModel: this.vm
}) {
this.FeedbackL... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct FeedbackListPage AST#component_body#Left { /**
* 反馈列表页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Fee... | @ComponentV2
export struct FeedbackListPage {
@Local
private vm: FeedbackListViewModel = new FeedbackListViewModel();
build() {
AppNavDestination({
title: "反馈列表",
viewModel: this.vm
}) {
this.FeedbackListContent();
}
}
@Builder
private FeedbackListContent() {
Tex... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/feedback/src/main/ets/view/FeedbackListPage.ets#L8-L37 | a099f6e9835e90d2ab1a6ea3762339b03f27b42c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageloading/src/main/ets/view/LoadingHUD.ets | arkts | LoadingHUD | HUD全称Heads-Up Display(抬头显示) | @Component
export struct LoadingHUD {
@Link nowProgress: number;
private politeChickyController: CanvasRenderingContext2D =
new CanvasRenderingContext2D(); // CanvasRenderingContext2D对象
private politeChicky: string = 'pageLoading'; // 动画名称
private politeChickyPath: string = 'common/lottie/pageLoading.json';... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingHUD AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right nowProgress : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_anno... | @Component
export struct LoadingHUD {
@Link nowProgress: number;
private politeChickyController: CanvasRenderingContext2D =
new CanvasRenderingContext2D();
private politeChicky: string = 'pageLoading';
private politeChickyPath: string = 'common/lottie/pageLoading.json';
private gradientColor: LinearGra... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageloading/src/main/ets/view/LoadingHUD.ets#L21-L45 | e120033580341c5b2c145d37c0d6229b6f674b17 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets | arkts | getDate | 月日 | getDate() {
const DATETIME = new Date()
return this.concatDate(DATETIME.getMonth() + 1, DATETIME.getDate())
} | AST#method_declaration#Left getDate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left DATETIME = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#L... | getDate() {
const DATETIME = new Date()
return this.concatDate(DATETIME.getMonth() + 1, DATETIME.getDate())
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L32-L35 | 4f9e68a4d20b116ca9f21f94acf3eac36b36f80c | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets | arkts | resetAxisMinimum | By calling this method, any custom minimum value that has been previously set is reseted,
and the calculation is
done automatically. | public resetAxisMinimum(): void {
this.mCustomAxisMin = false;
} | AST#method_declaration#Left public resetAxisMinimum 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#assignment_expression#Lef... | public resetAxisMinimum(): void {
this.mCustomAxisMin = false;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L688-L690 | 6b0c63d0452d42d0bee937f4d6798028148b41b4 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/Preferences/entry/src/main/ets/viewmodel/Fruit.ets | arkts | Fruit data.
@param fruitName Fruit name.
@param fruitNum Fruit num. | export default class Fruit {
/**
* Fruit name.
*/
fruitName: string = '';
/**
* Fruit num.
*/
fruitNum: string = '';
} | AST#export_declaration#Left export default AST#class_declaration#Left class Fruit AST#class_body#Left { /**
* Fruit name.
*/ AST#property_declaration#Left fruitName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#... | export default class Fruit {
fruitName: string = '';
fruitNum: string = '';
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/viewmodel/Fruit.ets#L22-L32 | 2ef7bb12afbf0b27743d067f0687a777727f03a8 | gitee | |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/FlawService.ets | arkts | addFlaw | 新增故障
@param flaw 故障数据
@returns 创建结果 | static async addFlaw(flaw: Partial<AgvFlaw>): Promise<ApiResponse<AgvFlaw>> {
try {
console.info('[FlawService] 📝 创建新故障:', flaw.flawName);
const response = await HttpUtil.post('/agv/flaw', flaw);
const createdFlaw = response.data as AgvFlaw;
console.info('[FlawService] ✅ 故障创建成功,ID:', create... | AST#method_declaration#Left static async addFlaw AST#parameter_list#Left ( AST#parameter#Left flaw : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AgvFlaw AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | static async addFlaw(flaw: Partial<AgvFlaw>): Promise<ApiResponse<AgvFlaw>> {
try {
console.info('[FlawService] 📝 创建新故障:', flaw.flawName);
const response = await HttpUtil.post('/agv/flaw', flaw);
const createdFlaw = response.data as AgvFlaw;
console.info('[FlawService] ✅ 故障创建成功,ID:', create... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L114-L130 | d41f46fa8816d125657a281dac00bea9a92eb1d7 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/im/IMManager.ets | arkts | getConversations | 获取会话列表 | getConversations(): Conversation[] {
return [...this.conversations];
} | AST#method_declaration#Left getConversations AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Conversation [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement... | getConversations(): Conversation[] {
return [...this.conversations];
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L72-L74 | 8329048ff23cbe5c911bfddf24aab4cfbba41ddb | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getDeviceTypeStr | 获取当前设备类型
@returns | static getDeviceTypeStr(): string {
let deviceType = DeviceUtil.getDeviceType();
switch (deviceType) {
case resourceManager.DeviceType.DEVICE_TYPE_PHONE:
return "手机";
case resourceManager.DeviceType.DEVICE_TYPE_TABLET:
return "平板";
case resourceManager.DeviceType.DEVICE_TYPE_PC... | AST#method_declaration#Left static getDeviceTypeStr 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#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variable_de... | static getDeviceTypeStr(): string {
let deviceType = DeviceUtil.getDeviceType();
switch (deviceType) {
case resourceManager.DeviceType.DEVICE_TYPE_PHONE:
return "手机";
case resourceManager.DeviceType.DEVICE_TYPE_TABLET:
return "平板";
case resourceManager.DeviceType.DEVICE_TYPE_PC... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L263-L282 | d4b0b9cd87b8f773d1cbc9f229ed66cf45a24b58 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/CameraService.ets | arkts | generateRefreshStreamUrl | 生成带时间戳的视频流URL(用于刷新)
@param cameraId 摄像头ID
@returns string 带时间戳的视频流URL | static generateRefreshStreamUrl(cameraId: string): string {
const timestamp = Date.now();
const refreshUrl = `${CameraService.generateStreamUrl(cameraId)}?t=${timestamp}`;
const logInfo: RefreshLogInfo = {
cameraId: cameraId,
timestamp: timestamp,
refreshUrl: refreshUrl
};
console.... | AST#method_declaration#Left static generateRefreshStreamUrl AST#parameter_list#Left ( AST#parameter#Left cameraId : 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 strin... | static generateRefreshStreamUrl(cameraId: string): string {
const timestamp = Date.now();
const refreshUrl = `${CameraService.generateStreamUrl(cameraId)}?t=${timestamp}`;
const logInfo: RefreshLogInfo = {
cameraId: cameraId,
timestamp: timestamp,
refreshUrl: refreshUrl
};
console.... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L201-L211 | 81a5d6300c1a5fb5cba92a4f17c585617e954e4c | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/wifi/WifiInfo/entry/src/main/ets/pages/Index.ets | arkts | showLinkedInfo | 显示和设备相关信息 | showLinkedInfo() {
wifiManager.getLinkedInfo()
.then((linkedInfo) => {
let len =linkedInfo.ssid.length
let ssid = linkedInfo.ssid.substring(1,len-1)
this.msgHistory += `SSID: ${ssid}\r\n`;
this.msgHistory += `信号强度: ${linkedInfo.rssi}\r\n`;
this.msgHistory += `网络频段: ${li... | AST#method_declaration#Left showLinkedInfo 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#... | showLinkedInfo() {
wifiManager.getLinkedInfo()
.then((linkedInfo) => {
let len =linkedInfo.ssid.length
let ssid = linkedInfo.ssid.substring(1,len-1)
this.msgHistory += `SSID: ${ssid}\r\n`;
this.msgHistory += `信号强度: ${linkedInfo.rssi}\r\n`;
this.msgHistory += `网络频段: ${li... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/wifi/WifiInfo/entry/src/main/ets/pages/Index.ets#L88-L101 | 61a27874f68989e3e0d3f501675b186ede4cc384 | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | time_bar/src/main/ets/components/viewModel/RecordSegment.ets | arkts | Video recording clip information for rendering on the time bar. | export class RecordSegment {
private _beginTime: string = '';
/** Start time in ISO 8601. */
public set beginTime(value: string) {
this._beginTime = value;
}
public get beginTime(): string {
return this._beginTime;
}
/** End time in ISO 8601. */
private _endTime: string = '';
public set en... | AST#export_declaration#Left export AST#class_declaration#Left class RecordSegment AST#class_body#Left { AST#property_declaration#Left private _beginTime : 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_d... | export class RecordSegment {
private _beginTime: string = '';
public set beginTime(value: string) {
this._beginTime = value;
}
public get beginTime(): string {
return this._beginTime;
}
private _endTime: string = '';
public set endTime(value: string) {
this._endTime = value;
}
p... | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/time_bar/src/main/ets/components/viewModel/RecordSegment.ets#L19-L41 | 26533a822f2fced4149f6fb6f9f6e118eb56da32 | gitee | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getFormatDateStr | 获取格式化日期,将传入的日期格式化为指定格式的字符串
@param date number类型的时间戳10-13位数据
@param format 格式化字符串,(yyyy-MM-dd HH:mm:ss)
@returns | static getFormatDateStr(date: number | string | Date, format?: string): string {
date = DateUtils.getFormatDate(date)
if (format === undefined || format.length <= 0) {
format = DATE_FORMAT1; //yyyy-MM-dd HH:mm:ss
}
const year = date.getFullYear(); //年份,例如 2024
const month = DateUtils.padZero(d... | AST#method_declaration#Left static getFormatDateStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_typ... | static getFormatDateStr(date: number | string | Date, format?: string): string {
date = DateUtils.getFormatDate(date)
if (format === undefined || format.length <= 0) {
format = DATE_FORMAT1;
}
const year = date.getFullYear();
const month = DateUtils.padZero(date.getMonth() + 1);
const d... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L70-L89 | d9d66ed68ef5533ec3d9790db9b17b0b8d1fad06 | gitee |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/model/CommandEntryList.ets | arkts | deleteCommandEntry | 删除成功返回删除 entry 对应的所有 formID 只有删除失败返回布尔值 | async deleteCommandEntry(commandEntry: CommandEntry): Promise<boolean | string[]> {
try {
const result = await this.db.deleteCommandEntryByID(commandEntry);
Logger.debug(this.LOG_TAG, `命令删除成功, ${result}`);
// 删除所有对应 ID 的卡片
const removedFormIDs = await this.remove... | AST#method_declaration#Left async deleteCommandEntry AST#parameter_list#Left ( AST#parameter#Left commandEntry : AST#type_annotation#Left AST#primary_type#Left CommandEntry AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS... | async deleteCommandEntry(commandEntry: CommandEntry): Promise<boolean | string[]> {
try {
const result = await this.db.deleteCommandEntryByID(commandEntry);
Logger.debug(this.LOG_TAG, `命令删除成功, ${result}`);
const removedFormIDs = await this.removeAllFormBelongsTo... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/model/CommandEntryList.ets#L72-L85 | 7a848fffdfdbf6af60dfdb529dad840092ecfea3 | github |
1lck/MindFlow.git | f05fab0891716cb852946ac02ed08dd2c0b9155a | front/entry/src/main/ets/pages/mine/MyData.ets | arkts | 分钟 | constructor(date: string, focusTime: number) {
this.date = date;
this.focusTime = focusTime;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left focusTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | constructor(date: string, focusTime: number) {
this.date = date;
this.focusTime = focusTime;
} | https://github.com/1lck/MindFlow.git/blob/f05fab0891716cb852946ac02ed08dd2c0b9155a/front/entry/src/main/ets/pages/mine/MyData.ets#L12-L15 | e0e98c118bd6a0ad75bb5e15607e721f62992ce5 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NetworkDemoPage.ets | arkts | 构建 Network Demo 示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_base_network_title"),
viewModel: this.vm
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.NetworkDemoContent()
});
}
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_bas... | build() {
AppNavDestination({
title: $r("app.string.demo_base_network_title"),
viewModel: this.vm
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.NetworkDemoContent()
});
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkDemoPage.ets#L21-L32 | f505d75f09cc205a0ce25078c075e4b276a1b9a1 | github | |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | getCookie | 获取当前用户的cookie
@returns | getCookie(): string | null {
return this.cookie;
} | AST#method_declaration#Left getCookie 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 null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#... | getCookie(): string | null {
return this.cookie;
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L62-L64 | 9b4de661e2e153d307b5444e2d0a89d1d26905be | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppColdStart/library/IndexAppStart.ets | arkts | MainPage | [Start export_main_page] library/IndexAppStart.ets | export { MainPage } from './src/main/ets/components/mainpage/MainPage'; | AST#export_declaration#Left export { MainPage } from './src/main/ets/components/mainpage/MainPage' ; AST#export_declaration#Right | export { MainPage } from './src/main/ets/components/mainpage/MainPage'; | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/library/IndexAppStart.ets#L3-L3 | 7ba033cab8d16f2bde44431dbbe08b74385f244a | gitee |
jiwangyihao/FlameChase.git | 446275e6972bd5f92a3c5b7eba354ca83d504594 | entry/src/main/ets/utils/Bezier.ets | arkts | 创建一个贝塞尔曲线缓动函数
@param p1x 控制点 P1 的 x 坐标
@param p1y 控制点 P1 的 y 坐标
@param p2x 控制点 P2 的 x 坐标
@param p2y 控制点 P2 的 y 坐标
@returns 一个函数,接收一个 number (0-1),返回计算后的 number (0-1) | export function createCubicBezier(p1x: number, p1y: number, p2x: number, p2y: number): (x: number) => number {
// 如果是线性曲线,直接返回 x,进行优化
if (p1x === p1y && p2x === p2y) {
return (x: number): number => x;
}
// 预计算样本值,用于快速估算 t
const sampleValues = new Float32Array(kSplineTableSize);
for (let i = 0; i < kSpl... | AST#export_declaration#Left export AST#function_declaration#Left function createCubicBezier AST#parameter_list#Left ( AST#parameter#Left p1x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p1y : AST#type_annotation#Left AS... | export function createCubicBezier(p1x: number, p1y: number, p2x: number, p2y: number): (x: number) => number {
if (p1x === p1y && p2x === p2y) {
return (x: number): number => x;
}
const sampleValues = new Float32Array(kSplineTableSize);
for (let i = 0; i < kSplineTableSize; ++i) {
sampleValues[i]... | https://github.com/jiwangyihao/FlameChase.git/blob/446275e6972bd5f92a3c5b7eba354ca83d504594/entry/src/main/ets/utils/Bezier.ets#L81-L126 | a486c330acfa7dbf90aa84006072b92dc958dd56 | github | |
texiwustion/chinese-herbal-shopping--arkts.git | 3f71338f3c6d88bc74342e0322867f3a0c2c17d1 | entry/src/main/ets/database/HerbalTable.ets | arkts | private static instance: HerbalTable = null | constructor(callback: Function = () => {}) {
this.herbalTable.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#expressi... | constructor(callback: Function = () => {}) {
this.herbalTable.getRdbStore(callback);
} | https://github.com/texiwustion/chinese-herbal-shopping--arkts.git/blob/3f71338f3c6d88bc74342e0322867f3a0c2c17d1/entry/src/main/ets/database/HerbalTable.ets#L10-L12 | f062ef068408389da2b7bd1a035b7aed0f9bdb44 | github | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets | arkts | pickLocalAvatar | 选择本地图片作为头像 | async pickLocalAvatar() {
try {
// 注意:以下API已经被标记为废弃,在未来版本中可能被移除
// 目前仍需使用这些API,但需要添加权限: ohos.permission.READ_IMAGEVIDEO
let photoSelectOptions: picker.PhotoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOp... | AST#method_declaration#Left async pickLocalAvatar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 注意:以下API已经被标记为废弃,在未来版本中可能被移除 // 目前仍需使用这些API,但需要添加权限: ohos.permission.READ_IMAGEVIDEO AST#statement#Left AST#variab... | async pickLocalAvatar() {
try {
let photoSelectOptions: picker.PhotoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoPicker: picker.PhotoViewPicker = new ... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L188-L211 | 33037981790a8e889565321f52afd10063951ff0 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | getYMin | Returns the minimum y-value for the specified axis.
@param axis
@return | public getYMin(axis?: AxisDependency): number {
if (axis == null) {
return this.mYMin;
}
if (axis == AxisDependency.LEFT) {
if (this.mLeftAxisMin == Number.MAX_VALUE) {
return this.mRightAxisMin;
} else {
return this.mLeftAxisMi... | AST#method_declaration#Left public getYMin AST#parameter_list#Left ( AST#parameter#Left axis ? : AST#type_annotation#Left AST#primary_type#Left AxisDependency 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#prima... | public getYMin(axis?: AxisDependency): number {
if (axis == null) {
return this.mYMin;
}
if (axis == AxisDependency.LEFT) {
if (this.mLeftAxisMin == Number.MAX_VALUE) {
return this.mRightAxisMin;
} else {
return this.mLeftAxisMi... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L203-L220 | 3cfa41b0df440ca7684f96b996dbccf609658bd9 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CacheUtil.ets | arkts | TODO 缓存工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class CacheUtil {
private static cache: Record<string, Object> = {}; //私有缓存对象
/**
* 获取缓存中的数据
* @param key 存入的key
* @returns
*/
static get<T>(key: string): T {
return CacheUtil.cache[key] as T;
}
/**
* 将数据存入缓存中
* @param key 存入key
* @param value 存入数据
*/
static put<T>(key... | AST#export_declaration#Left export AST#class_declaration#Left class CacheUtil AST#class_body#Left { AST#property_declaration#Left private static cache : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary... | export class CacheUtil {
private static cache: Record<string, Object> = {};
static get<T>(key: string): T {
return CacheUtil.cache[key] as T;
}
static put<T>(key: string, value: T): void {
CacheUtil.cache[key] = value as Object;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CacheUtil.ets#L25-L46 | a58a581ea4e88029afd7500020a944af18359f11 | gitee | |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/utils/ToolKits.ets | arkts | formatDate | 对Date的扩展,将 Date 转化为指定格式的String。
月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)。
【示例】:
common.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss.S') ==> 2006-07-02 08:09:04.423
common.formatDate(new Date(), 'yyyy-M-d h:m:s.S') ==> 2006-7-2 8:9:4.18
common.formatDate(new Date()... | static formatDate(date: Date, fmt: string) {
// let o = {
// "M+": date.getMonth() + 1, //月份
// "d+": date.getDate(), //日
// "h+": date.getHours(), //小时
// "m+": date.getMinutes(), //分
// "s+": date.getSeconds(), //秒
// "q+": Math.floor((date.getMonth() + 3) / 3), //季度
// "... | AST#method_declaration#Left static formatDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fmt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | static formatDate(date: Date, fmt: string) {
let map = new Map<String, Number>();
map.set("M+", date.getMonth() + 1);
map.set("d+", date.getDate());
map.set("h+", date.getHours());
map.set("m+", date.getMinutes());
map.set("s+", date.getSec... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L345-L395 | aae5031f2fe00b19a54a1545095c87758926323f | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets | arkts | getCameraManagerFn | Get the Camera Manager instance | getCameraManagerFn(uiContext: UIContext): camera.CameraManager | undefined {
if (this.cameraManager) {
return this.cameraManager;
}
let cameraManager: camera.CameraManager | undefined = undefined;
try {
cameraManager = camera.getCameraManager(uiContext.getHostContext());
Logger.info(TA... | AST#method_declaration#Left getCameraManagerFn 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... | getCameraManagerFn(uiContext: UIContext): camera.CameraManager | undefined {
if (this.cameraManager) {
return this.cameraManager;
}
let cameraManager: camera.CameraManager | undefined = undefined;
try {
cameraManager = camera.getCameraManager(uiContext.getHostContext());
Logger.info(TA... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets#L230-L242 | 9c1f881d22659545582888c5d689cbde14774e27 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/PrefUtil.ets | arkts | setValue | 根据KEY设置 value
@param key
@param value | static setValue(key: string, value: preferences.ValueType): void {
console.info('PrefUtil setValue {' + key + '} start')
const defStore = PrefUtil.getStore()
defStore?.putSync(key, value)
defStore?.flush()
} | AST#method_declaration#Left static setValue AST#parameter_list#Left ( AST#parameter#Left key : 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 pr... | static setValue(key: string, value: preferences.ValueType): void {
console.info('PrefUtil setValue {' + key + '} start')
const defStore = PrefUtil.getStore()
defStore?.putSync(key, value)
defStore?.flush()
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L87-L92 | 1a5baef74cd71f174429324f4fdd2aef80d5a73a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/utils/WindowPrivacy.ets | arkts | 获取当前窗口 | export function getCurrentWindow(context: Context) {
return window.getTopWindow(context)
} | AST#export_declaration#Left export AST#function_declaration#Left function getCurrentWindow 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_list#Right AST#block_statement#Lef... | export function getCurrentWindow(context: Context) {
return window.getTopWindow(context)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/Screenshot/Feature/src/main/ets/components/utils/WindowPrivacy.ets#L22-L24 | 4e148930a87f1b5f5dc4e2bf3ca011402f901642 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | 删除当前应用指定类型的通知渠道
@param {notificationManager.SlotType} type 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。
@returns {Promise<void>} void | export async function remove(type: notificationManager.SlotType): Promise<void> {
return notificationManager.removeSlot(type);
} | AST#export_declaration#Left export AST#function_declaration#Left async function remove AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#p... | export async function remove(type: notificationManager.SlotType): Promise<void> {
return notificationManager.removeSlot(type);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L399-L401 | 217909639b6b08814884611e1c5aa4588fbf16bf | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets | arkts | initDB | 初始化数据库
@param context 上下文
@returns | initDB(context: common.UIAbilityContext): Promise<void> {
return new Promise<void>((resolve, reject) => {
relationalStore.getRdbStore(context, CommonConstants.STORE_CONFIG)
.then(rdbStore => {
this.rdbStore = rdbStore;
Logger.debug(`[${CommonConstants.RDB_TAG}]`, 'rdbStore 初始化成功');... | AST#method_declaration#Left initDB 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_a... | initDB(context: common.UIAbilityContext): Promise<void> {
return new Promise<void>((resolve, reject) => {
relationalStore.getRdbStore(context, CommonConstants.STORE_CONFIG)
.then(rdbStore => {
this.rdbStore = rdbStore;
Logger.debug(`[${CommonConstants.RDB_TAG}]`, 'rdbStore 初始化成功');... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L22-L35 | 9df75c76c8b86118547b6d90a389d13e5ea0d3b9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | getTouchMode | returns the touch mode the listener is currently in
@return | public getTouchMode(): number {
return this.mTouchMode;
} | AST#method_declaration#Left public getTouchMode 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_expr... | public getTouchMode(): number {
return this.mTouchMode;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/ChartTouchListener.ets#L112-L114 | 7ef42e7ad46f0d5494db38f5d820e2589d12e338 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SwiperArkTS/entry/src/main/ets/view/play/DescriptionView.ets | arkts | DescriptionView | Description component. | @Component
export struct DescriptionView {
build() {
Column() {
Text($r('app.string.movie_description_1'))
.textStyle($r('app.float.font_size_sort_title'), CommonConstants.FONT_WEIGHT_NORMAL)
Text($r('app.string.movie_description_2'))
.textStyle($r('app.float.font_size_photo_name'), Co... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DescriptionView 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#... | @Component
export struct DescriptionView {
build() {
Column() {
Text($r('app.string.movie_description_1'))
.textStyle($r('app.float.font_size_sort_title'), CommonConstants.FONT_WEIGHT_NORMAL)
Text($r('app.string.movie_description_2'))
.textStyle($r('app.float.font_size_photo_name'), Co... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/play/DescriptionView.ets#L35-L50 | af621541c9b6a84f92d181497606c7ea7dd94599 | gitee |
wuyukobe24/HMApp_ArkTS.git | 6d09d9b07a4fdc4713e5a13b61b85bc1e7893956 | entry/src/main/ets/pages/home/ViewModel/QQHomeViewModel.ets | arkts | loadHomeRequestBannerData | 获取首页banner数据 | loadHomeRequestBannerData(success:(str:string)=>void, fail:(error:NetError)=>void) {
let param:Record<string, string> = {
// "zone":"plat",
// "subch":"66",
// "refreshInterval":"10",
// "resourceId":"4",
// "favzone":"",
// "subChannel":"1",
// "slidetype":"0",
// "n... | AST#method_declaration#Left loadHomeRequestBannerData AST#parameter_list#Left ( AST#parameter#Left success : AST#type_annotation#Left AST#function_type#Left 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#param... | loadHomeRequestBannerData(success:(str:string)=>void, fail:(error:NetError)=>void) {
let param:Record<string, string> = {
}
let url:string = '/go/recommend/platbanner?refresh_type=insert&zone=plat&favzone=&resourceId=1&subChannel=1&slidetype=0&nex... | https://github.com/wuyukobe24/HMApp_ArkTS.git/blob/6d09d9b07a4fdc4713e5a13b61b85bc1e7893956/entry/src/main/ets/pages/home/ViewModel/QQHomeViewModel.ets#L25-L44 | c14c88f08485d20f71b54c651db11fe7106edfe2 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets | arkts | destroy | Destroy the client.
@returns Whether or not destruction was successful | destroy(): boolean {
if (!this.connection) {
this.debug('Attempted to destroy WebSocket but no connection exists!');
return false;
}
return this.connection.destroy();
} | AST#method_declaration#Left destroy 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#e... | destroy(): boolean {
if (!this.connection) {
this.debug('Attempted to destroy WebSocket but no connection exists!');
return false;
}
return this.connection.destroy();
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/WebSocketManager.ets#L47-L53 | 67c3e740a1add876bcf5d571032212636434c460 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets | arkts | sortDreams | 整理梦想列表数据,按照更新时间排序 | sortDreams(dreams: Dream[]): Dream[] {
// 创建副本,避免修改原始数据
const sorted = [...dreams];
// 按更新时间排序,如果没有则使用createAt
sorted.sort((a, b) => {
const aTime = a.updatedAt || a.createdAt || '';
const bTime = b.updatedAt || b.createdAt || '';
// 降序排序(最新的排在前面)
return bTime.localeC... | AST#method_declaration#Left sortDreams AST#parameter_list#Left ( AST#parameter#Left dreams : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Dream [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pr... | sortDreams(dreams: Dream[]): Dream[] {
const sorted = [...dreams];
sorted.sort((a, b) => {
const aTime = a.updatedAt || a.createdAt || '';
const bTime = b.updatedAt || b.createdAt || '';
return bTime.localeCompare(aTime);
});
return sorted;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets#L823-L837 | cfff19e0d69fb91c7f3e0bb6c8597f81a49df5d4 | github |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/component/Logger.ets | arkts | warn | 打印 warn 级别日志
@param args - 可变参数,用于填充日志内容 | warn(...args: string[]): void {
hilog.warn(this.domain, this.prefix, this.format, ...args);
} | AST#method_declaration#Left warn AST#parameter_list#Left ( AST#parameter#Left ... args : 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima... | warn(...args: string[]): void {
hilog.warn(this.domain, this.prefix, this.format, ...args);
} | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Logger.ets#L41-L43 | dcbc5da00985bd4052bdbf0c384d5fa29af9bcb8 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets | arkts | updateData | Update dayInfo.
@param dayInfo
@param callback | updateData(dayInfo: DayInfo, callback: Function): void {
const valueBucket = generateBucket(dayInfo);
let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates(Const.DAY_INFO.tableName ? Const.DAY_INFO.tableName : '');
predicates.equalTo('date', dayInfo.date);
RdbUtils.update(valueBucket, predic... | AST#method_declaration#Left updateData AST#parameter_list#Left ( AST#parameter#Left dayInfo : AST#type_annotation#Left AST#primary_type#Left DayInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_ty... | updateData(dayInfo: DayInfo, callback: Function): void {
const valueBucket = generateBucket(dayInfo);
let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates(Const.DAY_INFO.tableName ? Const.DAY_INFO.tableName : '');
predicates.equalTo('date', dayInfo.date);
RdbUtils.update(valueBucket, predic... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets#L44-L52 | 33db465bcc039dd003cbc925fc82523ffb623168 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | getOptions | 获取弹窗配置builderOptions
@returns | getOptions() {
return this.builderOptions
} | AST#method_declaration#Left getOptions AST#parameter_list#Left ( ) AST#parameter_list#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 . builderOptions AST#member_expression#Right AST#express... | getOptions() {
return this.builderOptions
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L51-L53 | 8f752134ce01bab9aabc5580bdb7c0f6670dca7f | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Pick & Read
Pick a text file from device storage, pulling up a DocumentViewPicker.
@returns A string, of the chosen file's content. | export async function document_pick_to_text(suffixFilters?: string[]) {
let target_uri: string[] = [];
try {
let documentPicker = new picker.DocumentViewPicker();
let contents: string = "";
await documentPicker.select({ maxSelectNumber: 1, fileSuffixFilters: suffixFilters || [".html", ".txt"] })
... | AST#export_declaration#Left export AST#function_declaration#Left async function document_pick_to_text AST#parameter_list#Left ( AST#parameter#Left suffixFilters ? : 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#par... | export async function document_pick_to_text(suffixFilters?: string[]) {
let target_uri: string[] = [];
try {
let documentPicker = new picker.DocumentViewPicker();
let contents: string = "";
await documentPicker.select({ maxSelectNumber: 1, fileSuffixFilters: suffixFilters || [".html", ".txt"] })
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L162-L193 | fbc055bb35175ba18d85e425194fe5917b3271ab | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | canGoBack | 检查是否可以回退 | canGoBack(): boolean {
return this.navigationStack.length > 1;
} | AST#method_declaration#Left canGoBack 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#binary_expression#Le... | canGoBack(): boolean {
return this.navigationStack.length > 1;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L213-L215 | d8633e7b87f0700ea05b6d2e3fc2ecbe5f2aa20d | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isObject | 判断是否是Object类型 | static isObject(value: Any): boolean {
return typeof value === 'object';
} | AST#method_declaration#Left static isObject AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri... | static isObject(value: Any): boolean {
return typeof value === 'object';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L54-L56 | 0b90ce6805703f9b1cef2e398757f10b6a0f367b | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/view/GoodsCommentPage.ets | arkts | GoodsCommentContent | 商品评论页面内容视图
@returns {void} 无返回值 | @Builder
private GoodsCommentContent() {
Text("商品评论页面内容视图")
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GoodsCommentContent 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 Text ( AST#expression#Left "商品评论页面内容视图" AST#ex... | @Builder
private GoodsCommentContent() {
Text("商品评论页面内容视图")
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsCommentPage.ets#L33-L36 | 86668ddadd93b87b73266412f97f9e82facbcca4 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_bookmarks.ets | arkts | get_only_bookmarks_content | Returns The bookmarks, excluding folders, of this folder.
@returns A bookmark[] array. | get_only_bookmarks_content() {
let result_bookmarks: Array<bookmark> = [];
for (let index = 0; index < this.contents.length; index++) {
let this_item = this.contents[index];
if (this_item.get_type() == 'bookmark') {
result_bookmarks.push(this_item as bookmark);
}
}
return resul... | AST#method_declaration#Left get_only_bookmarks_content AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result_bookmarks : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_... | get_only_bookmarks_content() {
let result_bookmarks: Array<bookmark> = [];
for (let index = 0; index < this.contents.length; index++) {
let this_item = this.contents[index];
if (this_item.get_type() == 'bookmark') {
result_bookmarks.push(this_item as bookmark);
}
}
return resul... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L846-L855 | b739092695a436011e4c3f19f5357123199a4a30 | gitee |
huazheleyoushang/harmony_template.git | 9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8 | entry/build/default/generated/profile/default/BuildProfile.ets | arkts | Use these variables when you tailor your ArkTS code. They must be of the const type. | export const BUNDLE_NAME = 'com.example.component'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.example.component' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const BUNDLE_NAME = 'com.example.component'; | https://github.com/huazheleyoushang/harmony_template.git/blob/9606902a2926ca9c5e747eaa6f2a87d8d4d69eb8/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4 | 758668f08b97c5bb0ab75c4af5be04c783dc55b4 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | genIvParamsSpec | 根据传入的iv字符串转换iv对象
@param ivStr
@param ivCoding 偏移量的编码方式(hex/base64)
@returns | static genIvParamsSpec(ivStr: string, ivCoding: buffer.BufferEncoding): crypto.IvParamsSpec {
let ivBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(ivStr, 128, ivCoding) };
let ivParamsSpec: crypto.IvParamsSpec = {
algName: "IvParamsSpec",
iv: ivBlob
};
return ivParamsSpec;
... | AST#method_declaration#Left static genIvParamsSpec AST#parameter_list#Left ( AST#parameter#Left ivStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ivCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_... | static genIvParamsSpec(ivStr: string, ivCoding: buffer.BufferEncoding): crypto.IvParamsSpec {
let ivBlob: crypto.DataBlob = { data: StrAndUintUtil.strKey2Uint8Array(ivStr, 128, ivCoding) };
let ivParamsSpec: crypto.IvParamsSpec = {
algName: "IvParamsSpec",
iv: ivBlob
};
return ivParamsSpec;
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L105-L112 | 10c5df55ea88694e0af123960c068597fc013e64 | gitee |
xinkai-hu/MyDay.git | dcbc82036cf47b8561b0f2a7783ff0078a7fe61d | entry/src/main/ets/view/ChangeBackgroundDialog.ets | arkts | aboutToAppear | 初始化文件夹数据。 | public aboutToAppear(): void {
this.tmpFolder.owner = this.folder.owner;
this.tmpFolder.folderName = this.folder.folderName;
this.tmpFolder.folderType = this.folder.folderType;
this.tmpFolder.background = this.folder.background;
PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, [])... | AST#method_declaration#Left public aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left A... | public aboutToAppear(): void {
this.tmpFolder.owner = this.folder.owner;
this.tmpFolder.folderName = this.folder.folderName;
this.tmpFolder.folderType = this.folder.folderType;
this.tmpFolder.background = this.folder.background;
PreferencesUtil.getPreferences(CommonConstants.FOLDER_PREFERENCES, [])... | https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/view/ChangeBackgroundDialog.ets#L52-L63 | 3669724ebfc942b9fbf33f1b58a561d55269cbbd | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | 全局路由实例 | export const appRouter = AppRouter.getInstance(); | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left appRouter = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppRouter AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AS... | export const appRouter = AppRouter.getInstance(); | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L336-L336 | 3395825b2b469403f0c950d4bb150d5fe89afebc | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.