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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets | arkts | removeSpecFromCart | 从购物车删除商品规格
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@returns {Promise<void>} Promise<void> | async removeSpecFromCart(goodsId: number, specId: number): Promise<void> {
const entity: CartEntity | undefined = this.findEntityByGoodsId(goodsId);
if (!entity) {
return;
}
const specs: CartGoodsSpec[] = this.parseSpecs(entity.specJson).filter((spec) => spec.id !== specId);
if (specs.length =... | AST#method_declaration#Left async removeSpecFromCart AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#p... | async removeSpecFromCart(goodsId: number, specId: number): Promise<void> {
const entity: CartEntity | undefined = this.findEntityByGoodsId(goodsId);
if (!entity) {
return;
}
const specs: CartGoodsSpec[] = this.parseSpecs(entity.specJson).filter((spec) => spec.id !== specId);
if (specs.length =... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L102-L114 | 8efe79c32ba946800621a715858e4e13a590177c | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Vibrator/Vibrator.ets | arkts | stop | 停止所有振动 | stop(): void {
vibrator.stopVibration();
} | AST#method_declaration#Left stop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST... | stop(): void {
vibrator.stopVibration();
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Vibrator/Vibrator.ets#L61-L63 | 875c28e1797f59cb665c95dfbba6abefb614ed47 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/social/SearchPage.ets | arkts | 搜索类型枚举 | export enum SearchType {
ALL = 'all',
POSTS = 'posts',
TOPICS = 'topics',
USERS = 'users'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SearchType AST#enum_body#Left { AST#enum_member#Left ALL = AST#expression#Left 'all' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left POSTS = AST#expression#Left 'posts' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left T... | export enum SearchType {
ALL = 'all',
POSTS = 'posts',
TOPICS = 'topics',
USERS = 'users'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L19-L24 | ee00ac48f5634af5f3a94d07dd213d9543af22de | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CardInfo.ets | arkts | Agency card task info | export default class CardInfo {
titleContent: string = '';
achievement: Resource = $r('app.string.empty');
} | AST#export_declaration#Left export default AST#class_declaration#Left class CardInfo AST#class_body#Left { AST#property_declaration#Left titleContent : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_decl... | export default class CardInfo {
titleContent: string = '';
achievement: Resource = $r('app.string.empty');
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CardInfo.ets#L19-L22 | b60c35d97523d075357fb735a5fc9f396f7b9bfe | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets | arkts | ============================================================ MARK: - 详情项枚举 | export enum DetailItem {
// Word = "Word", // 单词
WordChange = "WordChange", // 单词变形
Cigens = "Cigens", // 词根助记
SameRootDesc = "SameRootDesc", // 同根词
Examples = "Examples", // 例句
SynWords = "SynWords", // 同义词
AsynWords ... | AST#export_declaration#Left export AST#enum_declaration#Left enum DetailItem AST#enum_body#Left { // Word = "Word", // 单词 AST#enum_member#Left WordChange = AST#expression#Left "WordChange" AST#expression#Right AST#enum_member#Right , // 单词变形 AST#enum_member#Left Cigens = AST#expression#Left "Cigen... | export enum DetailItem {
WordChange = "WordChange",
Cigens = "Cigens",
SameRootDesc = "SameRootDesc",
Examples = "Examples",
SynWords = "SynWords",
AsynWords = "AsynWords",
UsedPhrase = "UsedPhrase",
En2En ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets#L17-L30 | 08edd65323db19d0d07ce9a4ea5647cde10fe059 | github | |
mhtcgr/ToDoList_For_Harmony.git | 356d4c9a507205f02870e970203022a380c8a2a1 | entry/src/main/ets/model/userModel.ets | arkts | getAllUsers | 获取所有用户 | getAllUsers(): User[] {
return this.userData;
} | AST#method_declaration#Left getAllUsers AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left User [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ... | getAllUsers(): User[] {
return this.userData;
} | https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/userModel.ets#L80-L82 | ce501ae120df46f469fc814bbbe76b627d893b13 | github |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | getPendingTaskCount | 获取等待中的任务数量 | public getPendingTaskCount(): number {
return this.taskQueue.length;
} | AST#method_declaration#Left public getPendingTaskCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#memb... | public getPendingTaskCount(): number {
return this.taskQueue.length;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L158-L160 | 770c9f503cb03524e59571e187b658a825967a63 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets | arkts | setOnMessageReceivedListener | 订阅消息
@param callback | setOnMessageReceivedListener(callback: (buffer: ArrayBuffer) => void): void {
if (!this.udpSocket) {
return;
}
this.udpSocket.on('message', (data) => {
Logger.info(`${TAG} TLS data: ` + JSON.stringify(data));
let buffer = data.message;
callback(buffer);
});
} | AST#method_declaration#Left setOnMessageReceivedListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Rig... | setOnMessageReceivedListener(callback: (buffer: ArrayBuffer) => void): void {
if (!this.udpSocket) {
return;
}
this.udpSocket.on('message', (data) => {
Logger.info(`${TAG} TLS data: ` + JSON.stringify(data));
let buffer = data.message;
callback(buffer);
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets#L94-L104 | fdf4fdfb29bb61fd8d35ed47b4bdf009294ce175 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/TaskManagement/ContinuousTask/entry/src/main/ets/model/ContinuousTaskModel.ets | arkts | startContinuousTask | start continuous task | startContinuousTask(): void {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: 'ohos.samples.continuoustask',
abilityName: 'ohos.samples.continuoustask.MainAbility',
}
],
actionType: wantAgent.OperationType.START_ABILITY,
requestCode: ... | AST#method_declaration#Left startContinuousTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left wantAge... | startContinuousTask(): void {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: 'ohos.samples.continuoustask',
abilityName: 'ohos.samples.continuoustask.MainAbility',
}
],
actionType: wantAgent.OperationType.START_ABILITY,
requestCode: ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/TaskManagement/ContinuousTask/entry/src/main/ets/model/ContinuousTaskModel.ets#L33-L62 | 6cf763385fa361ed313940861441f3e0d9acb870 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | SetAndLink | Called when a hyperlink is set.
@since 7
@deprecated since 10 | static SetAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> {
return AppStorage.setAndLink(propName, defaultValue)
} | AST#method_declaration#Left static SetAndLink AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#param... | static SetAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> {
return AppStorage.setAndLink(propName, defaultValue)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L69-L71 | ab9d23a02725d41fbe98bed306b0a4b5891ac675 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/router/AppRouter.ets | arkts | getStackDepth | 获取导航栈深度 | getStackDepth(): number {
return this.navigationStack.length;
} | AST#method_declaration#Left getStackDepth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression... | getStackDepth(): number {
return this.navigationStack.length;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L220-L222 | 8b992d35831f1f5baa1c9c6fde90ce608b42a70f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | showThumbText | 调用时间转换函数显示时间 | showThumbText(time: number): string {
return TimeUtils.msToHHMMSS(time);
} | AST#method_declaration#Left showThumbText AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | showThumbText(time: number): string {
return TimeUtils.msToHHMMSS(time);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L356-L358 | c3a6cae528912b5075ca46e16c4231901eeea2d4 | gitee |
Puiching-Memory/HOMOAPP_Q5.git | 53e36a21984de7bf41b6fafc840fde013236b9d2 | entry/src/main/ets/components/StatusCard.ets | arkts | StatusCard | 状态卡片组件
展示当前应用状态信息的自定义组件 | @Component
export struct StatusCard {
@Prop title: string = '';
@Prop status: string = '';
@Prop icon: Resource = $r('sys.symbol.info_circle');
@Prop statusColor: ResourceColor = '#5CD6FF';
@Prop showAction: boolean = false;
@Prop actionText: string = '查看详情';
onAction: () => void = () => {};
build() {... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct StatusCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation... | @Component
export struct StatusCard {
@Prop title: string = '';
@Prop status: string = '';
@Prop icon: Resource = $r('sys.symbol.info_circle');
@Prop statusColor: ResourceColor = '#5CD6FF';
@Prop showAction: boolean = false;
@Prop actionText: string = '查看详情';
onAction: () => void = () => {};
build() {... | https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/StatusCard.ets#L7-L59 | c2b212bb0ab1b2b52e15a210ccd701a535e6a10c | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/CountDownTimerView.ets | arkts | aboutToDisappear | ========== 生命周期清理 ========== | aboutToDisappear() {
if (this.timerId !== undefined) {
clearInterval(this.timerId)
this.timerId = undefined
}
} | AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#... | aboutToDisappear() {
if (this.timerId !== undefined) {
clearInterval(this.timerId)
this.timerId = undefined
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/CountDownTimerView.ets#L55-L60 | 18bb516682a67aa5c7fed12fc9c00208c2c4750c | github |
dcm23333/FishManager.git | 952dde4475268ac16f3480f3d55f82033aa6b467 | FishManager/entry/src/main/ets/common/contants/commonContants.ets | arkts | ‘3.3%’ | export const THOUSANDTH_50: string = '5%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_50 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '5%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat... | export const THOUSANDTH_50: string = '5%'; | https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L49-L49 | 517ea05a7f422964195c6d30e86cce0d53543830 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/MultiColumnDisplayPage.ets | arkts | aboutToReuse | 从复用缓存中加入到组件树之前调用,可在此处更新组件的状态变量以展示正确的内容 | aboutToReuse(params: Record<string, ProductInfo>) {
this.listData = params.listData as ProductInfo;
} | AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotatio... | aboutToReuse(params: Record<string, ProductInfo>) {
this.listData = params.listData as ProductInfo;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/src/main/ets/components/MultiColumnDisplayPage.ets#L187-L189 | 3f7213341035ac5ebcc51a49b8232f158a449e75 | gitee |
makoki13/bikepacking_planner_ArkTS.git | de0c1c96961fa42ed2031d20dca0dfa64b731f74 | entry/src/main/ets/data/Recolector.ets | arkts | getListaProyectos | Aquí iría la lógica real con base de datos | getListaProyectos(): ListaProyectos {
return [{ id: 99, nombre: "SQLite Project", fechaInicio: null, actual: false }];
} | AST#method_declaration#Left getListaProyectos AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ListaProyectos AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array... | getListaProyectos(): ListaProyectos {
return [{ id: 99, nombre: "SQLite Project", fechaInicio: null, actual: false }];
} | https://github.com/makoki13/bikepacking_planner_ArkTS.git/blob/de0c1c96961fa42ed2031d20dca0dfa64b731f74/entry/src/main/ets/data/Recolector.ets#L107-L109 | 04b25378811f6bc2d1c994b2bde8b62c096bff2a | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/XAxis.ets | arkts | getLabelRotationAngle | returns the angle for drawing the X axis labels (in degrees) | public getLabelRotationAngle(): number {
return this.mLabelRotationAngle;
} | AST#method_declaration#Left public getLabelRotationAngle AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#me... | public getLabelRotationAngle(): number {
return this.mLabelRotationAngle;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L119-L121 | 6e673dd10acfe222370cb12ac270cd5cdc2802b8 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets | arkts | getHighlightCircleStrokeColor | Returns the stroke color for highlight circle. If Utils.COLOR_NONE, the color of the dataset is taken. @Override | public getHighlightCircleStrokeColor(): number {
return this.mHighlightCircleStrokeColor;
} | AST#method_declaration#Left public getHighlightCircleStrokeColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Lef... | public getHighlightCircleStrokeColor(): number {
return this.mHighlightCircleStrokeColor;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets#L66-L68 | 3ad11cba092ffacea36d1c78d14d37efb1fc2c0f | gitee |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/card/components/publicComp/pageHeader.ets | arkts | 页面的头部 | @Builder export default function pageHeader (obj: obj) {
Row() {
Column() {
Image($r('app.media.detail_back_icon')).width(26)
}
.width(60)
.height(60)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
obj.leftCallBack ? obj.leftCallBack() : router.back()
})
Co... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expre... | @Builder export default function pageHeader (obj: obj) {
Row() {
Column() {
Image($r('app.media.detail_back_icon')).width(26)
}
.width(60)
.height(60)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
obj.leftCallBack ? obj.leftCallBack() : router.back()
})
Co... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/components/publicComp/pageHeader.ets#L10-L38 | f534d895a9b74bce15338fc358274eac9b06dcdc | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/arkts/@arkts.utils.d.ets | arkts | queryAll | Query information about all locks.
@returns { AsyncLockState[] } Returns an array of AsyncLockState.
@static
@syscap SystemCapability.Utils.Lang
@atomicservice
@since 12 | static queryAll(): AsyncLockState[]; | AST#method_declaration#Left static queryAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AsyncLockState [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static queryAll(): AsyncLockState[]; | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.utils.d.ets#L100-L100 | 87059fb56d5220bf4c4fe470562207025071f6cf | github |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | 当窗口舞台创建时 | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
// 指定加载哪个页面
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x000... | AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.... | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/entryability/EntryAbility.ets#L32-L43 | d40ec0c55fdcce9c738a71eda61ebda603b43239 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/FeedbackRepository.ets | arkts | @file 意见反馈仓库,封装反馈相关请求
@author Joker.X | export class FeedbackRepository {
/**
* 反馈网络数据源
*/
private networkDataSource: FeedbackNetworkDataSource;
/**
* 构造函数
* @param networkDataSource 反馈网络数据源
*/
constructor(networkDataSource?: FeedbackNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new FeedbackNetworkDataSourceIm... | AST#export_declaration#Left export AST#class_declaration#Left class FeedbackRepository AST#class_body#Left { /**
* 反馈网络数据源
*/ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left FeedbackNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#pr... | export class FeedbackRepository {
private networkDataSource: FeedbackNetworkDataSource;
constructor(networkDataSource?: FeedbackNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new FeedbackNetworkDataSourceImpl();
}
async submitFeedback(params: FeedbackSubmitRequest): Promise<Ne... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FeedbackRepository.ets#L8-L39 | 3b23763704f5ebe9fab204f7234eaac9dcc10e3d | github | |
wenqi1/MallHomepage.git | a09765bee60b214f73b875570f8721a004d0bc3b | entry/src/main/ets/components/CommodityShowList.ets | arkts | CommodityShowList | 商品展示 | @Component
export default struct CommodityShowList {
@Link commodities: Commodity[];
@Builder CommodityShow(commodity: Commodity) {
Column() {
Image($rawfile(commodity.images[0]))
.height(MainPageConstants.VP_120)
.width(MainPageConstants.VP_120)
.margin({top: MainPageConstants.VP... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CommodityShowList AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right commodities : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Commodit... | @Component
export default struct CommodityShowList {
@Link commodities: Commodity[];
@Builder CommodityShow(commodity: Commodity) {
Column() {
Image($rawfile(commodity.images[0]))
.height(MainPageConstants.VP_120)
.width(MainPageConstants.VP_120)
.margin({top: MainPageConstants.VP... | https://github.com/wenqi1/MallHomepage.git/blob/a09765bee60b214f73b875570f8721a004d0bc3b/entry/src/main/ets/components/CommodityShowList.ets#L7-L53 | d6c1d1654a65f3866dd8bcc055ba3e750b922391 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets | arkts | queryData | 通用查询
@param tableName 表名
@param limit 最大查询数量
@param lastId 上一次查询id
@param callback 业务逻辑 | async queryData(tableName: string, limit: number, lastId: number, callback: (result: relationalStore.ResultSet) => Promise<void>): Promise<void> {
if (store === undefined) {
return;
}
const querySql: string = util.format(Constants.QUERY_TABLE_SQL_TEMPLATE, tableName, lastId, limit);
try {
co... | AST#method_declaration#Left async queryData 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 limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | async queryData(tableName: string, limit: number, lastId: number, callback: (result: relationalStore.ResultSet) => Promise<void>): Promise<void> {
if (store === undefined) {
return;
}
const querySql: string = util.format(Constants.QUERY_TABLE_SQL_TEMPLATE, tableName, lastId, limit);
try {
co... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L172-L184 | edea85dfa10c63e2a5c6b25a32366562e3fa4603 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/ImageAnimator/entry/src/main/ets/pages/example/ImageAnimatorExample011.ets | arkts | 定义要测试的属性以及类型 | export interface TestAttributes {
iterations?: number;
fillMode?: FillMode;
fixedSize?: boolean;
reverse?: boolean;
duration?: number;
state?: AnimationStatus;
images?: Array<ImageFrameInfo>;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TestAttributes AST#object_type#Left { AST#type_member#Left iterations ? : 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 fillMode ? : AST#type_... | export interface TestAttributes {
iterations?: number;
fillMode?: FillMode;
fixedSize?: boolean;
reverse?: boolean;
duration?: number;
state?: AnimationStatus;
images?: Array<ImageFrameInfo>;
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/ImageAnimator/entry/src/main/ets/pages/example/ImageAnimatorExample011.ets#L25-L33 | bcdaedf3b12315bef57e9963fe1ef22ec0f47f7b | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets | arkts | setDrawZeroLine | Set this to true to draw the zero-line regardless of weather other
grid-lines are enabled or not. Default: false
@param mDrawZeroLine | public setDrawZeroLine(mDrawZeroLine: boolean): void {
this.mDrawZeroLine = mDrawZeroLine;
} | AST#method_declaration#Left public setDrawZeroLine AST#parameter_list#Left ( AST#parameter#Left mDrawZeroLine : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST... | public setDrawZeroLine(mDrawZeroLine: boolean): void {
this.mDrawZeroLine = mDrawZeroLine;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L313-L315 | 429952fe93293f4736f20b9c99b8f6c49850c6bf | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/AxisRenderer.ets | arkts | getTransformer | Returns the Transformer object used for transforming the axis values.
@return | public getTransformer(): Transformer {
return this.mTrans;
} | AST#method_declaration#Left public getTransformer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Transformer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#memb... | public getTransformer(): Transformer {
return this.mTrans;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/AxisRenderer.ets#L113-L115 | 0b20cfc04644685416c9e3cd61043ae01d662827 | gitee |
2763981847/Klotski.git | 35bfb313c07e25ea53d2f4e66df0c441dd51675b | entry/src/main/ets/common/util/IOUtils.ets | arkts | 用于文件操作
IO工具类 | export default class IOUtils {
// 创建一个 PhotoViewPicker 实例,用于从相册选择照片
private static photoPicker = new picker.PhotoViewPicker();
/**
* 从resource中取出pixelMap
* @param resource 指定资源
* @returns pixelMap
*/
public static async getPixelMapFromResource(resource: Resource): Promise<image.PixelMap> {
// 通... | AST#export_declaration#Left export default AST#class_declaration#Left class IOUtils AST#class_body#Left { // 创建一个 PhotoViewPicker 实例,用于从相册选择照片 AST#property_declaration#Left private static photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#ne... | export default class IOUtils {
private static photoPicker = new picker.PhotoViewPicker();
public static async getPixelMapFromResource(resource: Resource): Promise<image.PixelMap> {
const array = await getContext().resourceManager.getMediaContent(resource);
return await image.createImageSou... | https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/IOUtils.ets#L9-L64 | 77673e1cad2c1ef9fe4f3ffa968a03fd60f03c74 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/navigation/src/main/ets/market/MarketNavigator.ets | arkts | toCoupon | 跳转到优惠券页面
@returns {void} 无返回值 | static toCoupon(): void {
navigateTo(MarketRoutes.Coupon);
} | AST#method_declaration#Left static toCoupon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expr... | static toCoupon(): void {
navigateTo(MarketRoutes.Coupon);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/market/MarketNavigator.ets#L13-L15 | b15281c1fd23fa150f937cfcefa9ab557ee9c1d3 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/view/GoodsDetailPage.ets | arkts | onScrollChanged | 列表滚动距离回调
@param {number} scrollOffset - 当前滚动距离
@returns {void} 无返回值 | private onScrollChanged(scrollOffset: number): void {
const offset = this.listScroller.currentOffset();
if (offset) {
this.vm.updateTopBarAlpha(scrollOffset, offset.yOffset);
} else {
this.vm.updateTopBarAlpha(scrollOffset);
}
} | AST#method_declaration#Left private onScrollChanged AST#parameter_list#Left ( AST#parameter#Left scrollOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#... | private onScrollChanged(scrollOffset: number): void {
const offset = this.listScroller.currentOffset();
if (offset) {
this.vm.updateTopBarAlpha(scrollOffset, offset.yOffset);
} else {
this.vm.updateTopBarAlpha(scrollOffset);
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsDetailPage.ets#L239-L246 | 5ba8e078a64bfeaa47e3ad264c11225eb3a57164 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ListBeExchange/ListExchange/Index.ets | arkts | ListExchangeView | 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 { ListExchangeView } from './src/main/ets/FeatureComponent' | AST#export_declaration#Left export { ListExchangeView } from './src/main/ets/FeatureComponent' AST#export_declaration#Right | export { ListExchangeView } from './src/main/ets/FeatureComponent' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ListBeExchange/ListExchange/Index.ets#L16-L16 | be176c19631f4e3bc3d457be7338e6e5f11270c8 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ResUtil.ets | arkts | getMediaBase64ByNameSync | 获取指定资源名称对应的图片资源Base64编码/获取指定资源名称对应的默认或指定的屏幕密度图片资源Base64编码
@param resName 资源名称。
@param density 资源获取需要的屏幕密度,0或缺省表示默认屏幕密度。
@returns | static getMediaBase64ByNameSync(resName: string, density?: number): string {
if (density !== undefined) {
return ResUtil.getResourceManager().getMediaBase64ByNameSync(resName, density);
} else {
return ResUtil.getResourceManager().getMediaBase64ByNameSync(resName);
}
} | AST#method_declaration#Left static getMediaBase64ByNameSync AST#parameter_list#Left ( AST#parameter#Left resName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left density ? : AST#type_annotation#Left AST#primary_type#Left nu... | static getMediaBase64ByNameSync(resName: string, density?: number): string {
if (density !== undefined) {
return ResUtil.getResourceManager().getMediaBase64ByNameSync(resName, density);
} else {
return ResUtil.getResourceManager().getMediaBase64ByNameSync(resName);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L400-L406 | ed6cdca32b3c5feacfbfc0226e2dc60cfff595ca | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ImperativeDynamicLayouts/casesfeature/imperativedynamiclayouts/src/main/ets/view/ImperativeView.ets | arkts | frameNodeFactory | 自定义DSL解析逻辑,将UI描述数据解析为组件
@param vm
@param context
@returns | function frameNodeFactory(vm: VM, context: UIContext): FrameNode | null {
if (vm.type === 'Column') {
let node = typeNode.createNode(context, 'Column');
setColumnNodeAttr(node, vm.css);
vm.children?.forEach(kid => {
let child = frameNodeFactory(kid, context);
node.appendChild(child);
});
... | AST#function_declaration#Left function frameNodeFactory AST#parameter_list#Left ( AST#parameter#Left vm : AST#type_annotation#Left AST#primary_type#Left VM AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#pri... | function frameNodeFactory(vm: VM, context: UIContext): FrameNode | null {
if (vm.type === 'Column') {
let node = typeNode.createNode(context, 'Column');
setColumnNodeAttr(node, vm.css);
vm.children?.forEach(kid => {
let child = frameNodeFactory(kid, context);
node.appendChild(child);
});
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImperativeDynamicLayouts/casesfeature/imperativedynamiclayouts/src/main/ets/view/ImperativeView.ets#L40-L102 | c0fcd25bb63ee6a559f6908b3d6c9987326193c0 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | getSupportedYearRange | 检查系统支持的年份范围 | static getSupportedYearRange(): YearRange {
return ComprehensiveLunarDatabase.getSupportedYearRange();
} | AST#method_declaration#Left static getSupportedYearRange AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left YearRange AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST... | static getSupportedYearRange(): YearRange {
return ComprehensiveLunarDatabase.getSupportedYearRange();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L524-L526 | dfbfdc7647c522d4e915c7ce11390ac19012a04c | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/common/Const.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export const GET_UP: string = '早起'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left GET_UP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '早起' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Rig... | export const GET_UP: string = '早起'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/EfficiencyEnhancementKit/SuperVisualSample/entry/src/main/ets/common/Const.ets#L16-L16 | 28aa5437dec4547ccf218574c63d43b0258a00ae | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widget/pages/WidgetCalendar.ets | arkts | getCalendarWeeks | 获取日历周数据 | private getCalendarWeeks(): number[][] {
const weeks: number[][] = [];
const daysInMonth = new Date(this.currentYear, this.currentMonth, 0).getDate();
const firstDayWeekday = new Date(this.currentYear, this.currentMonth - 1, 1).getDay();
let day = 1;
for (let week = 0; week < 6; week++) {
co... | AST#method_declaration#Left private getCalendarWeeks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_d... | private getCalendarWeeks(): number[][] {
const weeks: number[][] = [];
const daysInMonth = new Date(this.currentYear, this.currentMonth, 0).getDate();
const firstDayWeekday = new Date(this.currentYear, this.currentMonth - 1, 1).getDay();
let day = 1;
for (let week = 0; week < 6; week++) {
co... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widget/pages/WidgetCalendar.ets#L128-L157 | 32e2f4ba9f812375ffd77f9bccf43bd931e9ae38 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/LLMConfigManager.ets | arkts | loadConfigs | 加载配置 | private async loadConfigs(): Promise<void> {
try {
this.configs = await StorageUtils.getObject<LLMConfig[]>(this.STORAGE_KEY, []);
hilog.info(0x0000, 'LLMConfigManager', 'Configs loaded: %{public}d items', this.configs.length);
} catch (error) {
hilog.error(0x0000, 'LLMConfigManager', 'Failed ... | AST#method_declaration#Left private async loadConfigs 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#t... | private async loadConfigs(): Promise<void> {
try {
this.configs = await StorageUtils.getObject<LLMConfig[]>(this.STORAGE_KEY, []);
hilog.info(0x0000, 'LLMConfigManager', 'Configs loaded: %{public}d items', this.configs.length);
} catch (error) {
hilog.error(0x0000, 'LLMConfigManager', 'Failed ... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L78-L86 | 3d6b61fb06fb6cf155fc7ba61cc5be3145d97504 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets | arkts | notifyDataAdd | 通知LazyForEach组件需要在index对应索引处添加子组件 | notifyDataAdd(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataAdd(index);
})
} | AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | notifyDataAdd(index: number): void {
this.listeners.forEach((listener: DataChangeListener) => {
listener.onDataAdd(index);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/BasicDataSource.ets#L54-L58 | eba4e0de1c96bc337f28d99c2549bac37cc973ef | gitee |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/viewmodel/ShotCutCardData.ets | arkts | 安防 | export const HOME_CARD_SAFETY_TYPE = "1"
// 对讲 | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HOME_CARD_SAFETY_TYPE = AST#expression#Left "1" AST#expression#Right AST#variable_declarator#Right // 对讲 AST#variable_declaration#Right AST#export_declaration#Right | export const HOME_CARD_SAFETY_TYPE = "1" | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/viewmodel/ShotCutCardData.ets#L98-L100 | 9404782015c449a6866931b62615333861419033 | github | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/arkts/@arkts.utils.d.ets | arkts | lockAsync | Perform an operation with the acquired lock.
The method acquires the lock first, then calls the callback, and then releases the lock.
The callback is called asynchronously in the same thread where lockAsync was called.
@param { AsyncLockCallback<T> } callback - function to call when the lock gets acquired.
@param { As... | lockAsync<T>(callback: AsyncLockCallback<T>, mode: AsyncLockMode): Promise<T>; | AST#method_declaration#Left lockAsync AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AsyncLockCallback AST#type_arguments#Left < AST#typ... | lockAsync<T>(callback: AsyncLockCallback<T>, mode: AsyncLockMode): Promise<T>; | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/arkts/@arkts.utils.d.ets#L131-L131 | 3b1cb8969117949b77f5742096b1877ccd5d9f1d | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onPlayerViewInitCompleted | onPageShow(): void { if(this.playerState == VHPlayerState.VH_PLAYER_PAUSE){ this.vodPlayer?.resumePlay(); } } onPageHide(): void { if(this.playerState == VHPlayerState.VH_PLAYER_PLAYING){ this.vodPlayer?.pausePlay(); } } | onPlayerViewInitCompleted() {
if(this.webinars?.record?.preview_paas_record_id != undefined && this.webinars?.record?.preview_paas_record_id.length > 0){
this.vodPlayer?.startPlayWithRecordId(this.webinars?.record?.preview_paas_record_id,this.player_config?.default_definition!);
}else{
this.vodPlaye... | AST#method_declaration#Left onPlayerViewInitCompleted AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_... | onPlayerViewInitCompleted() {
if(this.webinars?.record?.preview_paas_record_id != undefined && this.webinars?.record?.preview_paas_record_id.length > 0){
this.vodPlayer?.startPlayWithRecordId(this.webinars?.record?.preview_paas_record_id,this.player_config?.default_definition!);
}else{
this.vodPlaye... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L184-L192 | 8ec1f77576f05c4b7848b9a9b4038369e3ef41f0 | gitee |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | entry/src/main/ets/view/PermissionDialog.ets | arkts | PermissionDialog | 跳转系统设置之前,需要先弹窗 | @CustomDialog
export struct PermissionDialog {
private title: string = '权限设置'
private subtitle?: Resource | string
private left: string = '取消'
private right: string = '去设置'
private permissions = new Array<Permissions>()
private message = ''
private context = getContext(this) as common.UIAbilityContext
... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct PermissionDialog AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left ... | @CustomDialog
export struct PermissionDialog {
private title: string = '权限设置'
private subtitle?: Resource | string
private left: string = '取消'
private right: string = '去设置'
private permissions = new Array<Permissions>()
private message = ''
private context = getContext(this) as common.UIAbilityContext
... | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/view/PermissionDialog.ets#L10-L27 | 2560634f908eaf911dde9097aee880d78afee8e7 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | Initializes things needed for an extra window.
Should be executed in HomeAbility.ets on each launch of entire app. | export function meow_init_sub(_context: common.UIAbilityContext, storage: LocalStorage) {
let t0 = Date.now();
let t = 0;
tabs(storage);
t = Date.now() - t0;
console.log('[Meow][init] SUB OK. (' + t + ' ms)');
} | AST#export_declaration#Left export AST#function_declaration#Left function meow_init_sub 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#p... | export function meow_init_sub(_context: common.UIAbilityContext, storage: LocalStorage) {
let t0 = Date.now();
let t = 0;
tabs(storage);
t = Date.now() - t0;
console.log('[Meow][init] SUB OK. (' + t + ' ms)');
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L71-L79 | b00c99aab06af7fe8335e46a68efd7926b9ee732 | gitee | |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/ImageKnife.ets | arkts | serHeaderOptions | 全局设置请求头header
@param options 请求头数组 | serHeaderOptions(options: Array<HeaderOptions>) {
options.forEach((value) => {
this.headerMap.set(value.key, value.value)
})
} | AST#method_declaration#Left serHeaderOptions AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left HeaderOptions AST#primary_type#Right AST#type_annotation#Right > AST#typ... | serHeaderOptions(options: Array<HeaderOptions>) {
options.forEach((value) => {
this.headerMap.set(value.key, value.value)
})
} | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L106-L110 | ffcaf92caca9e78bf3d5b7189017db24ee55a498 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets | arkts | yearMonthTitle | 年月信息标题。月视图和周视图显示年月信息,年视图只显示年信息。周视图中如果选中了日期,则优先根据选中日期显示年月信息。 | @Builder
yearMonthTitle() {
Row() {
Text(`${this.currentShowYear}年 ${this.tabSelectedIndex === CalendarViewType.YEAR ? '' :
MONTHS[this.currentShowMonth-1]}`)
.fontSize(FONT_SIZE * TEXT_SCALING)
.fontWeight(FONT_WEIGHT_FIVE_HUNDRED)
// 自定义添加日程组件
// monthViewController: ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right yearMonthTitle 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
yearMonthTitle() {
Row() {
Text(`${this.currentShowYear}年 ${this.tabSelectedIndex === CalendarViewType.YEAR ? '' :
MONTHS[this.currentShowMonth-1]}`)
.fontSize(FONT_SIZE * TEXT_SCALING)
.fontWeight(FONT_WEIGHT_FIVE_HUNDRED)
SchedulePoint({
mo... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets#L178-L197 | 993bacba5e0941b1c61870c52e0a57120d22c748 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/DMChannel.ets | arkts | get | 实现TextBasedChannel接口要求的方法 | get lastPinAt(): Date | null {
return this.lastPinTimestamp ? new Date(this.lastPinTimestamp) : null;
} | AST#method_declaration#Left get AST#ERROR#Left l as tP in At AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#... | get lastPinAt(): Date | null {
return this.lastPinTimestamp ? new Date(this.lastPinTimestamp) : null;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/DMChannel.ets#L43-L45 | ca51468e8ea25948fcef2730b6be1b99aa6c3a1f | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/data/CollectionCategory.ets | arkts | The component collection classifies the data as a whole | export const COLLECTION_CATEGORIES: FirstLevelCategory[] =
[
{
childNodes: COMPONENT_CATEGORIES,
selectedImage: $r('app.media.ic_select_component'),
unselectedImage: $r('app.media.ic_unselect_component'),
tabBarName: $r('app.string.component')
},
{
childNodes: UNIVERSAL_CATEG... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COLLECTION_CATEGORIES : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FirstLevelCategory [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_lite... | export const COLLECTION_CATEGORIES: FirstLevelCategory[] =
[
{
childNodes: COMPONENT_CATEGORIES,
selectedImage: $r('app.media.ic_select_component'),
unselectedImage: $r('app.media.ic_unselect_component'),
tabBarName: $r('app.string.component')
},
{
childNodes: UNIVERSAL_CATEG... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/data/CollectionCategory.ets#L23-L49 | f3ce0dc742f90b65389717f2551bf087e69ff5f7 | gitee | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/CaesarCipher.ets | arkts | encrypt | 加密文本
@param text 要加密的文本
@param shift 偏移量
@returns 加密后的文本 | static encrypt(text: string, shift: number): string {
if (!text) {
return '';
}
const normalizedShift = ((shift % 26) + 26) % 26; // 确保偏移量在0-25之间
let result = '';
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (char >= 'A' && char <= 'Z') {
// 大写字母
... | AST#method_declaration#Left static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left shift : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri... | static encrypt(text: string, shift: number): string {
if (!text) {
return '';
}
const normalizedShift = ((shift % 26) + 26) % 26;
let result = '';
for (let i = 0; i < text.length; i++) {
const char = text[i];
if (char >= 'A' && char <= 'Z') {
result += String.fr... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/CaesarCipher.ets#L12-L35 | 889dc4940e80e89572353d5067a400feeb204643 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/index/DialogPage.ets | arkts | textInputDialog | 单行文本输入弹出框 | textInputDialog(index: number) {
if (index == 0) {
//简单使用
DialogHelper.showTextInputDialog({
autoCancel: false,
backCancel: false,
actionCancel: false,
text: this.inputText,
onAction: (action, dialogId, content) => {
if (action == DialogAction.SURE) {
... | AST#method_declaration#Left textInputDialog AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_state... | textInputDialog(index: number) {
if (index == 0) {
DialogHelper.showTextInputDialog({
autoCancel: false,
backCancel: false,
actionCancel: false,
text: this.inputText,
onAction: (action, dialogId, content) => {
if (action == DialogAction.SURE) {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L461-L543 | a31cac7d9690744f4c555213240b068c3d6dd708 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/dynamic_tracing/reflect_call/reflect_call_001_T.ets | arkts | Introduction 动态方法调用-反射 | export function reflect_call_001_T(taint_src : string) {
class A {
data: string = taint_src;
}
let a = new A();
taint.Sink(Reflect.get(a,"data"));
} | AST#export_declaration#Left export AST#function_declaration#Left function reflect_call_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function reflect_call_001_T(taint_src : string) {
class A {
data: string = taint_src;
}
let a = new A();
taint.Sink(Reflect.get(a,"data"));
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/dynamic_tracing/reflect_call/reflect_call_001_T.ets#L6-L12 | 555c535f730b9cacf4866177a79c33cf251b2667 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/select/selectNormal.ets | arkts | SelectOptionMenuBuilder | 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 SelectOptionMenuBuilder(name: string, param: Object) {
SelectExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectOptionMenuBuilder 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#Le... | @Builder
export function SelectOptionMenuBuilder(name: string, param: Object) {
SelectExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/select/selectNormal.ets#L16-L19 | a4bbcb5bb07079a29a6fef8767e7c8df18af0d70 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/DemoCounterState.ets | arkts | increment | 计数加一(或自定义步长)
@param {number} step - 步长,默认 1
@returns {void} 无返回值
@example
getDemoCounterState().increment(); // +1 | increment(step: number = 1): void {
this.count += step;
} | AST#method_declaration#Left increment AST#parameter_list#Left ( AST#parameter#Left step : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | increment(step: number = 1): void {
this.count += step;
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/DemoCounterState.ets#L31-L33 | 6bf423f08bc97d02be0240fa9f10b19f9c1229d4 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/AboutPage.ets | arkts | AboutContent | 关于页面内容视图
@returns {void} 无返回值 | @Builder
private AboutContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
this.AboutHeader();
SpaceVerticalLarge();
this.AboutLinks();
};
};
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AboutContent 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#container_content... | @Builder
private AboutContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
this.AboutHeader();
SpaceVerticalLarge();
this.AboutLinks();
};
};
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/AboutPage.ets#L56-L65 | 178583f6906c7a890ddda77a86371ef12e9fb32b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getData | 获取数据并利用formProvider.updateForm更新到卡片 | async getData(formId: string) {
let detail: CASES[] = [];
let message = '';
try {
let value = await this.context.resourceManager.getRawFileContent('CasesData.txt');
console.log('decodeToStringdecodeToString')
message = util.TextDecoder.create().decodeToString(value);
detail = CaseCar... | AST#method_declaration#Left async getData AST#parameter_list#Left ( AST#parameter#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef... | async getData(formId: string) {
let detail: CASES[] = [];
let message = '';
try {
let value = await this.context.resourceManager.getRawFileContent('CasesData.txt');
console.log('decodeToStringdecodeToString')
message = util.TextDecoder.create().decodeToString(value);
detail = CaseCar... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/Widget/ArkTSCard/CardInteractionCase/entry/src/main/ets/entryformability/EntryFormAbility.ets#L29-L48 | 78f231102b902f5efafa65ba44e1f373ee77f82c | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ChipGroup.d.ets | arkts | Defines symbol item options.
@interface SymbolItemOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 14 | export interface SymbolItemOptions {
/**
* Set symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 14
*/
symbol: SymbolGlyphModifier;
/**
* Called when the symbol item is clicked.
*
* @type { ?Voi... | AST#export_declaration#Left export AST#interface_declaration#Left interface SymbolItemOptions AST#object_type#Left { /**
* Set symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 14
*/ AST#type_member#Left symbol : AST#type_... | export interface SymbolItemOptions {
symbol: SymbolGlyphModifier;
action: VoidCallback;
accessibilityText?: ResourceStr;
accessibilityDescription?: ResourceStr;
accessibilityLevel?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L462-L517 | 61e29e122ff3fe5500b0f3772eb394d18789d21c | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/AlertDialogUtil.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export function showAlertDialog(title: Resource | string, message: Resource | string, action: () => void) {
AlertDialog.show(
{
title: title,
message: message,
primaryButton: {
value: $r('app.string.cancel'),
action: () => {
}
},
secondaryButton: {
val... | AST#export_declaration#Left export AST#function_declaration#Left function showAlertDialog AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST... | export function showAlertDialog(title: Resource | string, message: Resource | string, action: () => void) {
AlertDialog.show(
{
title: title,
message: message,
primaryButton: {
value: $r('app.string.cancel'),
action: () => {
}
},
secondaryButton: {
val... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/AlertDialogUtil.ets#L16-L34 | f32bdef1869e9df7cb43027a5f6a8960167ce8bb | gitee | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | resumeDownload | 继续下载 | async resumeDownload(): Promise<void> {
let versionDigest: string = await VersionUtils.getNewVersionDigest();
this.setUpdateState(UpdateState.DOWNLOADING);
this.updateManager.resumeDownload(versionDigest, update.NetType.WIFI).then(result => {
this.log('resumeDownload result:' + JSON.stringify(result)... | AST#method_declaration#Left async resumeDownload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | async resumeDownload(): Promise<void> {
let versionDigest: string = await VersionUtils.getNewVersionDigest();
this.setUpdateState(UpdateState.DOWNLOADING);
this.updateManager.resumeDownload(versionDigest, update.NetType.WIFI).then(result => {
this.log('resumeDownload result:' + JSON.stringify(result)... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L190-L203 | d67d928d5bb9af7600a104668023c8a31438cb89 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | generateCryptoKey | 生成非对称密钥
@param symAlgName 秘钥规格
@returns 指定秘钥规格的非对称公私
@param resultCoding 生成非对称秘钥的编码方式(hex/base64) | static generateCryptoKey(symAlgName: string, resultCoding: buffer.BufferEncoding): CryptoKey {
// 创建非对称密钥生成器
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseKeyPair = rsaGenerator.generateKeyPairSync();
// 转换成可以读懂的公私钥字符串
let pubKey = StrAndUintUtil... | AST#method_declaration#Left static generateCryptoKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST... | static generateCryptoKey(symAlgName: string, resultCoding: buffer.BufferEncoding): CryptoKey {
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
let promiseKeyPair = rsaGenerator.generateKeyPairSync();
let pubKey = StrAndUintUtil.unitArray2StrCoding(promiseKeyPair.pubKey.getEncoded... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L134-L143 | f80838bf1b51ee73a12e0303d9da98b5393e80d1 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/tabs_actions.ets | arkts | Updates only current tabs status into LocalStorage.
Usually used after actions that doesn't modify the data but only changed current index.
For example, switching tabs.
@param storage The LocalStorage. | export function sync_current_tabs_list_info(storage: LocalStorage) {
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
let tab_titles = storage.get('tab_titles') as string[];
let tab_urls = storage.get('tab_urls') as string[];
let tab_is_loading = storage.get('tab_is_loading') as boolean[];
let tab_lo... | AST#export_declaration#Left export AST#function_declaration#Left function sync_current_tabs_list_info AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#blo... | export function sync_current_tabs_list_info(storage: LocalStorage) {
let tabs = storage.get('bunch_of_tabs') as bunch_of_tabs;
let tab_titles = storage.get('tab_titles') as string[];
let tab_urls = storage.get('tab_urls') as string[];
let tab_is_loading = storage.get('tab_is_loading') as boolean[];
let tab_lo... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L52-L71 | 8068f027ac234d9c089341266f6595af8c2f187f | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/backgroundblur/src/main/ets/model/TabInfo.ets | arkts | TabBar data type.
@param id
@param title TarBar name.
@param selectedIcon Selected image address.
@param defaultIcon Default image address. | export class TabInfo {
id: number;
title: string | ResourceStr;
selectedIcon: ResourceStr;
defaultIcon: ResourceStr;
tabContent: WrappedBuilder<ESObject>;
constructor(id: number, title: string | ResourceStr, selectedIcon: ResourceStr, defaultIcon: ResourceStr,
tabContent: WrappedBuilder<ESObject>) {
... | AST#export_declaration#Left export AST#class_declaration#Left class TabInfo 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 title : AST#type_anno... | export class TabInfo {
id: number;
title: string | ResourceStr;
selectedIcon: ResourceStr;
defaultIcon: ResourceStr;
tabContent: WrappedBuilder<ESObject>;
constructor(id: number, title: string | ResourceStr, selectedIcon: ResourceStr, defaultIcon: ResourceStr,
tabContent: WrappedBuilder<ESObject>) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/backgroundblur/src/main/ets/model/TabInfo.ets#L24-L39 | 2973231e39f160c66a5a61b298594a9cb66e99e3 | gitee | |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | getPixelMap | 获取控件截图
@returns | public getPixelMap(): image.PixelMap | undefined {
return SnapShotImage.pixelMap
} | AST#method_declaration#Left public getPixelMap AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#u... | public getPixelMap(): image.PixelMap | undefined {
return SnapShotImage.pixelMap
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L219-L221 | 9e2049da7b08c3a5bdb91eb804a7a934a1e3cb36 | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkUIExperience/entry/src/main/ets/common/bean/NftResponse.ets | arkts | 获取NFT请求状态响应类 | export default class NftResponse {
public success: boolean;
public message: string;
public errCode: string;
public result: NftResult;
constructor(success: boolean, message: string, errCode: string, result: NftResult) {
this.success = success;
this.message = message;
this.errCode = errCode;
th... | AST#export_declaration#Left export default AST#class_declaration#Left class NftResponse AST#class_body#Left { AST#property_declaration#Left public success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#L... | export default class NftResponse {
public success: boolean;
public message: string;
public errCode: string;
public result: NftResult;
constructor(success: boolean, message: string, errCode: string, result: NftResult) {
this.success = success;
this.message = message;
this.errCode = errCode;
th... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/common/bean/NftResponse.ets#L19-L31 | 9bc9e94199be4325c2a6b1d795861589d268e79e | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/myData/WordUser.ets | arkts | incrementTestResult | 增加测试结果 | incrementTestResult(result: number): void {
this.lastResultType = result;
if (result === SearchConstants.TEST_RESULT_CORRECT) {
this.correctedTimes++;
} else if (result === SearchConstants.TEST_RESULT_WRONG) {
this.wrangTimes++;
const now = new Date();
// this.wrangYear = now... | AST#method_declaration#Left incrementTestResult AST#parameter_list#Left ( AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty... | incrementTestResult(result: number): void {
this.lastResultType = result;
if (result === SearchConstants.TEST_RESULT_CORRECT) {
this.correctedTimes++;
} else if (result === SearchConstants.TEST_RESULT_WRONG) {
this.wrangTimes++;
const now = new Date();
thi... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUser.ets#L78-L91 | f0360c338e0da7e2a0a43b9a104a75937c4394b3 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/navigation/OrderListNav.ets | arkts | OrderListNav | @file 订单列表页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function OrderListNav(): void {
OrderListPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function OrderListNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_c... | @Builder
export function OrderListNav(): void {
OrderListPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/navigation/OrderListNav.ets#L8-L11 | b9e2ca74c388805a41767a003d362176401b7759 | github |
HomoArk/Homogram.git | 8a6e85898b6194fdd04ead75e732d348888a0c07 | features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets | arkts | onItemClicked | 图片/视频被选中回调,返回资源的信息,以及选中方式
ItemInfo 图片、视频相关信息
ClickType(SELECTED:勾选, DESELECTED: 反选)
return 返回值为true时才会给url授权(返回的uri权限是只读权限) | private onItemClicked(itemInfo: ItemInfo, clickType: ClickType): boolean {
if (!itemInfo) {
return false;
}
let type: ItemType | undefined = itemInfo.itemType;
let uri: string | undefined = itemInfo.uri;
if (type === ItemType.CAMERA) { // 点击相机item
console.info('onCameraClick');
if ... | AST#method_declaration#Left private onItemClicked AST#parameter_list#Left ( AST#parameter#Left itemInfo : AST#type_annotation#Left AST#primary_type#Left ItemInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left clickType : AST#type_annotation#Left AST#primary_type#Left ClickType... | private onItemClicked(itemInfo: ItemInfo, clickType: ClickType): boolean {
if (!itemInfo) {
return false;
}
let type: ItemType | undefined = itemInfo.itemType;
let uri: string | undefined = itemInfo.uri;
if (type === ItemType.CAMERA) {
console.info('onCameraClick');
if (this.isBlo... | https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets#L173-L209 | 9d46754b699108ddea9a3528bf90c6e335a1a5ac | github |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/pages/component/FiveDayMinuteKLineComponent.ets | arkts | drawMinuteLine | 绘制分钟线
拿出五条数据,循环绘制。
如何计算价格(Price)的Y轴坐标(PricePositionY)呢?
(MaxPrice - Price)/(MaxPrice-MinPrice) = (PricePositionY - RectStartY) / (RectEndY - RectStartY) 【等比例原理】
所以,(MaxPrice - Price)/(MaxPrice-MinPrice) = (PricePositionY - RectStartY) / RectHeight
PricePositionY = (MaxPrice - Price)/(MaxPrice-MinPrice) * RectHeight +... | drawMinuteLine() {
//----------绘制分钟线----------start---------
this.context.strokeStyle = '#364d92'
this.context.lineWidth = 0.8600009
//循环遍历每一天
if(this.fiveDayData == undefined || this.fiveDayData.fiveDayMinuteDataWrapper == undefined || this.fiveDayData.fiveDayMinuteDataWrapper.length <= 0) {
... | AST#method_declaration#Left drawMinuteLine AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { //----------绘制分钟线----------start--------- AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression... | drawMinuteLine() {
this.context.strokeStyle = '#364d92'
this.context.lineWidth = 0.8600009
if(this.fiveDayData == undefined || this.fiveDayData.fiveDayMinuteDataWrapper == undefined || this.fiveDayData.fiveDayMinuteDataWrapper.length <= 0) {
return
}
this.fiveDayData.fiveDayMinuteDat... | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/FiveDayMinuteKLineComponent.ets#L64-L114 | d00247804e1fd39127c560ef3b8fbe6eb8dcdd25 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/ScreenRecorder/entry/src/main/ets/pages/ScreenRecorder.ets | arkts | aboutToAppear | Page life cycle to load this page before the build | aboutToAppear(): void {
Logger.info(TAG, `aboutToAppear()`)
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression... | aboutToAppear(): void {
Logger.info(TAG, `aboutToAppear()`)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/ScreenRecorder/entry/src/main/ets/pages/ScreenRecorder.ets#L95-L97 | b016add065c719102e8299b8d347660f3eee7bf2 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | TODO RSA加解密
author: 桃花镇童长老ᥫ᭡
since: 2024/07/01 | export class RSA {
/**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param pubKey 指定加密公钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。
* @returns
*/
static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformat... | AST#export_declaration#Left export AST#class_declaration#Left class RSA AST#class_body#Left { /**
* 加密,异步
* @param data 加密或者解密的数据。data不能为null。
* @param pubKey 指定加密公钥。
* @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。
* @returns
*/ AST#method_declaration#Left s... | export class RSA {
static async encrypt(data: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): Promise<cryptoFramework.DataBlob> {
return CryptoUtil.encrypt(data, pubKey, null, transformation);
}
static encryptSync(data: cryptoFramework.D... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L26-L360 | 6dff8cb4c6b0b9000b3416576127894bfa278c94 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Prefetching.ets | arkts | resourceToString | [StartExclude on_page_end_triggers_preload_of_next_page] | function resourceToString(resource: Resource) {
return getContext().resourceManager.getStringSync(resource);
} | AST#function_declaration#Left function resourceToString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return... | function resourceToString(resource: Resource) {
return getContext().resourceManager.getStringSync(resource);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry2/src/main/ets/pages/Prefetching.ets#L18-L20 | df3bc7f818773e39911926b7204f4ee24272ead2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets | arkts | resetAVPlayer | 重置AVPlayer | async resetAVPlayer() : Promise<void> {
if (!this.avPlayer) {
return;
}
await this.avPlayer.reset();
} | AST#method_declaration#Left async resetAVPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar... | async resetAVPlayer() : Promise<void> {
if (!this.avPlayer) {
return;
}
await this.avPlayer.reset();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets#L55-L61 | 331be5bf4a88f9514cce3160d3b3fec4b2d86efc | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/SimpleAIService.ets | arkts | generatePersonalizedContent | 生成个性化内容 | private generatePersonalizedContent(contact: Contact, params: GenerationParams, seed: number): string {
const personalizations: string[] = [];
// 基于兴趣爱好的个性化
if (contact.interests && contact.interests.length > 0) {
const interest = contact.interests[seed % contact.interests.length];
personalizat... | AST#method_declaration#Left private generatePersonalizedContent 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 params : AST#type_annotation#Left AST#primary_type#Left ... | private generatePersonalizedContent(contact: Contact, params: GenerationParams, seed: number): string {
const personalizations: string[] = [];
if (contact.interests && contact.interests.length > 0) {
const interest = contact.interests[seed % contact.interests.length];
personalizations.push(`愿你... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L673-L706 | fece5052a9e738307f731def22c14f4ee6396589 | github |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/pages/学习/23.@Builder自定义构建函数.ets | arkts | navItem2 | 2. 局部builder | @Builder
navItem2(icon: ResourceStr, txt: string) {
Column({space: 10}) {
Image(icon)
.width('80%')
Text(txt)
}
.width('25%')
.onClick(() => {
AlertDialog.show({
message: '点了' + txt
})
})
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right navItem2 AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left txt : AST#type_annotation#Left AS... | @Builder
navItem2(icon: ResourceStr, txt: string) {
Column({space: 10}) {
Image(icon)
.width('80%')
Text(txt)
}
.width('25%')
.onClick(() => {
AlertDialog.show({
message: '点了' + txt
})
})
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/23.@Builder自定义构建函数.ets#L90-L103 | 64df736d26c27b99b136cfaca4be7dbf5fe3aeeb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/views/CubeRotateAnimationSamplePage.ets | arkts | mySwiperItem | 自定义3D立方体旋转轮播项内容 | @Builder
mySwiperItem(item: MySwiperItem) {
Stack({ alignContent: Alignment.TopStart }) {
Rect()
.width($r('app.string.cube_animation_full_size'))
.height($r('app.string.cube_animation_full_size'))
.fill($r('app.color.cube_animation_mask'))
.fillOpacity($r('app.float.cube_ani... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right mySwiperItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left MySwiperItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_b... | @Builder
mySwiperItem(item: MySwiperItem) {
Stack({ alignContent: Alignment.TopStart }) {
Rect()
.width($r('app.string.cube_animation_full_size'))
.height($r('app.string.cube_animation_full_size'))
.fill($r('app.color.cube_animation_mask'))
.fillOpacity($r('app.float.cube_ani... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/views/CubeRotateAnimationSamplePage.ets#L194-L228 | 11a03c157d7fd98e07c3be5c48fe2296d2c04e7a | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | library/common/src/main/ets/constants/KeyConst.ets | arkts | @author: HZWei
@date: 2024/12/22
@desc: | export class KeyConst {
public static readonly KEY_NAME: string = "key_name"
public static readonly KEY_AGE: string = "key_age"
public static readonly KEY_SCORE: string = "key_score"
public static readonly KEY_USER_INFO: string = "key_user_info"
} | AST#export_declaration#Left export AST#class_declaration#Left class KeyConst AST#class_body#Left { AST#property_declaration#Left public static readonly KEY_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "key_name" AST#expression#Right ... | export class KeyConst {
public static readonly KEY_NAME: string = "key_name"
public static readonly KEY_AGE: string = "key_age"
public static readonly KEY_SCORE: string = "key_score"
public static readonly KEY_USER_INFO: string = "key_user_info"
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/library/common/src/main/ets/constants/KeyConst.ets#L7-L12 | a1e2299c9738405c402d793879956f16b4fb3522 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 最近祝福接口 | export interface RecentGreeting {
id: string;
type: string;
content: string;
createdAt: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RecentGreeting AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left ... | export interface RecentGreeting {
id: string;
type: string;
content: string;
createdAt: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L80-L85 | d5bc3f6f8586db389a358746622182ce6f595197 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/auth/AuthService.ets | arkts | updateUserInfo | 更新用户信息 | async updateUserInfo(userInfo: Partial<UserInfo>): Promise<boolean> {
try {
if (this.currentUser) {
const updated: UserInfo = {
id: this.currentUser.id,
username: userInfo.username || this.currentUser.username,
email: userInfo.email !== undefined ? userInfo.email : this.c... | AST#method_declaration#Left async updateUserInfo AST#parameter_list#Left ( AST#parameter#Left userInfo : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left UserInfo AST#primary_type#Right AST#type_annotation#Right > AST#t... | async updateUserInfo(userInfo: Partial<UserInfo>): Promise<boolean> {
try {
if (this.currentUser) {
const updated: UserInfo = {
id: this.currentUser.id,
username: userInfo.username || this.currentUser.username,
email: userInfo.email !== undefined ? userInfo.email : this.c... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L229-L253 | a820d734493b8e0169a61ddadaca29ecc574ecd6 | github |
fengcreate/harmony-document | 798534b0f76399dc84e7940f5b14b3ae4e53c6a9 | BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets | arkts | querySourceUserForPage | Page wise query of data in the user table of the database.
@param context context.
@param pageSize pageSize.
@param offset total offset.
@return ValuesBucket[] Contains data queried from the database. | private async querySourceUserForPage(context: common.Context, pageSize: number, offset: number): Promise<ValuesBucket[]> {
let valuesBucketResults: ValuesBucket[] = [];
if (!await this.initSourceDb(context)) {
return valuesBucketResults;
}
let resultSet: relationalStore.ResultSet | undefined = un... | AST#method_declaration#Left private async querySourceUserForPage 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#Le... | private async querySourceUserForPage(context: common.Context, pageSize: number, offset: number): Promise<ValuesBucket[]> {
let valuesBucketResults: ValuesBucket[] = [];
if (!await this.initSourceDb(context)) {
return valuesBucketResults;
}
let resultSet: relationalStore.ResultSet | undefined = un... | https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/db/DbTransferManager.ets#L212-L240 | b05507a3385ec9152f2099c7b1585af11946e876 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/model/SearchConfig.ets | arkts | setKeyword | 替换 body 中的关键字 | setKeyword(keyword: string): void {
this.body = this.body.replace('{{key}}', encodeURIComponent(keyword));
} | AST#method_declaration#Left setKeyword AST#parameter_list#Left ( AST#parameter#Left keyword : 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... | setKeyword(keyword: string): void {
this.body = this.body.replace('{{key}}', encodeURIComponent(keyword));
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/model/SearchConfig.ets#L24-L26 | ae7c9c631c939b7bab19d2f2cbb1bf42f575c6e4 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets | arkts | setShadowWidth | Sets the width of the candle-shadow-line in pixels. Default 3f.
@param width | public setShadowWidth(width: number): void {
this.mShadowWidth = Utils.convertDpToPixel(width);
} | AST#method_declaration#Left public setShadowWidth AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | public setShadowWidth(width: number): void {
this.mShadowWidth = Utils.convertDpToPixel(width);
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleDataSet.ets#L169-L171 | c01d73fa24e101a32d1180fdd5ede888ad3d12eb | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | initUIRange | 初始化视频剪辑范围 | initUIRange() {
this.componentRect = [0, 0, this.componentMaxWidth, this.componentMaxHeight];
this.leftThumbRect = [0, 0, this.leftThumbWidth, this.componentMaxHeight];
this.leftThumbPosition = { x: this.leftThumbRect[0], y: this.leftThumbRect[1] };
this.leftTextPosition = { x: this.leftThumbRect[0], y... | AST#method_declaration#Left initUIRange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentRect AST#member_expression#Ri... | initUIRange() {
this.componentRect = [0, 0, this.componentMaxWidth, this.componentMaxHeight];
this.leftThumbRect = [0, 0, this.leftThumbWidth, this.componentMaxHeight];
this.leftThumbPosition = { x: this.leftThumbRect[0], y: this.leftThumbRect[1] };
this.leftTextPosition = { x: this.leftThumbRect[0], y... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets#L277-L321 | 4fc8c8d2f390cddc51137fcd35cc914b2e6cd7f6 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/constraint.ets | arkts | 2025/01/05 | export const DATE_FORMAT11: string = "yyyy年MM月dd日 HH时mm分ss秒fff毫秒"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT11 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy年MM月dd日 HH时mm分ss秒fff毫秒" AST#expression#Right AST#variable_declarator#Right... | export const DATE_FORMAT11: string = "yyyy年MM月dd日 HH时mm分ss秒fff毫秒"; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L24-L24 | a0faaf0ec2606263a1f147b4ce8d427dbd0a4b75 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.base.d.ets | arkts | Defines the error interface.
@syscap SystemCapability.Base
@crossplatform
@form
@atomicservice
@since 20 | export declare class BusinessError<T = void> extends Error {
/**
* A constructor used to create a BusinessError object
* @syscap SystemCapability.Base
* @crossplatform
* @form
* @atomicservice
* @since 20
*/
constructor();
/**
* A constructor used to create a BusinessError object
* @param { numb... | AST#export_declaration#Left export AST#ERROR#Left declare class BusinessError AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left ... | export declare class BusinessError<T = void> extends Error {
constructor();
constructor | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.base.d.ets#L64-L84 | 7eca6b66427c9e51a883709df81f3891f52eb0b4 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/pages/home/model/CategoricalDataType.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export interface FirstLevelCategory {
childNodes: SecondLevelCategory[] | ThirdLevelCategory[],
iconSelected: Resource, // The icon for the first-level category is selected
icon: Resource, // The icon for the first-level category is not selected
tabBarName: Resource // First-level category title
} | AST#export_declaration#Left export AST#interface_declaration#Left interface FirstLevelCategory AST#object_type#Left { AST#type_member#Left childNodes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left SecondLevelCategory [ ] AST#array_type#Right AST#primary_type#Right | AST#primary... | export interface FirstLevelCategory {
childNodes: SecondLevelCategory[] | ThirdLevelCategory[],
iconSelected: Resource,
icon: Resource,
tabBarName: Resource
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/pages/home/model/CategoricalDataType.ets#L16-L21 | 70db969d2fe585e4811b723e06d14f9b4868cf38 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | hasIntersection | Determine if two lines intersect.
@param line1
@param line2
@returns true means intersect, false means not intersect. | static hasIntersection(line1: LineSegment, line2: LineSegment): boolean {
let p1 = line1.start;
let p2 = line1.end;
let p3 = line2.start;
let p4 = line2.end;
if (Math.max(p1.x, p2.x) < Math.min(p3.x, p4.x) || Math.max(p1.y, p2.y) < Math.min(p3.y, p4.y)
|| Math.max(p3.x, p4.x) < Math.min(p1.x, ... | AST#method_declaration#Left static hasIntersection AST#parameter_list#Left ( AST#parameter#Left line1 : AST#type_annotation#Left AST#primary_type#Left LineSegment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left line2 : AST#type_annotation#Left AST#primary_type#Left LineSegment ... | static hasIntersection(line1: LineSegment, line2: LineSegment): boolean {
let p1 = line1.start;
let p2 = line1.end;
let p3 = line2.start;
let p4 = line2.end;
if (Math.max(p1.x, p2.x) < Math.min(p3.x, p4.x) || Math.max(p1.y, p2.y) < Math.min(p3.y, p4.y)
|| Math.max(p3.x, p4.x) < Math.min(p1.x, ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L152-L169 | b057045144185dbd4d61f6ebb2256574d4211ce2 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | getAmountDay | 获取前几天日期或后几天日期
@param date
@param amount 进行加减操作的具体数值。 | static getAmountDay(date: number | string | Date, amount: number): Date {
let relativeDate = DateUtil.getFormatDate(date);
relativeDate.setDate(relativeDate.getDate() + amount);
return relativeDate;
} | AST#method_declaration#Left static getAmountDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri... | static getAmountDay(date: number | string | Date, amount: number): Date {
let relativeDate = DateUtil.getFormatDate(date);
relativeDate.setDate(relativeDate.getDate() + amount);
return relativeDate;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L272-L276 | 3a1e60fb3eda20985b6f6146e05f0859f25f77ba | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | getBeforeDayStr | 获取前一天日期,返回字符串 | static getBeforeDayStr(date: number | string | Date, format: string = DATE_FORMAT4): string {
return DateUtil.getAmountDayStr(date, -1, format);
} | AST#method_declaration#Left static getBeforeDayStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type... | static getBeforeDayStr(date: number | string | Date, format: string = DATE_FORMAT4): string {
return DateUtil.getAmountDayStr(date, -1, format);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L297-L299 | ce593e8e87b76520ca44c96b9ae8e7ddda1853e9 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets | arkts | 文本消息 | export class TextMessage extends MessageBody {
constructor(msg: string | Resource) {
super();
this.msg = msg;
}
msg: string | Resource
} | AST#export_declaration#Left export AST#class_declaration#Left class TextMessage extends AST#type_annotation#Left AST#primary_type#Left MessageBody AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left msg : AST#ty... | export class TextMessage extends MessageBody {
constructor(msg: string | Resource) {
super();
this.msg = msg;
}
msg: string | Resource
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/MsgBase.ets#L82-L89 | 173e9dadb6745780a1f29475bce3b456bf61f08d | gitee | |
CMoments/HarmonOS-arkTS-YunShangChuanDa.git | 895985b9b6013c906bf88eaea6e32e03ddf2a9db | project code/entry/src/main/ets/pages/EvaluateIndexPage.ets | arkts | tabBar | 当前选中的tab是第几个 | @Builder
tabBar(item:TabModel){
Column(){
Image(this.tabModels[this.currentSelect].name == item.name ? item.activeImg : item.img)
.width(24)
.height(24)
Text(item.name).fontColor(this.tabModels[this.currentSelect].name == item.name ? "#d81d0b" :"#A2A2A2")
.fontSize(12)
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBar AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {... | @Builder
tabBar(item:TabModel){
Column(){
Image(this.tabModels[this.currentSelect].name == item.name ? item.activeImg : item.img)
.width(24)
.height(24)
Text(item.name).fontColor(this.tabModels[this.currentSelect].name == item.name ? "#d81d0b" :"#A2A2A2")
.fontSize(12)
}
... | https://github.com/CMoments/HarmonOS-arkTS-YunShangChuanDa.git/blob/895985b9b6013c906bf88eaea6e32e03ddf2a9db/project code/entry/src/main/ets/pages/EvaluateIndexPage.ets#L33-L42 | dfa7057985af3a0f6e08974ed06a19de48cd54cf | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | getBirthDateValue | Get default birth date
@param {number} year year
@param {number} month month
@param {number} day day
@returns {string} return birth date | getBirthDateValue(year: number, month: number, day: number): string {
let birthdate: string = `${year}${CommonConstants.DATE_YEAR}${month}` +
`${CommonConstants.DATE_MONTH}${day}${CommonConstants.DATE_DAY}`;
return birthdate;
} | AST#method_declaration#Left getBirthDateValue AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | getBirthDateValue(year: number, month: number, day: number): string {
let birthdate: string = `${year}${CommonConstants.DATE_YEAR}${month}` +
`${CommonConstants.DATE_MONTH}${day}${CommonConstants.DATE_DAY}`;
return birthdate;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/common/utils/CommonUtils.ets#L101-L105 | 5ebc61271a2100df61cd5523ceca4f1683f0dd58 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bigfilecopy/Index.ets | arkts | BigFileCopyViewComponent | 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 { BigFileCopyViewComponent } from "./src/main/ets/view/BigFileCopyView"; | AST#export_declaration#Left export { BigFileCopyViewComponent } from "./src/main/ets/view/BigFileCopyView" ; AST#export_declaration#Right | export { BigFileCopyViewComponent } from "./src/main/ets/view/BigFileCopyView"; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bigfilecopy/Index.ets#L15-L15 | 5b5ba4851d7e895eaa692db51091057d05f34d4f | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets | arkts | offset | export const ZERO: number = 0; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ZERO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AS... | export const ZERO: number = 0; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/common/constants/CommonConstant.ets#L74-L74 | c6d07215138a350b732f4f7b45fcc737cdd1f2af | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/NotificationUtils.ets | arkts | publishPicture | 发布带有图片的通知
@param options 通知实体
@returns | static async publishPicture(options: NotificationPictureOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtils.generateNotificationId(); //通知ID。
const pictureContent: notificationManager.NotificationPictureContent = {
title: options.title,
text: options.text,
... | AST#method_declaration#Left static async publishPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationPictureOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_... | static async publishPicture(options: NotificationPictureOptions): Promise<number> {
const notificationId: number = options.id ?? NotificationUtils.generateNotificationId();
const pictureContent: notificationManager.NotificationPictureContent = {
title: options.title,
text: options.text,
brief... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L227-L250 | d173da7e842171179efb0c0d0a133a8ee28f073c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera_js/entry/src/main/ets/pages/Index.ets | arkts | requestPermissionsFn | 获取权限 | async requestPermissionsFn() {
Logger.info(TAG, `requestPermissionsFn entry`);
try {
this.atManager.requestPermissionsFromUser(this.appContext, [
'ohos.permission.CAMERA',
'ohos.permission.MICROPHONE',
'ohos.permission.READ_IMAGEVIDEO',
'ohos.permission.WRITE_IMAGEVIDEO'
... | AST#method_declaration#Left async requestPermissionsFn AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Ri... | async requestPermissionsFn() {
Logger.info(TAG, `requestPermissionsFn entry`);
try {
this.atManager.requestPermissionsFromUser(this.appContext, [
'ohos.permission.CAMERA',
'ohos.permission.MICROPHONE',
'ohos.permission.READ_IMAGEVIDEO',
'ohos.permission.WRITE_IMAGEVIDEO'
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera_js/entry/src/main/ets/pages/Index.ets#L105-L120 | 6c4cbd61f31abe4647bda381a824fd44bcc1c0e2 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/model/Episode.ets | arkts | getFormattedDuration | 添加到队列的时间
格式化时长显示 | getFormattedDuration(): string {
const hours = Math.floor(this.duration / 3600);
const minutes = Math.floor((this.duration % 3600) / 60);
const seconds = this.duration % 60;
if (hours > 0) {
return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
} els... | AST#method_declaration#Left getFormattedDuration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ho... | getFormattedDuration(): string {
const hours = Math.floor(this.duration / 3600);
const minutes = Math.floor((this.duration % 3600) / 60);
const seconds = this.duration % 60;
if (hours > 0) {
return `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
} els... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/model/Episode.ets#L33-L43 | 0f743daf84899014076e7350f7007a06b7d44ee5 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/YAxisRenderer.ets | arkts | renderAxisLabels | draws the y-axis labels to the screen | public renderAxisLabels(c: CanvasRenderingContext2D, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
if (!this.mYAxis) {
return
}
if (!this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled())
return;
let positions: number[] = this.getTransformedPositions();
if (this.mAxis... | AST#method_declaration#Left public renderAxisLabels 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 isHorizontalFlip : AST#type_annotation#Left AST#primary_t... | public renderAxisLabels(c: CanvasRenderingContext2D, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
if (!this.mYAxis) {
return
}
if (!this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled())
return;
let positions: number[] = this.getTransformedPositions();
if (this.mAxis... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/YAxisRenderer.ets#L104-L165 | d56f5c106f2354b40ed799e1cf0c5d1cc71327b0 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets | arkts | closeSocket | 关闭Socket | async closeSocket(): Promise<void> {
if (!this.tcpSocket) {
return;
}
await this.tcpSocket.close();
this.tcpSocket.off('connect');
this.tcpSocket.off('message');
this.tcpSocket = null;
} | AST#method_declaration#Left async closeSocket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu... | async closeSocket(): Promise<void> {
if (!this.tcpSocket) {
return;
}
await this.tcpSocket.close();
this.tcpSocket.off('connect');
this.tcpSocket.off('message');
this.tcpSocket = null;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets#L88-L96 | b5866c23bb0e478f9a5d9a0344654282f9b9aa85 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/login_register/login.ets | arkts | aboutToAppear | *******************************bulid*******************************// | aboutToAppear() { // 添加生命周期函数
this.showSystemPrivacyDialog()
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 添加生命周期函数 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showSystem... | aboutToAppear() {
this.showSystemPrivacyDialog()
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/login_register/login.ets#L142-L144 | 11dfbd3883468e2718c6f52e8cac5c779c24e05a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets | arkts | getAddressData | 获取rawfile下指定json文件的数据
@returns 返回省数据的数组 | getAddressData(): Array<Province> {
// TODO 知识点:使用getRawFileContentSync从rawfile目录下读取省市区json文件数据,使用util.TextDecoder进行解码。
// 从rawfile本地json文件中获取数据
const value = getContext().resourceManager.getRawFileContentSync(this.jsonFileDir);
// 解码为utf-8格式
const textDecoder = util.TextDecoder.create('utf-8', { ig... | AST#method_declaration#Left getAddressData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Province AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | getAddressData(): Array<Province> {
const value = getContext().resourceManager.getRawFileContentSync(this.jsonFileDir);
const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
const textDecoderResult = textDecoder.decodeToString(new Uint8Array(value.buffer));
const json... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets#L57-L74 | e3d4962b5615a40a8dee918c406ad5fc8cb6f82c | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/RabinKarp.ets | arkts | countMatches | 计算模式串在文本中的出现次数
@param text 文本字符串
@param pattern 模式串
@returns 出现次数 | static countMatches(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return 0;
}
const matches = RabinKarp.findAllMatches(text, pattern);
return matches.length;
} | AST#method_declaration#Left static countMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | static countMatches(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return 0;
}
const matches = RabinKarp.findAllMatches(text, pattern);
return matches.length;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L205-L212 | 1504ccadbd8e660571cb11a41c2446a2ef7bdc93 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.