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/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | interfaces/ets/ani/animator/ets/arkui.component.common.ets | arkts | Copyright (c) 2025 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, soft... | export interface ExpectedFrameRateRange {
min: number,
max: number,
expected: number,
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ExpectedFrameRateRange AST#object_type#Left { AST#type_member#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left max : AST#type_annotati... | export interface ExpectedFrameRateRange {
min: number,
max: number,
expected: number,
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/animator/ets/arkui.component.common.ets#L16-L23 | 040c585084fe276b8c828c01791571f06444c590 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/Paint.ets | arkts | 画笔属性类,用于绘制时使用画笔属性
@param value | export default class Paint {
styleType: Style = Style.FILL_AND_STROKE;
globalAlpha: number | undefined = undefined;
globalCompositeOperation: string = 'source-over'
fillStyle: string | number | CanvasGradient | CanvasPattern = Color.White;
strokeStyle: string | number | CanvasGradient | CanvasPattern = Color.... | AST#export_declaration#Left export default AST#class_declaration#Left class Paint AST#class_body#Left { AST#property_declaration#Left styleType : AST#type_annotation#Left AST#primary_type#Left Style AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Sty... | export default class Paint {
styleType: Style = Style.FILL_AND_STROKE;
globalAlpha: number | undefined = undefined;
globalCompositeOperation: string = 'source-over'
fillStyle: string | number | CanvasGradient | CanvasPattern = Color.White;
strokeStyle: string | number | CanvasGradient | CanvasPattern = Color.... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/Paint.ets#L20-L324 | 1388f55021eca9123554705aa7178c8ddb4260cf | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | registerNavStack | 注册关联一个路由栈到ZRouter中,通常情况使用不上,一般用于第三方的Navigation的路由栈关联到ZRouter中
@param stackName
@param pathStack | public static registerNavStack(stackName: string = DEFAULT_STACK_NAME, pathStack: NavPathStack): void {
ZRouter.getRouterMgr().registerNavStack(stackName, pathStack)
} | AST#method_declaration#Left public static registerNavStack AST#parameter_list#Left ( AST#parameter#Left stackName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left DEFAULT_STACK_NAME AST#expression#Right AST#parameter#Right , AST#parameter#Lef... | public static registerNavStack(stackName: string = DEFAULT_STACK_NAME, pathStack: NavPathStack): void {
ZRouter.getRouterMgr().registerNavStack(stackName, pathStack)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L227-L229 | 1fa59343598776003cb03b8b64bc3e9bdfdab011 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/src/main/ets/common/OfflineResourceManager.ets | arkts | fetchFromOfflineResource | 从离线包资源中取回数据
@param url 文件名
@param filesDir 离线包文件路径 | fetchFromOfflineResource(url: string, filesDir: string): null | ResponseDataType {
let srcFile = fs.openSync(filesDir + '/' + url, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let stat = fs.statSync(filesDir + '/' + url);
let bufSize = stat.size;
// 如果资源不存在,直接返回null
if (bufSize === 0) {
retu... | AST#method_declaration#Left fetchFromOfflineResource AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#pri... | fetchFromOfflineResource(url: string, filesDir: string): null | ResponseDataType {
let srcFile = fs.openSync(filesDir + '/' + url, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let stat = fs.statSync(filesDir + '/' + url);
let bufSize = stat.size;
if (bufSize === 0) {
return null;
}
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/OfflineResourceManager.ets#L116-L133 | d3b1fcd06f4865db0161d1d3272b2d481b3dbc97 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/web/WebSearchService.ets | arkts | getPriceRanges | 获取价格区间建议 | public getPriceRanges(): PriceRangeOption[] {
return [
{ label: '50元以下', min: 0, max: 50 },
{ label: '50-100元', min: 50, max: 100 },
{ label: '100-200元', min: 100, max: 200 },
{ label: '200-500元', min: 200, max: 500 },
{ label: '500-1000元', min: 500, max: 1000 },
{ label: '1000元以... | AST#method_declaration#Left public getPriceRanges AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PriceRangeOption [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_... | public getPriceRanges(): PriceRangeOption[] {
return [
{ label: '50元以下', min: 0, max: 50 },
{ label: '50-100元', min: 50, max: 100 },
{ label: '100-200元', min: 100, max: 200 },
{ label: '200-500元', min: 200, max: 500 },
{ label: '500-1000元', min: 500, max: 1000 },
{ label: '1000元以... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/web/WebSearchService.ets#L146-L155 | b7ec0cd89ecce753e2013f09458eb3ed4f238d6e | github |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/event/EventKeys.ets | arkts | 事件的EventNum | export class EventKeys {
//展示loading的事件处理EventID
static readonly LOADING_DIALOG_EVENT = 0x10000
} | AST#export_declaration#Left export AST#class_declaration#Left class EventKeys AST#class_body#Left { //展示loading的事件处理EventID AST#property_declaration#Left static readonly LOADING_DIALOG_EVENT = AST#expression#Left 0x10000 AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#R... | export class EventKeys {
static readonly LOADING_DIALOG_EVENT = 0x10000
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/event/EventKeys.ets#L4-L7 | 0a8a9e1a41e14a0b4a02d2c3e8ec84b3e844e7f0 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/DemoRepository.ets | arkts | updateDemo | 更新 Demo 记录
@param {DemoEntity} entity - 待更新的实体
@returns {Promise<void>} Promise<void> | async updateDemo(entity: DemoEntity): Promise<void> {
return this.demoLocalDataSource.updateItem(entity);
} | AST#method_declaration#Left async updateDemo AST#parameter_list#Left ( AST#parameter#Left entity : AST#type_annotation#Left AST#primary_type#Left DemoEntity AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#L... | async updateDemo(entity: DemoEntity): Promise<void> {
return this.demoLocalDataSource.updateItem(entity);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/DemoRepository.ets#L36-L38 | b342790ae883bba4254e3c09aaaad8640c5c00c1 | github |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/viewmodels/ReviewViewModel.ets | arkts | getTimeDistribution | 获取时间分布数据 | static getTimeDistribution(completedTasks: TaskItem[]): TimeDistributionItem[] {
const distribution: TimeDistributionItem[] = [
{ label: '今天', hours: 0, color: '#007DFF' },
{ label: '昨天', hours: 0, color: '#5AC8FA' },
{ label: '本周', hours: 0, color: '#34C759' },
{ label: '本月', hours: 0, colo... | AST#method_declaration#Left static getTimeDistribution AST#parameter_list#Left ( AST#parameter#Left completedTasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#... | static getTimeDistribution(completedTasks: TaskItem[]): TimeDistributionItem[] {
const distribution: TimeDistributionItem[] = [
{ label: '今天', hours: 0, color: '#007DFF' },
{ label: '昨天', hours: 0, color: '#5AC8FA' },
{ label: '本周', hours: 0, color: '#34C759' },
{ label: '本月', hours: 0, colo... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L67-L99 | 116bf27f0f7cf1bd70c39a07ee313daaffee22e2 | github |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/bluetooth.ets | arkts | getConnectionStateText | Get connection state text
@param device | getConnectionStateText(device: BluetoothDevice): string {
let stateText: string = '';
switch (device.connectionState) {
case ProfileConnectionState.STATE_DISCONNECTED:
stateText = ''; | AST#method_declaration#Left getConnectionStateText AST#parameter_list#Left ( AST#parameter#Left device : AST#type_annotation#Left AST#primary_type#Left BluetoothDevice AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_ty... | getConnectionStateText(device: BluetoothDevice): string {
let stateText: string = '';
switch (device.connectionState) {
case ProfileConnectionState.STATE_DISCONNECTED:
stateText = ''; | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/bluetooth.ets#L314-L318 | ba22b0c9d0aec61cd3686831a0d999ddcc1f56cb | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | addAddress | 新增地址
@param {Address} address - 地址数据
@returns {void} 无返回值 | private addAddress(address: Address): void {
RequestHelper.repository(this.repository.addAddress(address))
.start((): void => {
this.isSaving = true;
})
.execute()
.then((): void => {
this.onSaveSuccess();
})
.finally((): void => {
this.isSaving = false;
... | AST#method_declaration#Left private addAddress AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left Address 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_t... | private addAddress(address: Address): void {
RequestHelper.repository(this.repository.addAddress(address))
.start((): void => {
this.isSaving = true;
})
.execute()
.then((): void => {
this.onSaveSuccess();
})
.finally((): void => {
this.isSaving = false;
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L382-L394 | c49ca37886f6749e674b240d1ec1a95cf4129596 | github |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/components/GlobalLoading.ets | arkts | showLoading | 显示/隐藏方法 | public showLoading(message?: string) {
this.isShow = true
if (message) {
this.message = message
}
} | AST#method_declaration#Left public showLoading AST#parameter_list#Left ( AST#parameter#Left message ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST... | public showLoading(message?: string) {
this.isShow = true
if (message) {
this.message = message
}
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/components/GlobalLoading.ets#L18-L23 | e95531e592e81895182fd11acfe4db40c7cbfbdb | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/DialogHelper.ets | arkts | showToastLong | 显示长吐司
@param message 吐司内容
@param options | static showToastLong(message: string | Resource, options?: ToastOptions) {
options = options ?? {};
options.message = message;
ActionParameter.initToastDefault(options, 2);
ActionBaseCore.getInstance().showToast(options);
} | AST#method_declaration#Left static showToastLong AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Ri... | static showToastLong(message: string | Resource, options?: ToastOptions) {
options = options ?? {};
options.message = message;
ActionParameter.initToastDefault(options, 2);
ActionBaseCore.getInstance().showToast(options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L407-L412 | 940d5754b65a6deb4883728901d2916653c1caf2 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeScanConst.ets | arkts | 二维码扫描解析常量 | export class QRCodeScanConst {
// 扫描框距离头部高度
static readonly SCAN_TO_TOP_HEIGHT: number = 120
// 相机是否已开启标记
static readonly HAS_CAMERA_PERMISSION: string = 'hasCameraPermission'
// 二维码扫描解析结果
static readonly QR_CODE_PARSE_RESULT: string = 'qrCodeParseResult'
// 二维码图片自定义文件前缀
static readonly IMG_FILE_PREFI... | AST#export_declaration#Left export AST#class_declaration#Left class QRCodeScanConst AST#class_body#Left { // 扫描框距离头部高度 AST#property_declaration#Left static readonly SCAN_TO_TOP_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 120 AST#e... | export class QRCodeScanConst {
static readonly SCAN_TO_TOP_HEIGHT: number = 120
static readonly HAS_CAMERA_PERMISSION: string = 'hasCameraPermission'
static readonly QR_CODE_PARSE_RESULT: string = 'qrCodeParseResult'
static readonly IMG_FILE_PREFIX = 'IMG_QR_CODE_'
static readonly IMG_SUFFIX... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeScanConst.ets#L20-L45 | bb8beea2575ea4fe741e443e222cc0ea9bc74dd9 | gitee | |
Delsin-Yu/JustPDF.git | d53f566e02820dac46e1752151750144acbed50a | entry/src/main/ets/components/PageInfo.ets | arkts | deleteGroup | Deletes a page group from the data source.
Removes all pages in the group, updates global page indices, and notifies listeners.
@param pageGroup The PageGroup to delete | public deleteGroup(pageGroup: PageGroup): void {
const groupIndex = this.pageGroups.indexOf(pageGroup);
if (groupIndex < 0) {
throw new Error(`PageGroup not found for deletion`);
}
// Clean up resources for all pages in the group
for (const pageInfo of pageGroup.pages) {
pageInfo.evictV... | AST#method_declaration#Left public deleteGroup AST#parameter_list#Left ( AST#parameter#Left pageGroup : AST#type_annotation#Left AST#primary_type#Left PageGroup 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#prima... | public deleteGroup(pageGroup: PageGroup): void {
const groupIndex = this.pageGroups.indexOf(pageGroup);
if (groupIndex < 0) {
throw new Error(`PageGroup not found for deletion`);
}
for (const pageInfo of pageGroup.pages) {
pageInfo.evictViewerCache();
pageInfo.releaseThumbnail();... | https://github.com/Delsin-Yu/JustPDF.git/blob/d53f566e02820dac46e1752151750144acbed50a/entry/src/main/ets/components/PageInfo.ets#L688-L712 | 4f631770434482d8c62c171129929642f550adbd | github |
shubai-xixi/DistributeNewsArkts.git | 7a527c5f4121612c8070d809824b0f2615d1b238 | entry/src/main/ets/utils/HttpSyncService.ets | arkts | 将本地选择同步到服务器 | export async function pushLocalNewsId(newsId: string): Promise<void> {
const req = http.createHttp();
try {
await req.request(SERVER_URL, {
method: http.RequestMethod.PUT,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify({ id: newsId })
});
} catch (e) {
cons... | AST#export_declaration#Left export AST#function_declaration#Left async function pushLocalNewsId AST#parameter_list#Left ( AST#parameter#Left newsId : 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_annotatio... | export async function pushLocalNewsId(newsId: string): Promise<void> {
const req = http.createHttp();
try {
await req.request(SERVER_URL, {
method: http.RequestMethod.PUT,
header: { 'Content-Type': 'application/json' },
extraData: JSON.stringify({ id: newsId })
});
} catch (e) {
cons... | https://github.com/shubai-xixi/DistributeNewsArkts.git/blob/7a527c5f4121612c8070d809824b0f2615d1b238/entry/src/main/ets/utils/HttpSyncService.ets#L55-L68 | b364715c280a37b67c617ca4aec677624cd52c06 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NetworkRequestPage.ets | arkts | NetworkRequestContent | 通用网络请求示例页内容视图
@returns {void} 无返回值 | @Builder
private NetworkRequestContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
IBestButton({
text: $r("app.string.demo_network_request_get_action"),
type: "primary",
buttonSize: "normal",
btnWidth: P100,
round: true,
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NetworkRequestContent 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 MediumPaddingVerticalScroll ( ) AST#containe... | @Builder
private NetworkRequestContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
IBestButton({
text: $r("app.string.demo_network_request_get_action"),
type: "primary",
buttonSize: "normal",
btnWidth: P100,
round: true,
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkRequestPage.ets#L35-L69 | f424a8dabf5aba015cb52f172c74eaa1ea594715 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/DbFileUtility.ets | arkts | handleZipFile | 处理ZIP文件(使用HarmonyOS官方解压API)
@param zipData ZIP文件数据
@param targetPath 解压目标路径 | private static async handleZipFile(
zipData: Uint8Array,
targetPath: string,
context: common.Context
): Promise<void> {
const tempPath = `${context.cacheDir}/temp_${Date.now()}.zip`;
// 使用标准异步API写入
await new Promise<void>((resolve, reject) => {
const fd = fs.openSync(tempPath, fs.OpenMo... | AST#method_declaration#Left private static async handleZipFile AST#parameter_list#Left ( AST#parameter#Left zipData : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetPath : AST#type_annotation#Left AST#primary_type... | private static async handleZipFile(
zipData: Uint8Array,
targetPath: string,
context: common.Context
): Promise<void> {
const tempPath = `${context.cacheDir}/temp_${Date.now()}.zip`;
await new Promise<void>((resolve, reject) => {
const fd = fs.openSync(tempPath, fs.OpenMode.CREATE | fs... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DbFileUtility.ets#L124-L148 | 31cc7444ea6a6117ab7cc4d5295c506aeb70a2b9 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/framework/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets | arkts | showToastMessage | 获取一个KVManager实例,创建并获取键值数据库 TODO 数据的增删改查操作 1、调用put()方法向键值数据库中插入数据(新增或修改数据) TODO 2、调用get()方法获取指定键的值(查询数据) TODO 3、调用delete()方法删除指定键值的数据(删除数据) TODO 创建数据库 TODO 信息提示 | showToastMessage(message: Resource) {
promptAction.showToast({
message: message,
duration: CommonConstants.DURATION
});
} | AST#method_declaration#Left showToastMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#e... | showToastMessage(message: Resource) {
promptAction.showToast({
message: message,
duration: CommonConstants.DURATION
});
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets#L26-L31 | bfdab41456ef8316f6cf3c1341ceb7cc4ee76ded | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/EmojiKeyboard.ets | arkts | EmojiKeyboard | 表情键盘 | @Component
export struct EmojiKeyboard {
// 控制器,用以将表情添加到输入框
controllerRich: RichEditorController | undefined = undefined;
msgFontSize: number = 0;
// 最近使用的表情数据,点击表情之后添加到数据中
@Link lastEmojiData: LastEmojiData;
// 表情键盘的表情数据列表
emojiList: Array<EmojiModel> = [];
build() {
Grid() {
// TODO: 性能知识点:... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmojiKeyboard AST#component_body#Left { // 控制器,用以将表情添加到输入框 AST#property_declaration#Left controllerRich : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RichEditorController AST#primary_type#Right ... | @Component
export struct EmojiKeyboard {
controllerRich: RichEditorController | undefined = undefined;
msgFontSize: number = 0;
@Link lastEmojiData: LastEmojiData;
emojiList: Array<EmojiModel> = [];
build() {
Grid() {
ForEach(this.emojiList, (item: EmojiModel) => {
GridItem(... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/EmojiKeyboard.ets#L21-L53 | aab803a002b3e84ab463e6397c656b4d707094c3 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | ensure_extensions_folder | Checks and ensures there is a /extensions directory in sandbox. | function ensure_extensions_folder(context: common.UIAbilityContext) {
let filesDir = context.filesDir;
try {
fileIo.mkdirSync(context.tempDir + '/extensions', true);
} catch (e) {
console.error('[Index] mkdirSync temp/extensions failed! ' + e);
}
try {
if (!fileIo.accessSync(filesDir + '/extension... | AST#function_declaration#Left function ensure_extensions_folder 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#para... | function ensure_extensions_folder(context: common.UIAbilityContext) {
let filesDir = context.filesDir;
try {
fileIo.mkdirSync(context.tempDir + '/extensions', true);
} catch (e) {
console.error('[Index] mkdirSync temp/extensions failed! ' + e);
}
try {
if (!fileIo.accessSync(filesDir + '/extension... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L118-L145 | b8a441d8e7539a18fcf5bca480ee17e942d2637f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | sendGreeting | 发送祝福语 | private async sendGreeting(): Promise<void> {
try {
if (!this.customContent.trim()) {
// TODO: 显示提示信息
return;
}
this.sending = true;
const request: GreetingSendRequest = {
contactId: this.contactId,
greetingId: this.selectedGreeting?.id,
content: thi... | AST#method_declaration#Left private async sendGreeting AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | private async sendGreeting(): Promise<void> {
try {
if (!this.customContent.trim()) {
return;
}
this.sending = true;
const request: GreetingSendRequest = {
contactId: this.contactId,
greetingId: this.selectedGreeting?.id,
content: this.customContent... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L134-L165 | 206576a6e61d430b573a8da88a95649d4269a13e | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/model/CardModel.ets | arkts | 构造器
@param list | constructor(list: CardInfo[]) {
this.list = list;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left {... | constructor(list: CardInfo[]) {
this.list = list;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/model/CardModel.ets#L27-L29 | ebbef5e808c4bdb0ac43264c4816aadd8c83919b | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/SettingsTypes.ets | arkts | 备份频率枚举 | export enum BackupFrequency {
DAILY = 'daily',
WEEKLY = 'weekly',
MONTHLY = 'monthly'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum BackupFrequency AST#enum_body#Left { AST#enum_member#Left DAILY = AST#expression#Left 'daily' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WEEKLY = AST#expression#Left 'weekly' AST#expression#Right AST#enum_member#Right , AST#enum_me... | export enum BackupFrequency {
DAILY = 'daily',
WEEKLY = 'weekly',
MONTHLY = 'monthly'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L641-L645 | 6a6e6440a58febb53b89a9b715dc0108fa51b28e | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/select/selectDividerNormal.ets | arkts | SelectDividerOptionsBuilder | Copyright (c) 2025 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, soft... | @Builder
export function SelectDividerOptionsBuilder(name: string, param: Object) {
SelectDividerOptionsExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectDividerOptionsBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramete... | @Builder
export function SelectDividerOptionsBuilder(name: string, param: Object) {
SelectDividerOptionsExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/select/selectDividerNormal.ets#L16-L19 | 1cf51ff2966168339c6289db69c93863062d861b | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/BasicDataSource.ets | arkts | 实现IDataSource接口的对象 | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = [];
public totalCount(): number {
return 0;
}
public getData(index: number): T | void {
console.info('getData, index:'+index);
}
/**
* 该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
*/
... | AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declarat... | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: DataChangeListener[] = [];
public totalCount(): number {
return 0;
}
public getData(index: number): T | void {
console.info('getData, index:'+index);
}
registerDataChangeListener(listener: DataChangeListener):... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/BasicDataSource.ets#L19-L95 | 966faf0b3f9d9d809fdf0c3ded9107f407a38a4f | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | getLunarBirthdaysInSolarMonth | 获取指定月份的所有农历生日 | async getLunarBirthdaysInSolarMonth(year: number, solarMonth: number): Promise<LunarSolarMapping[]> {
await this.ensureYearMapping(year);
const yearData = this.mappingCache.get(year);
if (!yearData) return [];
const result: LunarSolarMapping[] = [];
for (const mapping of yearData.solarToLunar.val... | AST#method_declaration#Left async getLunarBirthdaysInSolarMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left solarMonth : AST#type_annotation#Left AST#primary_type#Left ... | async getLunarBirthdaysInSolarMonth(year: number, solarMonth: number): Promise<LunarSolarMapping[]> {
await this.ensureYearMapping(year);
const yearData = this.mappingCache.get(year);
if (!yearData) return [];
const result: LunarSolarMapping[] = [];
for (const mapping of yearData.solarToLunar.val... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L243-L258 | 709735b593475b77befe13b1f3f9fb31918c3096 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/CalendarPage.ets | arkts | getLunarDay | 获取农历日期 | private getLunarDay(dateString: string): string {
try {
const lunarDate = this.lunarService.solarToLunar(dateString);
return lunarDate ? lunarDate.dayName : '';
} catch (error) {
return '';
}
} | AST#method_declaration#Left private getLunarDay 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#prim... | private getLunarDay(dateString: string): string {
try {
const lunarDate = this.lunarService.solarToLunar(dateString);
return lunarDate ? lunarDate.dayName : '';
} catch (error) {
return '';
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L146-L153 | 9cce6cb02bc22585383595e73bacaaa3d8c37590 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/FileUtils.ets | arkts | writeEasy | 将数据写入文件,并关闭文件。
@param path string 文件的应用沙箱路径或URI。
@param buffer ArrayBuffer|string 待写入文件的数据,可来自缓冲区或字符串。
@param append 是否追加,true-追加,false-不追加(直接覆盖)
@returns Promise对象。返回实际写入的数据长度,单位字节。 | static async writeEasy(path: string, buffer: ArrayBuffer | string, append: boolean = true): Promise<number> {
const file = FileUtils.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
const offset = append ? FileUtils.statSync(file.fd).size : 0
const options: WriteOptions = { offset: offset, encod... | AST#method_declaration#Left static async writeEasy AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left buffer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Le... | static async writeEasy(path: string, buffer: ArrayBuffer | string, append: boolean = true): Promise<number> {
const file = FileUtils.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
const offset = append ? FileUtils.statSync(file.fd).size : 0
const options: WriteOptions = { offset: offset, encod... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L491-L498 | 7f59742c43d740c62f5ad96816875a5b40266be0 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | logLines | 按行与长度分割日志,避免单条日志过长被截断
@param {"info" | "error"} level - 日志级别
@param {string[]} lines - 日志行
@returns {void} 无返回值 | function logLines(level: "info" | "error", lines: string[]): void {
const logger: (domain: number, tag: string, format: string, content: string) => void =
level === "error" ? hilog.error : hilog.info;
lines.forEach((line: string) => {
splitLines(line).forEach((segment: string) => {
splitChunks(segment... | AST#function_declaration#Left function logLines AST#parameter_list#Left ( AST#parameter#Left level AST#parameter#Right AST#ERROR#Left : "info" | "error" AST#ERROR#Right , AST#parameter#Left lines : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right ... | function logLines(level: "info" | "error", lines: string[]): void {
const logger: (domain: number, tag: string, format: string, content: string) => void =
level === "error" ? hilog.error : hilog.info;
lines.forEach((line: string) => {
splitLines(line).forEach((segment: string) => {
splitChunks(segment... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L194-L204 | 4ed9ced63e65ea8ca68bfb97fb0164d84e18fac0 | github |
RicardoWesleyli/HarmonyNEXT_Examples.git | 6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670 | Chapter6/entry/src/main/ets/pages/Index.ets | arkts | futureWeatherItem | 时段天气组件代码块 | @Builder
futureWeatherItem(timeSlot:string,weather:string,temp:string){
Column({space:10}){
this.textView(timeSlot,22,600,Color.White)
this.textView(weather,22,600,Color.White)
this.textView(temp,22,600,Color.White)
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right futureWeatherItem AST#parameter_list#Left ( AST#parameter#Left timeSlot : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left weather : AST#type_annota... | @Builder
futureWeatherItem(timeSlot:string,weather:string,temp:string){
Column({space:10}){
this.textView(timeSlot,22,600,Color.White)
this.textView(weather,22,600,Color.White)
this.textView(temp,22,600,Color.White)
}
} | https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L65-L72 | 6b7e597605c578b6e32e07a765dbeee8f27da02a | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationService.ets | arkts | @file 全局导航服务:集中存放 NavPathStack,提供统一跳转 API,方便 ViewModel 直接调用
@author Joker.X
Provider / Consumer 共享的键名 | export const NAV_PATH_STACK_KEY: string = "navStack"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left NAV_PATH_STACK_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "navStack" AST#expression#Right AST#variable_declarator#Right ; AST#variab... | export const NAV_PATH_STACK_KEY: string = "navStack"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L14-L14 | 58206e28c695c752e5100d0d7f49ee39db79b8ca | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isWeakMap | 检查是否为WeakMap类型。
@param value
@returns | static isWeakMap(value: Object): boolean {
return new util.types().isWeakMap(value);
} | AST#method_declaration#Left static isWeakMap AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ... | static isWeakMap(value: Object): boolean {
return new util.types().isWeakMap(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L106-L108 | 84290f227c79f94c532810741ad8deb46ea1f885 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | registerAnimParam | 注册路由转场动画,设置相关参数
@param modifier
@param ctx
@param param | public registerAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder {
return NavAnimationStore.getInstance().buildAnimParam(component, ctx)
} | AST#method_declaration#Left public registerAnimParam AST#parameter_list#Left ( AST#parameter#Left component : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left NavDestinatio... | public registerAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder {
return NavAnimationStore.getInstance().buildAnimParam(component, ctx)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L82-L84 | b2b2a270c90a53d16bf210232c0baa35afd6f6d5 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | encodeECB | 加密-ECB模式
@param str 待加密的字符串
@param key 给定秘钥规格密钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@returns | static async encodeECB(str: string, key: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
//转换key
let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName);
// 初始化加解密操作环境
let mode = crypto.CryptoMode.ENCRYPT_MODE;
//创建加密器
let cipher = cr... | AST#method_declaration#Left static async encodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | static async encodeECB(str: string, key: string, symAlgName: string, symEncryptName: string,
keyName: number): Promise<string> {
let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName);
let mode = crypto.CryptoMode.ENCRYPT_MODE;
let cipher = crypto.createCipher(symEncryp... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoUtil.ets#L147-L163 | f39e2977681ee577c15c39af65e2edc0234dafd1 | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | deleteHeader | 删除单个请求头header
@param key 请求头属性 | deleteHeader(key: string) {
this.headerMap.delete(key)
} | AST#method_declaration#Left deleteHeader 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#builder_function_body#Left { AST#expression_statement#Left AST#expression#... | deleteHeader(key: string) {
this.headerMap.delete(key)
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L116-L118 | 63c5133b9f62de1f680067afa74b2ff2d455edc5 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets | arkts | loadInitializationDataSource | 读取historyDownloadResourceData.json中的数据源 | loadInitializationDataSource() {
const context: Context = getContext(this);
// 读取historyDownloadResourceData.json中的数据
let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('historyDownloadResourceData.json');
// 将数据解码,转成字符串
let stringData: string = util.TextDecoder.create('utf-8')... | AST#method_declaration#Left loadInitializationDataSource AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_an... | loadInitializationDataSource() {
const context: Context = getContext(this);
let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('historyDownloadResourceData.json');
let stringData: string = util.TextDecoder.create('utf-8').decodeToString(jsonData);
let data: [] = JSON.pars... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets#L125-L140 | 557790deb268607f7ab9cd55dbbc35ad3c53f462 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppTheme.ets | arkts | ========================== 绿色配色实现 ========================== | export class ColorGreen implements ColorPalette {
primary : ResourceColor = $r('app.color.colorPrimary') // '#2AA940'
secondary : ResourceColor = $r('app.color.colorPrimaryDark') // '#37633F'
accent : ResourceColor = $r('app.color.colorAccent') // '#DD4236'
accent2 : ResourceColor = $r('a... | AST#export_declaration#Left export AST#class_declaration#Left class ColorGreen AST#implements_clause#Left implements ColorPalette AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left primary AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right A... | export class ColorGreen implements ColorPalette {
primary : ResourceColor = $r('app.color.colorPrimary')
secondary : ResourceColor = $r('app.color.colorPrimaryDark')
accent : ResourceColor = $r('app.color.colorAccent')
accent2 : ResourceColor = $r('app.color.colorAccent2')
obsc... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppTheme.ets#L35-L50 | a5dfd7f90a50f8c8ef02da44f8a95257d1df276e | github | |
Huarrrr/MiShop_HarmonyOS.git | a94d941f50550522c8324416afe4551ed4a2df93 | entry/src/main/ets/widgets/BannerBuilder.ets | arkts | BannerBuilder | 轮播图组件 | @Component
export struct BannerBuilder {
private swiperController: SwiperController = new SwiperController()
@State private bannerPosition: number = 0
bannerList: Array<Banner>
build() {
Swiper(this.swiperController) {
ForEach(this.bannerList, (item) => {
this.BannerItemBuilder(item)
})... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BannerBuilder AST#component_body#Left { AST#property_declaration#Left private swiperController : AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right = AST#e... | @Component
export struct BannerBuilder {
private swiperController: SwiperController = new SwiperController()
@State private bannerPosition: number = 0
bannerList: Array<Banner>
build() {
Swiper(this.swiperController) {
ForEach(this.bannerList, (item) => {
this.BannerItemBuilder(item)
})... | https://github.com/Huarrrr/MiShop_HarmonyOS.git/blob/a94d941f50550522c8324416afe4551ed4a2df93/entry/src/main/ets/widgets/BannerBuilder.ets#L5-L48 | e035d514c67dc008c96b0103b559e8e50ce014f8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 高级配置接口 | export interface AdvancedConfig {
developer: DeveloperConfig;
experimental: ExperimentalConfig;
network: NetworkConfig;
performance: PerformanceConfig;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AdvancedConfig AST#object_type#Left { AST#type_member#Left developer : AST#type_annotation#Left AST#primary_type#Left DeveloperConfig AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left experimental : A... | export interface AdvancedConfig {
developer: DeveloperConfig;
experimental: ExperimentalConfig;
network: NetworkConfig;
performance: PerformanceConfig;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L448-L453 | 91ba74ca007a4c4641c391a1833c0a4d824079d5 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets | arkts | createRouter | 通过名称注册router | public static createRouter(routerName: string, router: NavPathStack): void{
RouterModule.routerMap.set(routerName, router);
} | AST#method_declaration#Left public static createRouter AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left router : AST#type_annotation#Left AST#primary_type#Left NavPath... | public static createRouter(routerName: string, router: NavPathStack): void{
RouterModule.routerMap.set(routerName, router);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L31-L33 | 38cd47489a0a9106aa9115beecea871c39c5699a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | closeSocket | 关闭Socket | public closeSocket(): void {
this.mSocket?.closeSocket();
} | AST#method_declaration#Left public closeSocket 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#expre... | public closeSocket(): void {
this.mSocket?.closeSocket();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets#L113-L115 | 45d2f6edcbd06dd852dcef18a9790723035ea7e5 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/CommonUtils.ets | arkts | throttle | 节流函数 | static throttle<T extends (...args: any[]) => any>(
func: T,
wait: number
): (...args: Parameters<T>) => void {
let lastTime = 0;
return function (this: any, ...args: Parameters<T>) {
const now = Date.now();
if (now - lastTime >= wait) {
lastTime = now;
func.apply(this, arg... | AST#method_declaration#Left static throttle AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left any [ ] AST#array_type#Right AST#primary_typ... | static throttle<T extends (...args: any[]) => any>(
func: T,
wait: number
): (...args: Parameters<T>) => void {
let lastTime = 0;
return function (this: any, ...args: Parameters<T>) {
const now = Date.now();
if (now - lastTime >= wait) {
lastTime = now;
func.apply(this, arg... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/CommonUtils.ets#L45-L57 | 5b93c07d5b40fbafda7fb88d848bcd071ff64f40 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/action/DialogUtil.ets | arkts | initDialogDefault | 初始化DialogOptions参数
@param options | private static initDialogDefault(options: DialogOptions) {
options.title = options.title ?? DialogUtil.defaultConfig.title;
options.subtitle = options.subtitle ?? DialogUtil.defaultConfig.subtitle;
options.alignment = options.alignment ?? DialogUtil.defaultConfig.alignment;
options.offset = options.offs... | AST#method_declaration#Left private static initDialogDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression... | private static initDialogDefault(options: DialogOptions) {
options.title = options.title ?? DialogUtil.defaultConfig.title;
options.subtitle = options.subtitle ?? DialogUtil.defaultConfig.subtitle;
options.alignment = options.alignment ?? DialogUtil.defaultConfig.alignment;
options.offset = options.offs... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L205-L249 | 729aa66e8a19995e2335a4329362ad55b28737d3 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/CalendarPage.ets | arkts | initializePage | 初始化页面 | private async initializePage(): Promise<void> {
try {
this.loading = true;
await this.loadAllContacts();
await this.loadCalendarData();
await this.loadUpcomingBirthdays();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize calendar pa... | AST#method_declaration#Left private async initializePage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AS... | private async initializePage(): Promise<void> {
try {
this.loading = true;
await this.loadAllContacts();
await this.loadCalendarData();
await this.loadUpcomingBirthdays();
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to initialize calendar pa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/CalendarPage.ets#L77-L88 | 1037d6e4d5664b58ad59efe8da7ea98e6cc8087d | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/customComponent.d.ets | arkts | Definition of V2 custom component class.
@extends BaseCustomComponent
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export declare abstract class CustomComponentV2<T extends CustomComponentV2<T, T_Options>, T_Options> extends BaseCustomComponent {
/**
* Define the constructor of custom component
*
* @param { () => T } factory - factory to create instance of custom component
* @param { T_Options } initializers... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left abstract class CustomComponentV2 AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left CustomComponentV2 AST#type_arguments#Left < AST#type_ann... | export declare abstract class CustomComponentV2<T extends CustomComponentV2<T, T_Options>, T_Options> extends BaseCustomComponent {
@ComponentBuilder
static $_instantiate(
factory: () => T,
initializers?: T_Options,
reuseId?: string,
@Builder content?: () => void
): T
... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/customComponent.d.ets#L243-L273 | 90241625f036decd48e0f8e92f6122e6ff668bbd | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | getGiftRecommendations | 获取礼物推荐 | async getGiftRecommendations(
contact: Contact,
budget: number = 0,
count: number = 10
): Promise<RecommendationItem[]> {
try {
const context: RecommendationContext = {
userId: 'default',
contactId: contact.id,
occasion: 'birthday',
relationship: contact.relation ... | AST#method_declaration#Left async getGiftRecommendations 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 budget : AST#type_annotation#Left AST#primary_type#Left number ... | async getGiftRecommendations(
contact: Contact,
budget: number = 0,
count: number = 10
): Promise<RecommendationItem[]> {
try {
const context: RecommendationContext = {
userId: 'default',
contactId: contact.id,
occasion: 'birthday',
relationship: contact.relation ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L385-L411 | fa462ef5164dcc7ae84869bdc5ce9d8adc888f0d | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/WindowModel.ets | arkts | getStatusBarHeight | 获取主窗口顶部导航栏高度
@returns {callback((statusBarHeight: number) => void))} | getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void {
if (this.windowStage === undefined) {
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
return;
}
try {
const type = window.AvoidAreaType.TYPE_SYS... | AST#method_declaration#Left getStatusBarHeight AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left statusBarHeight : AST#type_annotation#Left AST#... | getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void {
if (this.windowStage === undefined) {
return;
}
this.windowStage.getMainWindow((err, windowClass: window.Window) => {
if (err.code) {
return;
}
try {
const type = window.AvoidAreaType.TYPE_SYS... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/WindowModel.ets#L58-L79 | b0fba52822177f34a1c73a2649e77e959b6c027c | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Pins or unpins a window to the top.
@param id The window id. | export function pin_to_top(id: string) {
if (!(AppStorage.get('free_window_mode') as boolean)) {
console.log('[pin_to_top] Didn\'t pin window to top because is not in free window mode. But how did you get here?');
return;
}
let window = window_of_id(id);
let storage = storage_of_id(id);
let pin = stor... | AST#export_declaration#Left export AST#function_declaration#Left function pin_to_top AST#parameter_list#Left ( AST#parameter#Left id : 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#stat... | export function pin_to_top(id: string) {
if (!(AppStorage.get('free_window_mode') as boolean)) {
console.log('[pin_to_top] Didn\'t pin window to top because is not in free window mode. But how did you get here?');
return;
}
let window = window_of_id(id);
let storage = storage_of_id(id);
let pin = stor... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L97-L112 | 5a54d196cc01a1f696289720a974803554f18a84 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/PieChartRenderer.ets | arkts | drawHighlighted | @Override | public drawHighlighted(c: CanvasRenderingContext2D, indices: Highlight[]): void {
/* Skip entirely if using rounded circle slices, because it doesn't make sense to highlight
* in this way.
*/
let drawInnerArc: boolean = this.mChart.isDrawHoleEnabled() && !this.mChart.isDrawSlicesUnderHoleEnabled();
... | AST#method_declaration#Left public drawHighlighted AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left indices : AST#type_annotation#Left AST#primary_type#Left A... | public drawHighlighted(c: CanvasRenderingContext2D, indices: Highlight[]): void {
let drawInnerArc: boolean = this.mChart.isDrawHoleEnabled() && !this.mChart.isDrawSlicesUnderHoleEnabled();
if (drawInnerArc && this.mChart.isDrawRoundedSlicesEnabled())
return;
if (!this.mAnimator) {
retur... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/PieChartRenderer.ets#L842-L1062 | 2b5fe7e3786517566608246c09231d898c4bf015 | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onCreate | 创建实例时调用。 | onCreate() {
// 在全局上下文中设置对象实例
GlobalContext.getContext().setObject('preference', PreferencesHandler.instance);
} | AST#method_declaration#Left onCreate 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#expressio... | onCreate() {
GlobalContext.getContext().setObject('preference', PreferencesHandler.instance);
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/entryability/EntryAbility.ets#L12-L15 | 9577b33e7af4875cc00f36216381c33a87b31bed | github |
ashcha0/my-arkts.git | 49e433fd286793fb411fe073e37f598340c84bcb | entry/.preview/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.huawei.quickstart'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.huawei.quickstart' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const BUNDLE_NAME = 'com.huawei.quickstart'; | https://github.com/ashcha0/my-arkts.git/blob/49e433fd286793fb411fe073e37f598340c84bcb/entry/.preview/default/generated/profile/default/BuildProfile.ets#L4-L4 | 8967ccde8b255dac4915488164e20ec9d92bf254 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets | arkts | updatePhone | 更新手机号
@param {string} value - 手机号
@returns {void} 无返回值 | updatePhone(value: string): void {
this.phone = value;
} | AST#method_declaration#Left updatePhone AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ... | updatePhone(value: string): void {
this.phone = value;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L173-L175 | df0c516a3e2c078c280a7955c7480d5abdf0a3bf | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Spacer.ets | arkts | SpaceHorizontalMedium | 创建一个中等水平间距(12vp)
@returns {void} 无返回值 | @Builder
export function SpaceHorizontalMedium(): void {
Blank().width($r("app.float.space_horizontal_medium"));
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceHorizontalMedium 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#ar... | @Builder
export function SpaceHorizontalMedium(): void {
Blank().width($r("app.float.space_horizontal_medium"));
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L91-L94 | 4e182616c058534a8076d20f32ce6dc14981266c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/entryability/EntryAbility.ets | arkts | initializeServices | 初始化应用服务 | private async initializeServices(): Promise<void> {
try {
// 首先初始化PreferencesService(SettingsService依赖它)
await PreferencesService.getInstance().initialize(this.context);
// 初始化数据库服务
await DatabaseService.getInstance().initializeDatabase(this.context);
// 初始化设置服务
await SettingsS... | AST#method_declaration#Left private async initializeServices AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ... | private async initializeServices(): Promise<void> {
try {
await PreferencesService.getInstance().initialize(this.context);
await DatabaseService.getInstance().initializeDatabase(this.context);
await SettingsService.getInstance().initialize();
console.log('[EntryAbilit... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L115-L134 | 52c6942947bf3439e0033f900c3403cd9f68b137 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets | arkts | queryData | 2、调用get()方法获取指定键的值(查询数据) | async queryData(key: string): Promise<boolean | string | number | Uint8Array> {
if (kvStore !== undefined) {
try {
resultData = await kvStore.get(key); // 等待获取操作完成
console.info('success to query data:'+resultData);
} catch (error) {
console.error('Failed to query data:', error);... | AST#method_declaration#Left async queryData 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async queryData(key: string): Promise<boolean | string | number | Uint8Array> {
if (kvStore !== undefined) {
try {
resultData = await kvStore.get(key);
console.info('success to query data:'+resultData);
} catch (error) {
console.error('Failed to query data:', error);
re... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets#L49-L60 | 4345a39eef1c484fa1bda5d83538332239c1e322 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets | arkts | setStateChangeCallback | 状态机上报回调函数 | async setStateChangeCallback(): Promise<void> {
this.avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
logger.info('stateChange callback function is triggered,state is:' + state + ',reason is :' + reason);
switch (state) {
case 'idle':
this.release(... | AST#method_declaration#Left async setStateChangeCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annota... | async setStateChangeCallback(): Promise<void> {
this.avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
logger.info('stateChange callback function is triggered,state is:' + state + ',reason is :' + reason);
switch (state) {
case 'idle':
this.release(... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets#L250-L264 | 950fa618c0e3ad2bff6ebfacf51c8d398be6d4a6 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Multi_device_V2/common/src/main/ets/viewmodel/BottomTabsItem.ets | arkts | Interface of bottom tab item. | export interface BottomTabsItem {
icon: Resource;
iconSelected: Resource;
text: Resource;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BottomTabsItem AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left iconSelected : AST#type_anno... | export interface BottomTabsItem {
icon: Resource;
iconSelected: Resource;
text: Resource;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Multi_device_V2/common/src/main/ets/viewmodel/BottomTabsItem.ets#L19-L23 | 98761fb60f841b666580e4557f933b199a66206f | gitee | |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/model/UserModel.ets | arkts | 用户信息模型 - 根据云数据库表结构定义 | export class UserInfo {
id: number;
username: string;
password: string;
like?: string;
history?: string;
phone?: number;
createdTime?: number;
lastLoginTime?: number;
avatar?: string;
constructor(id: number, username: string, password: string) {
this.id = id;
this.username = username;
t... | AST#export_declaration#Left export AST#class_declaration#Left class UserInfo 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#property_declaration#Right AST#property_declaration#Left username : AST#type_... | export class UserInfo {
id: number;
username: string;
password: string;
like?: string;
history?: string;
phone?: number;
createdTime?: number;
lastLoginTime?: number;
avatar?: string;
constructor(id: number, username: string, password: string) {
this.id = id;
this.username = username;
t... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L19-L94 | c21d9d260a3437f1f0f269cb507450b4db39c4e3 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | onActionCancel | The Pan gesture is successfully recognized and a callback is triggered when the touch cancel event
is received.
@param { Callback<void> } event
@returns { PanGesture }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | onActionCancel(event: Callback<void>): PanGesture; | AST#method_declaration#Left onActionCancel AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argument... | onActionCancel(event: Callback<void>): PanGesture; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L529-L529 | 514c7cf6fca19417ac1e34b90821be463c848c22 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/ui_tools.ets | arkts | Enables the listeners for avoid area change.
Works OK in both window modes (free / traditional).
@param windowClass The window.Window object.
@param storage The LocalStorage of that window. | export function listen_focus(windowClass: window.Window, storage: LocalStorage) {
// Focus Listener
try {
windowClass.on("windowEvent", (windowEvent) => {
if (windowEvent == window.WindowEventType.WINDOW_ACTIVE || windowEvent == window.WindowEventType.WINDOW_SHOWN) {
// Focused
storage.set... | AST#export_declaration#Left export AST#function_declaration#Left function listen_focus AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter... | export function listen_focus(windowClass: window.Window, storage: LocalStorage) {
try {
windowClass.on("windowEvent", (windowEvent) => {
if (windowEvent == window.WindowEventType.WINDOW_ACTIVE || windowEvent == window.WindowEventType.WINDOW_SHOWN) {
storage.setOrCreate('on_focus', true);... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L247-L265 | 8fc1a4403483e3a0f58bca12f990cd40045df1b9 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | getAllWords | 获取所有单词 | getAllWords(): WordUser[] {
return [...this.allWords];
} | AST#method_declaration#Left getAllWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left ret... | getAllWords(): WordUser[] {
return [...this.allWords];
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L319-L321 | d00e698ca199c4038b3e216d42d85b0a90836cba | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets | arkts | ready | 初始化准备 | private static async ready(fileName: string) {
try {
let bufferSize: number = 0;
let audioStreamInfo: audio.AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, // 采样率
channels: audio.AudioChannel.CHANNEL_1, // 通道
sampleFormat: audio.AudioSampleFormat.SAM... | AST#method_declaration#Left private static async ready AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_state... | private static async ready(fileName: string) {
try {
let bufferSize: number = 0;
let audioStreamInfo: audio.AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets#L26-L68 | 8d50fdc34e97d1c69ce62a165848ed7f4b7f4b9b | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/textInput/TextEditNodeController.ets | arkts | canAddTextInputNode | 是否可以添加文本节点
@returns true:可以添加 false:不可以添加 | canAddTextInputNode(): boolean {
let topRecord = this.textRecords.length > 0 ? this.textRecords[this.textRecords.length - 1] : undefined;
if (topRecord?.data instanceof TextInputData && topRecord.data.isActivated()) {
// 最上面是文本如果处于编辑态则切换到非激活态,并且当前不添加文本
topRecord.data.setActivated(false);
retur... | AST#method_declaration#Left canAddTextInputNode 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#variable_declaration#Left let AST#variable_declarator#Left topR... | canAddTextInputNode(): boolean {
let topRecord = this.textRecords.length > 0 ? this.textRecords[this.textRecords.length - 1] : undefined;
if (topRecord?.data instanceof TextInputData && topRecord.data.isActivated()) {
topRecord.data.setActivated(false);
return false;
}
let edgeVisibl... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextEditNodeController.ets#L155-L175 | 9fe57c54fb10fbb576fc2df18e3514c9e8640d5d | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | refresh | Refresh. | private refresh(): void {
if (this.ctx !== undefined && this.input !== undefined && this.canvasReady) {
this.drawImage();
this.drawCrop();
}
} | AST#method_declaration#Left private refresh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_e... | private refresh(): void {
if (this.ctx !== undefined && this.input !== undefined && this.canvasReady) {
this.drawImage();
this.drawCrop();
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L431-L436 | 3cbb14ba0596088e9bad528f4e7235791756f6d1 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets | arkts | createTable | 上层接口 调用 createTableSql 生成 sql 语句, executeSql 执行 | createTable(tableName: string, columns: Array<ColumnInfo>): Promise<void> {
let createTableSql = tableHelper.createTableSql(tableName, columns);
return this.executeSql(createTableSql);
} | AST#method_declaration#Left createTable AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columns : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | createTable(tableName: string, columns: Array<ColumnInfo>): Promise<void> {
let createTableSql = tableHelper.createTableSql(tableName, columns);
return this.executeSql(createTableSql);
} | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Rdb/RdbHelperImp.ets#L43-L46 | ec9b06c7da3a59cb31ed9fe6d4745a42101c00ea | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/PodcastDetailPage.ets | arkts | showUnsubscribeDialog | 显示取消订阅确认对话框 | showUnsubscribeDialog(): void {
if (!this.podcast) return;
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('确定', '#FF3B30')
];
UIUtils.showDialog(new DialogOptions(
'取消订阅',
`确定要取消订阅《${this.podcast.title}》吗?\n\n取消订阅后,该播客的所有单集和下载内容都将被删除... | AST#method_declaration#Left showUnsubscribeDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression... | showUnsubscribeDialog(): void {
if (!this.podcast) return;
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('确定', '#FF3B30')
];
UIUtils.showDialog(new DialogOptions(
'取消订阅',
`确定要取消订阅《${this.podcast.title}》吗?\n\n取消订阅后,该播客的所有单集和下载内容都将被删除... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/PodcastDetailPage.ets#L247-L264 | 23023c8a2bdece03f01e30bd582e5c8e09248cbb | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | seniorVersion | Senior版本号,随局部架构、重大特性增加。 | static seniorVersion(): string {
return deviceInfo.seniorVersion + ''
} | AST#method_declaration#Left static seniorVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_exp... | static seniorVersion(): string {
return deviceInfo.seniorVersion + ''
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L147-L149 | 1a23a60f7bd6bd414f7a93063dc3cb31312897be | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BarLineScatterCandleBubbleDataSet.ets | arkts | Baseclass of all DataSets for Bar-, Line-, Scatter- and CandleStickChart. | export default abstract class BarLineScatterCandleBubbleDataSet<T extends EntryOhos>
extends DataSet<T>
implements IBarLineScatterCandleBubbleDataSet<T> {
/**
* default highlight color
*/
protected mHighLightColor: number = 0xffbb73;
constructor(yVals: JArrayList<T>, label: string) {
super(yVals, label... | AST#export_declaration#Left export default AST#class_declaration#Left abstract class BarLineScatterCandleBubbleDataSet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left EntryOhos AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#typ... | export default abstract class BarLineScatterCandleBubbleDataSet<T extends EntryOhos>
extends DataSet<T>
implements IBarLineScatterCandleBubbleDataSet<T> {
protected mHighLightColor: number = 0xffbb73;
constructor(yVals: JArrayList<T>, label: string) {
super(yVals, label);
}
public setHighLightColor(... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BarLineScatterCandleBubbleDataSet.ets#L25-L56 | f47402d6b0d8bc59518f2a8c8343a6c9b4ef2fb9 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | isNotEmpty | 判断字符串是否为非空。true为非空空,否则false
@param str
@returns | static isNotEmpty(str: string | undefined | null): boolean {
return false === StrUtil.isEmpty(str);
} | AST#method_declaration#Left static isNotEmpty AST#parameter_list#Left ( AST#parameter#Left str : 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#primary_type#Left null AST#primary_type#Right AST#union_type#Ri... | static isNotEmpty(str: string | undefined | null): boolean {
return false === StrUtil.isEmpty(str);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L63-L65 | de2e880539fe6173e792126ad6782aba5ffefd27 | gitee |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Pointer.ets | arkts | An iterator for PointerMap. | export class PointerIterator<P extends Pointer> implements Iterator<P> {
private index: number = 0;
constructor(private pointerMap: PointerMap<P>) {}
/**
* Checks if there are more elements to iterate over.
* @returns True if there are more elements, otherwise false.
*/
hasNext(): boolean {
do {
... | AST#export_declaration#Left export AST#class_declaration#Left class PointerIterator AST#type_parameters#Left < AST#type_parameter#Left P extends AST#type_annotation#Left AST#primary_type#Left Pointer AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#implements_cla... | export class PointerIterator<P extends Pointer> implements Iterator<P> {
private index: number = 0;
constructor(private pointerMap: PointerMap<P>) {}
hasNext(): boolean {
do {
if (this.pointerMap.getPointer(this.index) != null) {
return true;
}
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L128-L142 | 2e766c7999fd5f562ea76cfc23c71487e7ecdf60 | github | |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/util/TextInputUtils.ets | arkts | 计算矩形弧度
@param xOffset x偏移
@param yOffset y偏移
@param degree 角度
@returns 矩形旋转弧度 | export function calcRectangleRadians(xOffset: number, yOffset: number, degree: number): number {
if (xOffset === 0) {
return 0
} else {
// 弧度
const radians = Math.atan(yOffset / xOffset);
// 转换为角度
const yDegree = radians * (180 / Math.PI);
// 计算基于当前角度新旋转的弧度
let newRadians = (yDegree - de... | AST#export_declaration#Left export AST#function_declaration#Left function calcRectangleRadians AST#parameter_list#Left ( AST#parameter#Left xOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left yOffset : AST#type_annotat... | export function calcRectangleRadians(xOffset: number, yOffset: number, degree: number): number {
if (xOffset === 0) {
return 0
} else {
const radians = Math.atan(yOffset / xOffset);
const yDegree = radians * (180 / Math.PI);
let newRadians = (yDegree - degree) * (Math.PI / 180)
re... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/TextInputUtils.ets#L54-L66 | 3fe164b01e830e1d43feaa729c635fbd452d5935 | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/toggle/toggleColor.ets | arkts | ToggleColorBuilder | Copyright (c) 2025 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, soft... | @Builder
export function ToggleColorBuilder(name: string, param: Object) {
ToggleColorExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleColorBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pa... | @Builder
export function ToggleColorBuilder(name: string, param: Object) {
ToggleColorExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleColor.ets#L16-L19 | 36dd4e48a0344fa438597a69567eea4fc1a1836d | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/common/utils/SwiperDataSource.ets | arkts | IDataSource interface. | export class SwiperDataSource implements IDataSource {
private list: ZonesItem[] = [];
private listeners: DataChangeListener[] = [];
constructor(list: ZonesItem[]) {
this.list = list;
}
totalCount(): number {
return this.list.length;
}
getData(index: number): ZonesItem {
return this.list[in... | AST#export_declaration#Left export AST#class_declaration#Left class SwiperDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ZonesItem [ ] AST#array... | export class SwiperDataSource implements IDataSource {
private list: ZonesItem[] = [];
private listeners: DataChangeListener[] = [];
constructor(list: ZonesItem[]) {
this.list = list;
}
totalCount(): number {
return this.list.length;
}
getData(index: number): ZonesItem {
return this.list[in... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/SwiperDataSource.ets#L21-L45 | 9b62dc851c8d797096d923b898c1d09ff5e09472 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onVodSeekDuration | @description 监听SeekTime,用于刷新进度条长度
@param duration 当前时长,单位为毫秒(ms)。 | onVodSeekDuration(duration: number) {
} | AST#method_declaration#Left onVodSeekDuration AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right A... | onVodSeekDuration(duration: number) {
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L418-L420 | b2ce9d4f168eede96a9e77a3210d2c8cd925c5fa | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets | arkts | @file
@kit ArkUI
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declaration of the menu item on the right side.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class SelectTitleBarMenuItem {
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkU... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class SelectTitleBarMenuItem AST#class_body#Left { /**
* Icon resource for this menu item.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Icon res... | export declare class SelectTitleBarMenuItem {
value: ResourceStr;
label?: ResourceStr;
isEnabled?: boolean;
action?: () => void;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets#L30-L81 | 4b8defabb9dcb1841f78972e2c34a52948d6cff5 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/debug/DebugFlg.ets | arkts | isDebugMode | private static readonly isDebug: boolean = true; // 编译时配置 | static isDebugMode(): boolean {
// return DebugFlg.isDebug;
// 获取应用是否为Release环境
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
let mBundleInfo = bundleManager.getBundleInfoForSelfSync(bundleFlags);
let isRelease = !mBundleInfo.appInfo.debug; // debug为false时即Release环境... | AST#method_declaration#Left static isDebugMode 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 { // return DebugFlg.isDebug; // 获取应用是否为Release环境 AST#statement#Left AST#variable_declara... | static isDebugMode(): boolean {
let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
let mBundleInfo = bundleManager.getBundleInfoForSelfSync(bundleFlags);
let isRelease = !mBundleInfo.appInfo.debug;
return !isRelease
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/debug/DebugFlg.ets#L8-L18 | fe876fd6af1f846520a6f58a20f6f842046ea1d7 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | isNotEmpty | 判断字符串是否为非空。true为非空空,否则false
@param str
@returns | static isNotEmpty(str: string | undefined | null): boolean {
return false === Helper.isEmpty(str);
} | AST#method_declaration#Left static isNotEmpty AST#parameter_list#Left ( AST#parameter#Left str : 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#primary_type#Left null AST#primary_type#Right AST#union_type#Ri... | static isNotEmpty(str: string | undefined | null): boolean {
return false === Helper.isEmpty(str);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L42-L44 | 2138baf0287790ef106f4beebb5e6c2a05241713 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/Tools.ets | arkts | isResource | 判断是否是Resource类型 | static isResource(value: Any) {
if (value) {
const res = value as Resource;
return StrUtils.isNotNull(res?.id) && StrUtils.isNotNull(res?.bundleName) && StrUtils.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 StrUtils.isNotNull(res?.id) && StrUtils.isNotNull(res?.bundleName) && StrUtils.isNotNull(res?.moduleName);
}
return false;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L357-L363 | 306a1ad749c82494817207b685d9c90f91161838 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/Helper.ets | arkts | getAlignment | 将DialogAlignment值转化为Alignment值 | static getAlignment(dialogAlignment: DialogAlignment): Alignment | undefined {
switch (dialogAlignment) {
case DialogAlignment.Top:
return Alignment.Top;
case DialogAlignment.Center:
return Alignment.Center;
case DialogAlignment.Bottom:
return Alignment.Bottom;
case D... | AST#method_declaration#Left static getAlignment AST#parameter_list#Left ( AST#parameter#Left dialogAlignment : AST#type_annotation#Left AST#primary_type#Left DialogAlignment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST... | static getAlignment(dialogAlignment: DialogAlignment): Alignment | undefined {
switch (dialogAlignment) {
case DialogAlignment.Top:
return Alignment.Top;
case DialogAlignment.Center:
return Alignment.Center;
case DialogAlignment.Bottom:
return Alignment.Bottom;
case D... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L270-L292 | fcd5f420544510ca8f04c31d2caea1a1f3969abe | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/FileListDataSource.ets | arkts | reloadNewData | 重新加载 | public reloadNewData(data: FolderAndFileItem[]): void {
this.dataArray = []
for (const d of data) {
this.dataArray.push(d);
this.notifyDataAdd(this.dataArray.length - 1);
}
this.notifyDataReload()
} | AST#method_declaration#Left public reloadNewData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FolderAndFileItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an... | public reloadNewData(data: FolderAndFileItem[]): void {
this.dataArray = []
for (const d of data) {
this.dataArray.push(d);
this.notifyDataAdd(this.dataArray.length - 1);
}
this.notifyDataReload()
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/FileListDataSource.ets#L40-L47 | 72db1c60e1f54ce2fa10a8dc48454e42c7260315 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets | arkts | onTouch | view 调用的触摸事件 此事件可分发 缩放、平移两个事件,缩放 监听为两指
@param event | public onTouch(event: TouchEvent) {
/**
* 监听按下手指的数量,最大监听两个手指
*/
if (event.type === TouchType.Down) {
this.firstTouch = event.touches[0];
if (event.touches.length > 1) {
this.secondTouch = event.touches[1];
} else {
thi... | AST#method_declaration#Left public onTouch AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { /**
* 监听按下手指的数量,最大监听两个手指
... | public onTouch(event: TouchEvent) {
if (event.type === TouchType.Down) {
this.firstTouch = event.touches[0];
if (event.touches.length > 1) {
this.secondTouch = event.touches[1];
} else {
this.startMoveX = 0;
this.startM... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets#L136-L158 | 7c80b8b9d4c3422a3e0f6717b4e7b7c5a3c7e667 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets | arkts | getFruitData | Process the data obtained from the database. | async getFruitData() {
this.fruitData = await this.getPreference();
return this.fruitData;
} | AST#method_declaration#Left async getFruitData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fruitData AST#memb... | async getFruitData() {
this.fruitData = await this.getPreference();
return this.fruitData;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/model/PreferenceModel.ets#L102-L105 | b3354d7284e06d1b5f3eb9732b1ab3ea1a9aa65d | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets | arkts | attach | TODO 知识点:绑定输入法 | async attach() {
await this.inputController.attach(true, this.textConfig);
logger.info('attached');
} | AST#method_declaration#Left async attach AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#... | async attach() {
await this.inputController.attach(true, this.textConfig);
logger.info('attached');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets#L97-L100 | 66a8b5c54b00063bbe7c1b45642100a6b2123b1a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/model/CardModel.ets | arkts | unregisterDataChangeListener | Unregister data change listener | unregisterDataChangeListener(): void {
} | AST#method_declaration#Left unregisterDataChangeListener 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#builder_function_body#Right AST#method_declaration#Right | unregisterDataChangeListener(): void {
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/model/CardModel.ets#L58-L59 | e0f503e9388c1967445615883b59f45428dbec71 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | await | 当被拉起时,通过want传递的参数同步对端界面UI | await featureAbility.getWant((error, want) => {
// 远端被拉起后,连接对端的service
if (want.parameters.deviceId) {
let remoteDeviceId = want.parameters.deviceId
connectRemoteService(remoteDeviceId)
}
} | AST#method_declaration#Left await AST#ERROR#Left featureAbility . getWant ( AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right , AST#parameter#Left want AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left => AST#ERROR#Right AST#block_statement#Left { // 远端被拉起后,连接对端的service ... | await featureAbility.getWant((error, want) => {
if (want.parameters.deviceId) {
let remoteDeviceId = want.parameters.deviceId
connectRemoteService(remoteDeviceId)
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/HandleGameApplication/HandleEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets#L91-L97 | 0951a52d80e6b5a0aead91f3ce49574d1eb66d1b | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/AcademyManager.ets | arkts | getMethodProgress | 获取特定方法的学习进度 | getMethodProgress(methodId: string): LearningProgress | null {
return this.learningProgress.get(methodId) || null;
} | AST#method_declaration#Left getMethodProgress AST#parameter_list#Left ( AST#parameter#Left methodId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left... | getMethodProgress(methodId: string): LearningProgress | null {
return this.learningProgress.get(methodId) || null;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/AcademyManager.ets#L259-L261 | c3b9e51a616f0c404dfbbf738041d2e6a85284de | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 隐私配置接口 | export interface PrivacyConfig {
dataEncryption: boolean;
biometricLock: boolean;
autoLockTimeout: number; // 分钟
anonymousAnalytics: boolean;
crashReporting: boolean;
locationTracking: boolean;
contactSyncEnabled: boolean;
backupToCloud: boolean;
shareUsageData: boolean;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PrivacyConfig AST#object_type#Left { AST#type_member#Left dataEncryption : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left biometricLock : AST#... | export interface PrivacyConfig {
dataEncryption: boolean;
biometricLock: boolean;
autoLockTimeout: number;
anonymousAnalytics: boolean;
crashReporting: boolean;
locationTracking: boolean;
contactSyncEnabled: boolean;
backupToCloud: boolean;
shareUsageData: boolean;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L404-L414 | e8dcd675567b05871fc786b19f5470ebdab773a8 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CouponRepository.ets | arkts | getUserCouponPage | 分页查询用户优惠券
@param params 分页查询参数
@returns 用户优惠券分页数据 | async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
return this.networkDataSource.getUserCouponPage(params);
} | AST#method_declaration#Left async getUserCouponPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi... | async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> {
return this.networkDataSource.getUserCouponPage(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CouponRepository.ets#L43-L45 | 34aaa33bbdaa8b8be99b0cc7c6c5b095aa57e174 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/shopping/user/src/ets/arkcompilerPOC/concurrency2.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export function callRDBWithNativeEACoroutine() {
} | AST#export_declaration#Left export AST#function_declaration#Left function callRDBWithNativeEACoroutine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right | export function callRDBWithNativeEACoroutine() {
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/shopping/user/src/ets/arkcompilerPOC/concurrency2.ets#L16-L17 | 6aa18462440f8680e57df1f71f8332bb1830c891 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationCenterService.ets | arkts | getNotificationGroups | 按类型分组通知 | public getNotificationGroups(): NotificationGroup[] {
const groups: Map<NotificationType, NotificationItem[]> = new Map();
// 按类型分组
this.notifications.forEach(notification => {
if (!groups.has(notification.type)) {
groups.set(notification.type, []);
}
groups.get(notification.type)... | AST#method_declaration#Left public getNotificationGroups AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NotificationGroup [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST... | public getNotificationGroups(): NotificationGroup[] {
const groups: Map<NotificationType, NotificationItem[]> = new Map();
this.notifications.forEach(notification => {
if (!groups.has(notification.type)) {
groups.set(notification.type, []);
}
groups.get(notification.type)!.push(n... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L162-L194 | 6b2a6002b8030557c95965bfeb1a0a3e4271e7cb | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets | arkts | KeyboardDialogBuilder | 弹窗布局构建器 | @Builder
KeyboardDialogBuilder() {
Column() {
// 显示输入的文本(可选,用于预览输入内容)
Row() {
Text(this.NickName || '请输入...')
.fontSize(18)
.padding(10)
.width('100%')
.backgroundColor('#FFFFFF')
.borderRadius(5)
}
.padding(10)
.width('100%')... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right KeyboardDialogBuilder 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 { // 显示输入... | @Builder
KeyboardDialogBuilder() {
Column() {
Row() {
Text(this.NickName || '请输入...')
.fontSize(18)
.padding(10)
.width('100%')
.backgroundColor('#FFFFFF')
.borderRadius(5)
}
.padding(10)
.width('100%')
EnglishK... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/EditInfoPage.ets#L320-L384 | cd9ccd6238ea96be10a83d17fd768af52af933af | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | getSendMethodLabel | 获取发送方式标签 | private getSendMethodLabel(method: NotificationMethod): string {
switch (method) {
case NotificationMethod.PUSH:
return '推送通知';
case NotificationMethod.SMS:
return '短信';
case NotificationMethod.EMAIL:
return '邮件';
default:
return '推送通知';
}
} | AST#method_declaration#Left private getSendMethodLabel AST#parameter_list#Left ( AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left NotificationMethod AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ... | private getSendMethodLabel(method: NotificationMethod): string {
switch (method) {
case NotificationMethod.PUSH:
return '推送通知';
case NotificationMethod.SMS:
return '短信';
case NotificationMethod.EMAIL:
return '邮件';
default:
return '推送通知';
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/greetings/GreetingSendPage.ets#L847-L858 | e5050e74e4f26887e1751824f67377562ec1eb8f | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | has | 检查键是否存在
@param key 键
@returns 是否存在 | async has(key: string): Promise<boolean> {
try {
this.checkInitialized();
return await this.dataPreferences!.has(key);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to check key existence: ${businessErro... | AST#method_declaration#Left async has 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#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AS... | async has(key: string): Promise<boolean> {
try {
this.checkInitialized();
return await this.dataPreferences!.has(key);
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to check key existence: ${businessErro... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L236-L245 | 6ae516e2a385b810dba2ec04a874bec88432e1b4 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/datastore/src/main/ets/datasource/account/AccountStoreDataSourceImpl.ets | arkts | 构造函数
@param {common.Context} context UIAbility 上下文 | constructor(context: common.Context) {
this.prefs = new PreferencesUtil(context, AccountStoreDataSourceImpl.PREFS_NAME);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s... | constructor(context: common.Context) {
this.prefs = new PreferencesUtil(context, AccountStoreDataSourceImpl.PREFS_NAME);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/account/AccountStoreDataSourceImpl.ets#L32-L34 | 3f1b0557e27dd7e68f9599f3b8153f87973cdda4 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/common/constantsCommon/src/main/ets/constants/RouterUrlConstants.ets | arkts | Routing information on the music page. | export class RouterUrlConstants {
/**
* Playback page.
*/
static readonly LIVE: string = 'LivePage';
/**
* Music list page.
*/
static readonly MUSIC_LIST: string = 'MusicListPage';
/**
* Music review page.
*/
static readonly MUSIC_COMMENT: string = 'MusicCommentPage';
} | AST#export_declaration#Left export AST#class_declaration#Left class RouterUrlConstants AST#class_body#Left { /**
* Playback page.
*/ AST#property_declaration#Left static readonly LIVE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Li... | export class RouterUrlConstants {
static readonly LIVE: string = 'LivePage';
static readonly MUSIC_LIST: string = 'MusicListPage';
static readonly MUSIC_COMMENT: string = 'MusicCommentPage';
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/common/constantsCommon/src/main/ets/constants/RouterUrlConstants.ets#L19-L34 | 9ee25d413fd337759ebb5141f390f92a42dbcdce | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets | arkts | getWifiIsConnected | 查询WLAN是否已连接是判断能否通过Wi-Fi 进行各种网络活动的直接方式。
@returns true,已连接。false,未连接 | getWifiIsConnected(): boolean {
try {
let ret = wifiManager.isConnected();
logger.info("isConnected:" + ret);
return ret;
} catch (error) {
logger.error("failed:" + JSON.stringify(error));
}
return false;
} | AST#method_declaration#Left getWifiIsConnected 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#statement#... | getWifiIsConnected(): boolean {
try {
let ret = wifiManager.isConnected();
logger.info("isConnected:" + ret);
return ret;
} catch (error) {
logger.error("failed:" + JSON.stringify(error));
}
return false;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L236-L245 | 0a1a84baddb1305a4fd23f2a437153d845f94a4d | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_gauge_contentModifier/ace_ets_module_gauge_contentModifier_api12/entry/src/main/ets/MainAbility/pages/component/GaugeContentModifier.ets | arkts | buildGaugeContentModifier | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
function buildGaugeContentModifier(config: GaugeConfiguration){
Column() {
Text(`value:${(config.contentModifier as MyGaugeContentModifier).value}`).id('GaugeContentModifier01')
Text(`min:${(config.contentModifier as MyGaugeContentModifier).min}`).id('GaugeContentModifier02')
Text(`max:${(config.... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildGaugeContentModifier AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left GaugeConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p... | @Builder
function buildGaugeContentModifier(config: GaugeConfiguration){
Column() {
Text(`value:${(config.contentModifier as MyGaugeContentModifier).value}`).id('GaugeContentModifier01')
Text(`min:${(config.contentModifier as MyGaugeContentModifier).min}`).id('GaugeContentModifier02')
Text(`max:${(config.... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_gauge_contentModifier/ace_ets_module_gauge_contentModifier_api12/entry/src/main/ets/MainAbility/pages/component/GaugeContentModifier.ets#L16-L38 | 6f4e657250bb11d34ca77251283121c8579b27b7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets | arkts | setOnCloseListener | TLS 关闭事件订阅
@param callback | setOnCloseListener(callback: () => void): void {
Logger.info(`${TAG} TLS setOnCloseListener into`);
this.tlsSocket?.on('close', () => {
Logger.info(`${TAG} TLS setOnCloseListener onClose:`);
callback();
this.closeSocket();
});
this.tlsSocket?.on('error', (data) => {
Logger.info(... | AST#method_declaration#Left setOnCloseListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function... | setOnCloseListener(callback: () => void): void {
Logger.info(`${TAG} TLS setOnCloseListener into`);
this.tlsSocket?.on('close', () => {
Logger.info(`${TAG} TLS setOnCloseListener onClose:`);
callback();
this.closeSocket();
});
this.tlsSocket?.on('error', (data) => {
Logger.info(... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L234-L249 | 79fddd7d609fa831bd3525d707acbe2e58628c5b | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/goods/VHGoodsComponent.ets | arkts | VHCouponsDialog | 优惠卷弹窗 | @CustomDialog
export struct VHCouponsDialog {
controller: CustomDialogController
@State barList: string[] = ['可用优惠券', '不可用优惠券']
@Consume CouponsAvailable: VHCouponInfo[]
@Consume CouponsNotAvailable: VHNotAvailableCouponInfo[]
@Link Index: number
@Consume CouponsWebinarId: number
@State private illustrate... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct VHCouponsDialog 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#prope... | @CustomDialog
export struct VHCouponsDialog {
controller: CustomDialogController
@State barList: string[] = ['可用优惠券', '不可用优惠券']
@Consume CouponsAvailable: VHCouponInfo[]
@Consume CouponsNotAvailable: VHNotAvailableCouponInfo[]
@Link Index: number
@Consume CouponsWebinarId: number
@State private illustrate... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/goods/VHGoodsComponent.ets#L518-L536 | 58a8842afb3844a24e4c418984f48b83a98c52f7 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/pages/ChatListPage.ets | arkts | OptChatViewBuilder | 布局优化的列表item加载数据 | @Builder
OptChatViewBuilder(msg: ChatModel) {
// reusable component
if (this.reusable) {
ReusableOptLayoutChatView(new Message(msg))
.reuseId(REUSE_ID)
} else {
OptLayoutChatView(new Message(msg))
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right OptChatViewBuilder AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left ChatModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function... | @Builder
OptChatViewBuilder(msg: ChatModel) {
if (this.reusable) {
ReusableOptLayoutChatView(new Message(msg))
.reuseId(REUSE_ID)
} else {
OptLayoutChatView(new Message(msg))
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/pages/ChatListPage.ets#L73-L82 | 209c3d55bc64a8a5521622084d64951ecc4773ff | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.