nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony/applications_mms | entry/src/main/ets/service/SettingService.ets | arkts | setOnSettingValueListener | Set Initial Value
@param {Object} callback | setOnSettingValueListener(callback) {
let result: LooseObject = {
'integrationSwitch': false,
'maliciousWebSwitch': false,
'showContactSwitch': false,
};
mSettingModel.setOnSettingValueListener(settingValue => {
if (settingValue.integrationSwit... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setOnSettingValueListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;... | setOnSettingValueListener(callback) {
let result: LooseObject = {
'integrationSwitch': false,
'maliciousWebSwitch': false,
'showContactSwitch': false,
};
mSettingModel.setOnSettingValueListener(settingValue => {
if (settingValue.integrationSwit... | https://gitee.com/openharmony/applications_mms.git | 81d100feafbbb3353ee25dde93a43b0fef892a69 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | set | Copies elements from an ArrayLike object to the Uint32Array.
@param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy.
@param { int } [offset] - Optional. The offset into the target array at which to begin
writing values from the source array. The default value is 0.
@throws { RangeError... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | https://gitcode.com/iop123123/arkts-static-skills | 820e1c6125db00507d277492fee32e6492a87350 | gitcode |
openharmony-sig/ohos_react_native | docs/Samples/Sample/SampleApp/entry/src/main/ets/customView/MarqueeView.ets | arkts | aboutToAppear | 和props里的src绑定 | aboutToAppear() {
this.start = true
this.descriptor = this.ctx.descriptorRegistry.getDescriptor<MarqueeViewDescriptor>(this.tag)
this.unregisterDescriptorChangesListener =
this.ctx.descriptorRegistry.subscribeToDescriptorChanges(this.tag, (newDescriptor) => {
this.descriptor = (newDescripto... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.start = true
this.descriptor = this.ctx.descriptorRegistry.getDescriptor<MarqueeViewDescriptor>(this.tag)
this.unregisterDescriptorChangesListener =
this.ctx.descriptorRegistry.subscribeToDescriptorChanges(this.tag, (newDescriptor) => {
this.descriptor = (newDescripto... | https://gitee.com/openharmony-sig/ohos_react_native.git | 4e1261b80f7dcd01e97cbc2493f5fb4f7c968662 | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/model/PlanModel.ets | arkts | calculateTotalDays | 计算总天数 | calculateTotalDays(): number {
const start = new Date(this.startDate);
const end = new Date(this.endDate);
const diffTime = Math.abs(end.getTime() - start.getTime());
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
return diffDays + 1; // 包含开始和结束日期
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateTotalDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#sta... | calculateTotalDays(): number {
const start = new Date(this.startDate);
const end = new Date(this.endDate);
const diffTime = Math.abs(end.getTime() - start.getTime());
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
return diffDays + 1; // 包含开始和结束日期
} | https://gitcode.com/openharmony/codelabs | 11f394dc48c7df8668b5ef566ddadad84b096c9a | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | loadUserFavorites | 加载用户收藏到内存缓存(登录后调用一次) | static async loadUserFavorites(username: string): Promise<void> {
try {
console.log('FavoritesManager: Loading favorites for user:', username);
FavoritesManager.favoriteProductIds.clear();
FavoritesManager.currentCacheUser = username;
// 服务器模式下从服务器获取
if (SERVER_ENABLED) {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadUserFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Le... | static async loadUserFavorites(username: string): Promise<void> {
try {
console.log('FavoritesManager: Loading favorites for user:', username);
FavoritesManager.favoriteProductIds.clear();
FavoritesManager.currentCacheUser = username;
// 服务器模式下从服务器获取
if (SERVER_ENABLED) {
... | https://github.com/Harrisonls2004/WaterFlow | fa50dd6b6bd1bd7980d37549d11cd47c4a40c8dd | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamWindowManager.ets | arkts | setHdrBrightness | ==================== 显示设置 ====================
设置 HDR 高亮度模式
当 HDR 开启且用户启用高亮度选项时,将屏幕亮度调至最大
@param enableHdr 是否启用 HDR
@param hdrHighBrightness 是否启用 HDR 高亮度模式 | async setHdrBrightness(enableHdr: boolean, hdrHighBrightness: boolean): Promise<void> {
try {
const win = await window.getLastWindow(this.context);
if (enableHdr && hdrHighBrightness) {
// HDR 高亮度模式:将屏幕亮度调至最大 (1.0)
win.setWindowBrightness(1.0);
console.info('StreamWindowManager... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setHdrBrightness AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left enableHdr AST#identifier#Right AST#type_annotation#Left AST#:#... | async setHdrBrightness(enableHdr: boolean, hdrHighBrightness: boolean): Promise<void> {
try {
const win = await window.getLastWindow(this.context);
if (enableHdr && hdrHighBrightness) {
// HDR 高亮度模式:将屏幕亮度调至最大 (1.0)
win.setWindowBrightness(1.0);
console.info('StreamWindowManager... | https://github.com/AlkaidLab/moonlight-harmony | 707b689123b2935efb6daeda232d4ef6d65a43c8 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/MoonBridge.ets | arkts | sendTouchEvent | ==========================================================================
触摸输入
========================================================================== | sendTouchEvent(
eventType: number,
pointerId: number,
x: number,
y: number,
pressureOrDistance: number,
contactAreaMajor: number,
contactAreaMinor: number,
rotation: number
): number {
return nativeLib.sendTouchEvent(
eventType,
pointerId,
x,
y,
pres... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left sendTouchEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#n... | sendTouchEvent(
eventType: number,
pointerId: number,
x: number,
y: number,
pressureOrDistance: number,
contactAreaMajor: number,
contactAreaMinor: number,
rotation: number
): number {
return nativeLib.sendTouchEvent(
eventType,
pointerId,
x,
y,
pres... | https://github.com/AlkaidLab/moonlight-harmony | 8fe522fe890e73c4320eca219fbb479ebbd50cba | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/PcmEqualizer.ets | arkts | clamp | 限制数值在指定范围内
@param value - 输入值
@param min - 最小值
@param max - 最大值
@returns 限制后的值
@private | function clamp(value: number, min: number, max: number): number {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left clamp AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function clamp(value: number, min: number, max: number): number {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/PcmEqualizer.ets#L260-L268 | 1c2cd1f64b274d03587790f92a88b4edde0c4dfc | github |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | getHighlightedBlock | 获取当前高亮的差异块 | getHighlightedBlock(): DiffBlock | null {
if (this.highlightBlockIndex >= 0 && this.highlightBlockIndex < this.diffBlocks.length) {
return this.diffBlocks[this.highlightBlockIndex];
}
return null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getHighlightedBlock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#i... | getHighlightedBlock(): DiffBlock | null {
if (this.highlightBlockIndex >= 0 && this.highlightBlockIndex < this.diffBlocks.length) {
return this.diffBlocks[this.highlightBlockIndex];
}
return null;
} | https://github.com/XJTUWYD/ArkDiff | 7016ec26c4b9e7d9889b5389d3c5d9d41f90ffff | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Column.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
ColumnCenter() { Text("Hi"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: HorizontalAlign.Center,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.margin... | https://github.com/Joker-x-dev/CoolMallArkTS | 88a6980bbb786addad133cba88aba7c269f582db | github |
codelably/HCompass | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onBackground | 应用进入后台时调用
暂停应用状态、注销路由 | onBackground(): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le... | onBackground(): void {} | https://github.com/codelably/HCompass | 73ce45fe6cdb891242b2cb73e1d353aaec41b298 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/RdbManager.ets | arkts | updatePlaylist | 修改歌单信息(例如重命名) | async updatePlaylist(playlistId: number, newName: string, newImg?: string): Promise<boolean> {
if (!this.rdbStore) return false;
const value: relationalStore.ValuesBucket = { name: newName };
if (newImg) {
value.img = newImg;
}
let predicates = new relationalStore.RdbPredicates(this.tableN... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updatePlaylist AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playlistId AST#identifier#Righ... | async updatePlaylist(playlistId: number, newName: string, newImg?: string): Promise<boolean> {
if (!this.rdbStore) return false;
const value: relationalStore.ValuesBucket = { name: newName };
if (newImg) {
value.img = newImg;
}
let predicates = new relationalStore.RdbPredicates(this.tableN... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L434-L447 | f70bfa9d03283466e999a11a1e0a07ba7ad62998 | github |
openharmony/codelabs | ETSUI/LifeBalance/entry/src/main/ets/pages/DashBoardPage.ets | arkts | calculateAll | --- 核心算法 --- | calculateAll() {
const h_meter = this.heightVal / 100;
// 1. 增加前置校验:如果身高或体重未输入(为0),则所有目标归零
if (this.heightVal < 50 || this.weightVal <= 0) {
this.bmi = 0;
this.targetCalories = 0;
this.targetWater = 0;
this.targetExercise = 0;
return; // 直接返回,不再执行后续逻辑
}
if (h_meter > ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculateAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ... | calculateAll() {
const h_meter = this.heightVal / 100;
// 1. 增加前置校验:如果身高或体重未输入(为0),则所有目标归零
if (this.heightVal < 50 || this.weightVal <= 0) {
this.bmi = 0;
this.targetCalories = 0;
this.targetWater = 0;
this.targetExercise = 0;
return; // 直接返回,不再执行后续逻辑
}
if (h_meter > ... | https://gitcode.com/openharmony/codelabs | 489b1589c497d71245263715aa6f6caae7b76f0c | gitcode |
openharmony-sig/ohos_easyui | entry/src/main/ets/pages/TestCustomCalendar.ets | arkts | build | 点击选中的时间 | build() {
Column() {
Button('显示日历弹框')
.onClick(() => {
this.dialogController.open()
}).backgroundColor(0x317aff)
Text(this.selectedDay)
.fontSize(30)
.width('100%')
.textAlign(TextAlign.Center)
}
.width('100%')
.margin({ top: 5 })
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Button('显示日历弹框')
.onClick(() => {
this.dialogController.open()
}).backgroundColor(0x317aff)
Text(this.selectedDay)
.fontSize(30)
.width('100%')
.textAlign(TextAlign.Center)
}
.width('100%')
.margin({ top: 5 })
} | https://gitee.com/openharmony-sig/ohos_easyui.git | 5762647ef155742121411ccd7983cbbf3a02200a | gitee |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/MaxLinesPerFunctionCheck/ets/MaxLinesPerFunction.ets | arkts | foo4 | eslint max-lines-per-function: ["error", {"max": 2, "skipComments": true}] | function foo4() {
// a comment
let x = 0;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo4 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // a comm... | function foo4() {
// a comment
let x = 0;
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 426e5f4676dfb02b7c583199312e2c15c1820356 | github |
CLMC2025/Vignette | entry/src/main/ets/database/DBManager.ets | arkts | getInstance | Get singleton instance | static getInstance(): DBManager {
if (DBManager.instance === null) {
DBManager.instance = new DBManager();
}
return DBManager.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left DBManager ... | static getInstance(): DBManager {
if (DBManager.instance === null) {
DBManager.instance = new DBManager();
}
return DBManager.instance;
} | https://github.com/CLMC2025/Vignette | c47ebf867c52ded5d1dfbba1dc6f41e94ff5caf9 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setDrawMarkers | Set this to true to draw a user specified marker when tapping on
chart values (use the setMarker(IMarker marker) method to specify a
marker). Default: true
@param enabled | public setDrawMarkers(enabled: boolean) {
this.mDrawMarkers = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawMarkers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setDrawMarkers(enabled: boolean) {
this.mDrawMarkers = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 3706f48f0b436b93abcc2960ee13e6acff790dd7 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | swap16 | Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place.
@returns { Buffer } A reference to buf
@throws { BusinessError } 10200009 - The buffer size must be a multiple of 16-bits | public swap16(): Buffer {
if (this.length % 2 != 0) {
throw createBusinessError(IncorrectBufferSizeId, 'The buffer size must be a multiple of 16-bits')
}
for (let i = this.byteOffset; i < this.length + this.byteOffset; i += 2) {
const a = this.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left swap16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Buffer AST#iden... | public swap16(): Buffer {
if (this.length % 2 != 0) {
throw createBusinessError(IncorrectBufferSizeId, 'The buffer size must be a multiple of 16-bits')
}
for (let i = this.byteOffset; i < this.length + this.byteOffset; i += 2) {
const a = this.... | https://gitcode.com/iop123123/arkts-static-skills | fda8bb8d97597bfbf73fb8f821c86800c0d9ce76 | gitcode |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | openLocalCamera | 打开本地摄像头 | openLocalCamera(isFront: boolean): void {
this.isFrontCamera = isFront;
this.cameraStatus = DeviceStatus.on;
console.info(`[DeviceStore] 打开摄像头, 前置: ${isFront}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openLocalCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isFront AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Le... | openLocalCamera(isFront: boolean): void {
this.isFrontCamera = isFront;
this.cameraStatus = DeviceStatus.on;
console.info(`[DeviceStore] 打开摄像头, 前置: ${isFront}`);
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 159f0a0e4e1969882e77d07303632d1e974f7e35 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | searchAll | ==================== 统一搜索 ====================
执行全局搜索。默认走 v2 session runner;关闭回滚开关后走旧流程。 | async searchAll(
keyword: string,
filter: SearchFilterConfig,
onProgress?: SearchProgressCallback,
onPatch?: GlobalSearchPatchCallback
): Promise<SearchSourceGroup[]> {
if (!this.settingsManager.getGlobalSearchV2Enabled()) {
return await this.searchAllLegacy(keyword, filter, onProgress);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left searchAll AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#ty... | async searchAll(
keyword: string,
filter: SearchFilterConfig,
onProgress?: SearchProgressCallback,
onPatch?: GlobalSearchPatchCallback
): Promise<SearchSourceGroup[]> {
if (!this.settingsManager.getGlobalSearchV2Enabled()) {
return await this.searchAllLegacy(keyword, filter, onProgress);
... | https://github.com/DaLongZhuaZi/manxia | d890812984454356c4422b854cdab94f14607a83 | github |
dingzhilin1990/zhilinclaw | src/events/EventBus.ets | arkts | getAllEvents | 获取所有已注册的事件 | public getAllEvents(): string[] {
return Array.from(this.subscribers.keys());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left string AS... | public getAllEvents(): string[] {
return Array.from(this.subscribers.keys());
} | https://github.com/dingzhilin1990/zhilinclaw | bbd0f6c749989cad986a3ac0c3ceeca9bc1d25f2 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/BillStatisticsUtil.ets | arkts | groupByCategory | 按分类分组统计 | static groupByCategory(bills: BillModel[]): Map<string, BillModel[]> {
const grouped = new Map<string, BillModel[]>();
bills.forEach((bill) => {
if (!grouped.has(bill.category)) {
grouped.set(bill.category, []);
}
grouped.get(bill.category)?.push(... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left groupByCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre... | static groupByCategory(bills: BillModel[]): Map<string, BillModel[]> {
const grouped = new Map<string, BillModel[]>();
bills.forEach((bill) => {
if (!grouped.has(bill.category)) {
grouped.set(bill.category, []);
}
grouped.get(bill.category)?.push(... | https://github.com/qiuhaotc/HarmonyOSPlayground | b1ab004fc3f4dc9f711764b80d5c8ed051d3b22f | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryCache.ets | arkts | setStatisticsForTest | 设置统计计数(仅用于测试)
@param hits 命中次数
@param misses 未命中次数 | setStatisticsForTest(hits: number, misses: number): void {
this.hits = this.normalizeCounterForTest(hits)
this.misses = this.normalizeCounterForTest(misses)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setStatisticsForTest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hits AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#L... | setStatisticsForTest(hits: number, misses: number): void {
this.hits = this.normalizeCounterForTest(hits)
this.misses = this.normalizeCounterForTest(misses)
} | https://github.com/offlinecat-dev/OCNetORM | 801b241844886c9b23d3883fab274cbe401ae4c5 | github |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onConnectCallback | 连接成功的回调 | async function onConnectCallback(element, remote) {
console.log('[game]connectRemoteService onConnectCallback:' + remote)
mRemote = remote;
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left onConnectCallback AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left element AST#identifier#Right AS... | async function onConnectCallback(element, remote) {
console.log('[game]connectRemoteService onConnectCallback:' + remote)
mRemote = remote;
} | https://gitee.com/openharmony/codelabs.git | 960e7c0b43885920414a074ecf978fbfeb39156a | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test6_original_index.ets | arkts | testSortObjects | === Array Sort with Comparator === | function testSortObjects(): string {
let items: Record<string, number>[] = [];
let item1: Record<string, number> = {};
item1['name'] = 3;
let item2: Record<string, number> = {};
item2['name'] = 1;
let item3: Record<string, number> = {};
item3['name'] = 2;
items.push(item1);
items.push(item2);
items.... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSortObjects AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_... | function testSortObjects(): string {
let items: Record<string, number>[] = [];
let item1: Record<string, number> = {};
item1['name'] = 3;
let item2: Record<string, number> = {};
item2['name'] = 1;
let item3: Record<string, number> = {};
item3['name'] = 2;
items.push(item1);
items.push(item2);
items.... | https://github.com/miaochiahao/ark-ghidra | b914349b61b9fb6adfe37ceca327a5798529d60c | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/models/Question.ets | arkts | isValidSpell | V0.4.1 Spell invariants:
- spellLetters length is in [SPELL_MIN_LEN, SPELL_MAX_LEN]
- spellRevealedMask matches spellLetters length, with index 0 = true
and every other index = false (only the first letter is revealed)
- spellLetters joined equals answer.toLowerCase()
- spellPool is the multiset of spellLetters[1..] in... | private isValidSpell(): boolean {
const SPELL_MIN_LEN: number = 4;
const SPELL_MAX_LEN: number = 9;
const len: number = this.spellLetters.length;
if (this.spellRevealedMask.length !== len) {
return false;
}
let fillableCount: number = 0;
for (let i = 0; i < len; i++) {
if (!thi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isValidSpell AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | private isValidSpell(): boolean {
const SPELL_MIN_LEN: number = 4;
const SPELL_MAX_LEN: number = 9;
const len: number = this.spellLetters.length;
if (this.spellRevealedMask.length !== len) {
return false;
}
let fillableCount: number = 0;
for (let i = 0; i < len; i++) {
if (!thi... | https://github.com/terryma2024/happyword | e7c87ed21b7ae03a6a93c5338f80d118b6907292 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | setWebViewController | 设置WebView控制器(必须在加载网络漫画前调用) | public setWebViewController(controller: webview.WebviewController): void {
this.webViewController = controller;
logger.info(TAG, 'WebView控制器已设置');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWebViewController AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left controller AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ... | public setWebViewController(controller: webview.WebviewController): void {
this.webViewController = controller;
logger.info(TAG, 'WebView控制器已设置');
} | https://github.com/DaLongZhuaZi/manxia | 51d9ec861ff636975c18d60c39d55b334ef42f5d | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/services/DataExportService.ets | arkts | generateXml | ==========================================
4. HTML 生成器
========================================== | private static async generateXml(contacts: Contact[], events: Event[]): Promise<string> {
DataExportService.logger.info('Generating XML...');
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
xml += '<BackupData>\n';
xml += ' <Metadata>\n';
xml += ` <Created>${new Date().toISOString()}</C... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left generateXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left con... | private static async generateXml(contacts: Contact[], events: Event[]): Promise<string> {
DataExportService.logger.info('Generating XML...');
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
xml += '<BackupData>\n';
xml += ' <Metadata>\n';
xml += ` <Created>${new Date().toISOString()}</C... | https://gitcode.com/openharmony/codelabs | 471f2da80aeddb976a1c5965a469bacbe04a986f | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | getFirst | Retrieves the first element in the linked list.
@returns The first element of type `T`. | public getFirst(): T {
this.checkEmptyContainer();
return this.head!.element;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFirst AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#identif... | public getFirst(): T {
this.checkEmptyContainer();
return this.head!.element;
} | https://gitcode.com/iop123123/arkts-static-skills | 76191a72dd7f986605539e90ddac4883d367827a | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test24_original_index.ets | arkts | testObjectEntriesValues | === Round 24: Record utility type, Object.entries/values,
String.repeat/trim, Array.isArray with type narrowing,
Math.abs/ceil/floor/round chaining, nested Record access,
string template with expressions, chained ternary as lookup,
multiple variable declarations, short-circuit assignment ===
--- Object.entries and Obje... | function testObjectEntriesValues(): string {
let obj: Record<string, number> = {};
obj['a'] = 1;
obj['b'] = 2;
obj['c'] = 3;
let entries: string[] = Object.keys(obj) as string[];
let vals: number[] = [];
let i: number = 0;
while (i < entries.length) {
let key: string = entries[i];
vals.push(obj[... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectEntriesValues AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#pre... | function testObjectEntriesValues(): string {
let obj: Record<string, number> = {};
obj['a'] = 1;
obj['b'] = 2;
obj['c'] = 3;
let entries: string[] = Object.keys(obj) as string[];
let vals: number[] = [];
let i: number = 0;
while (i < entries.length) {
let key: string = entries[i];
vals.push(obj[... | https://github.com/miaochiahao/ark-ghidra | 58c0e19ba78b215892d91f3bd12b8e2899dcb36a | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/select/picker/components/BasicStylePicker.ets | arkts | DatePickerDialogBuilder | --- DatePicker dialog component --- | @Builder
function DatePickerDialogBuilder(params: DatePickerParams) {
DatePickerContent({ params: params })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left DatePickerDialogBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig... | @Builder
function DatePickerDialogBuilder(params: DatePickerParams) {
DatePickerContent({ params: params })
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | d399c19077baff83422a5adf1a6ca6b0b8af8d74 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | isDrawSlicesUnderHoleEnabled | Returns true if the inner tips of the slices are visible behind the hole,
false if not.
@return true if slices are visible behind the hole. | public isDrawSlicesUnderHoleEnabled(): boolean {
return this.mDrawSlicesUnderHole;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawSlicesUnderHoleEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#L... | public isDrawSlicesUnderHoleEnabled(): boolean {
return this.mDrawSlicesUnderHole;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 57076b84965c4530be1d0d685a2ae70e67507e62 | gitee |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/notify/TnNotify.ets | arkts | autoClose | 设置自动关闭定时器
@param params 通知参数 | private autoClose(params: TnNotifyParams): void {
this.clearTimer();
this.timer = setTimeout(() => {
this.hide();
}, params.duration);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left autoClose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left T... | private autoClose(params: TnNotifyParams): void {
this.clearTimer();
this.timer = setTimeout(() => {
this.hide();
}, params.duration);
} | https://github.com/codelably/tuniao-ui | b1e346c954af4cc5beaed69a53c996bf99e26aa2 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/smartHome/src/main/ets/pages/fan.ets | arkts | aboutToAppear | 中间变量存储图片路径 | aboutToAppear() {
const storedState = AppStorage.get<boolean>('Fan_isON');
const storedAutoMode = AppStorage.get<boolean>('isAutoMode');
this.isOn = storedState ?? false;
this.isAutoMode = storedAutoMode ?? false;
this.setFanStatus(this.isOn);
// 获取 ADC 值并打印日志
this.getAdcValueAndLog();
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
const storedState = AppStorage.get<boolean>('Fan_isON');
const storedAutoMode = AppStorage.get<boolean>('isAutoMode');
this.isOn = storedState ?? false;
this.isAutoMode = storedAutoMode ?? false;
this.setFanStatus(this.isOn);
// 获取 ADC 值并打印日志
this.getAdcValueAndLog();
... | https://gitee.com/openharmony/vendor_unionman.git | dc04759d89769c9ad9a50a6569337765dd937670 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | notifyGCStateChange | 通知 Game Controller Kit 状态变化 | private notifyGCStateChange(slot: number, state: GamepadState): void {
const copy = this.copyState(state);
// 鼠标模拟拦截
if (this.interceptForMouseEmulation(slot, copy)) {
return;
}
if (this.listener) {
this.listener.onGamepadInput(slot, copy);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyGCStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slot AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private notifyGCStateChange(slot: number, state: GamepadState): void {
const copy = this.copyState(state);
// 鼠标模拟拦截
if (this.interceptForMouseEmulation(slot, copy)) {
return;
}
if (this.listener) {
this.listener.onGamepadInput(slot, copy);
}
} | https://github.com/AlkaidLab/moonlight-harmony | 8002115d10b6ddc773962a5490738354a4fd0c5f | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | lessThan | Less-than operator. | lessThan(other: OffsetBase): boolean {
return this._dx < other._dx && this._dy < other._dy;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left lessThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left OffsetBase AST#identifier#Right AST#)#Left ) A... | lessThan(other: OffsetBase): boolean {
return this._dx < other._dx && this._dy < other._dy;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L28-L30 | 435997036ace25afd61da5e279158a0d97fc77c8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BuiltinArraySort.ets | arkts | quickSortSplitLeft | Split range [startIndex, endIndex) by pivot arr[startIndex] and return pivot position
Elements equal to pivot go to the left | function quickSortSplitLeft(arr: FixedArray<byte>, startIndex: int, endIndex: int): int {
const pivot = arr[startIndex]
let i = startIndex + 1
let j = endIndex - 1
// No bounds check because pivot is median of three elements
while ((pivot < arr[j])) {
j--
}
if (j + 1 == endIndex) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left quickSortSplitLeft AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function quickSortSplitLeft(arr: FixedArray<byte>, startIndex: int, endIndex: int): int {
const pivot = arr[startIndex]
let i = startIndex + 1
let j = endIndex - 1
// No bounds check because pivot is median of three elements
while ((pivot < arr[j])) {
j--
}
if (j + 1 == endIndex) {
... | https://gitcode.com/iop123123/arkts-static-skills | 0469052c6b0b4433befb158067ce3f724f920bc9 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets | arkts | onDestroy | 注册销毁回调
@param callback 回调函数 | onDestroy(callback: () => void): void {
this.checkDestroyed('onDestroy');
this.destroyCallbacks.push(callback);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left onDestroy AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left... | onDestroy(callback: () => void): void {
this.checkDestroyed('onDestroy');
this.destroyCallbacks.push(callback);
} | https://github.com/DaLongZhuaZi/manxia | dc9e9d0bd9aa7090bf34dae2e840c9ad2f81d22b | github |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/Medicine/MedicineDetail.ets | arkts | openPrescriptionSelectDialog | 打开处方选择弹窗 | openPrescriptionSelectDialog() {
this.prescriptionSelectController = new CustomDialogController({
builder: PrescriptionSelectDialog({
options: this.validPrescriptions,
confirm: (selected: PrescriptionOption) => {
// 记录选中的处方ID
this.selectedPrescriptionId = selected.record.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openPrescriptionSelectDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#state... | openPrescriptionSelectDialog() {
this.prescriptionSelectController = new CustomDialogController({
builder: PrescriptionSelectDialog({
options: this.validPrescriptions,
confirm: (selected: PrescriptionOption) => {
// 记录选中的处方ID
this.selectedPrescriptionId = selected.record.... | https://github.com/luojiang001/Pulse | c5da41c2941a1c91f06fbc39d8f85a993c9a9b55 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | generateWaypoints | 生成途经点
@param pathNodes 路径节点列表 | private generateWaypoints(pathNodes: GraphNode[]): Waypoint[] {
const waypoints: Waypoint[] = [];
for (let i = 0; i < pathNodes.length; i++) {
const node = pathNodes[i];
const prevNode = i > 0 ? pathNodes[i - 1] : null;
const waypoint: Waypoint = {
id: `WP_${i}`,
position: ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateWaypoints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathNodes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr... | private generateWaypoints(pathNodes: GraphNode[]): Waypoint[] {
const waypoints: Waypoint[] = [];
for (let i = 0; i < pathNodes.length; i++) {
const node = pathNodes[i];
const prevNode = i > 0 ? pathNodes[i - 1] : null;
const waypoint: Waypoint = {
id: `WP_${i}`,
position: ... | https://github.com/LJ666-ui/harmony-health-care | e3bcd9cc55aa9f4a9467d7681207498cd7c08ccf | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/SettingsService.ets | arkts | unregisterObserver | 移除观察者 | public unregisterObserver(observer: (key: string) => void): void {
const index = this.observers.indexOf(observer);
if (index !== -1) {
this.observers.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left unregisterObserver AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left observer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( ... | public unregisterObserver(observer: (key: string) => void): void {
const index = this.observers.indexOf(observer);
if (index !== -1) {
this.observers.splice(index, 1);
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L331-L336 | 7035d4f6d721e3f86ccba7fc26a8596134426924 | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/models/BreakSegment.ets | arkts | fitsWithin | Checks whether this break fits entirely within the work window.
When workEnd <= workStart (cross-midnight), the break must fit in either
the [workStart, 1440) or [0, workEnd] segment. | public fitsWithin(workStart: number, workEnd: number): boolean {
if (workEnd > workStart) {
return this.startMinutes >= workStart && this.endMinutes <= workEnd
}
return (this.startMinutes >= workStart && this.endMinutes <= 1440) ||
(this.startMinutes >= 0 && this.endMinutes <= workEnd)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fitsWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left workStart AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public fitsWithin(workStart: number, workEnd: number): boolean {
if (workEnd > workStart) {
return this.startMinutes >= workStart && this.endMinutes <= workEnd
}
return (this.startMinutes >= workStart && this.endMinutes <= 1440) ||
(this.startMinutes >= 0 && this.endMinutes <= workEnd)
} | https://github.com/OMGCA/sakipay | 058af855ce7f6c8016ad3c2e6c5ac8a6b7c3e575 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartBudgetPlan.ets | arkts | weightedMovingAverage | 加权移动平均 | static weightedMovingAverage(data: number[], windowSize: number): number {
if (data.length === 0) {
return 0;
}
const actualWindow = Math.min(windowSize, data.length);
const startIndex = data.length - actualWindow;
let weightSum = 0;
let result = 0;
for (let i = 0; i < actualWindow... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left weightedMovingAverage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | static weightedMovingAverage(data: number[], windowSize: number): number {
if (data.length === 0) {
return 0;
}
const actualWindow = Math.min(windowSize, data.length);
const startIndex = data.length - actualWindow;
let weightSum = 0;
let result = 0;
for (let i = 0; i < actualWindow... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7bee5d504e6ea0a3b35b29c5eee1ccfb3a44f01c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/WorkerLocal.ets | arkts | constructor | Creates a WorkerLocal instance with value initialization function.
Automatically initializes value on first get() call per worker.
@constructor
@param {() => T} init - Factory function for initial worker-local value | constructor(init: () => T) {
this.init = init;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Rig... | constructor(init: () => T) {
this.init = init;
} | https://gitcode.com/iop123123/arkts-static-skills | 81ecab807c844ff5d17157d2505a833bf1a80538 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/06.conversions_and_contexts/06.numeric_contexts/01.unary_numeric_promotion/shift.ets | arkts | foo | ---
desc: >-
Unary numeric promotion is performed on expressions in the following situation:
Each operand, separately, of a shift operator.
params: {{c.type}}
--- | function foo(p: byte): int {
return 1;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left p AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_... | function foo(p: byte): int {
return 1;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 552769ccc8429ab478d940fefe3b42a658ca3bdc | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenu.ets | arkts | removeMenuItem | 移除菜单项 | removeMenuItem(item: SwipeMenuItem): void {
const index = this.items.indexOf(item);
if (index > -1) {
this.items.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeMenuItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SwipeMenuItem AST#identifier#Right AST#)#... | removeMenuItem(item: SwipeMenuItem): void {
const index = this.items.indexOf(item);
if (index > -1) {
this.items.splice(index, 1);
}
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | c03f6765c9ea49a3cd2983a9596b5ea2bddc921b | gitcode |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | cancelEdit | cancel edit function | cancelEdit(): void {
if (this.isStartDrag || this.clickAddBtn || this.clickRemoveBtn) {
return;
}
this.getUIContext()?.animateTo({
duration: ENTER_EXIT_ICON_DURATION,
curve: LONG_TOUCH_SCALE as ICurve
}, () => {
this.longScaleOnePointTwo = 1;
})
this.getUIContext()?.ani... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelEdit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left... | cancelEdit(): void {
if (this.isStartDrag || this.clickAddBtn || this.clickRemoveBtn) {
return;
}
this.getUIContext()?.animateTo({
duration: ENTER_EXIT_ICON_DURATION,
curve: LONG_TOUCH_SCALE as ICurve
}, () => {
this.longScaleOnePointTwo = 1;
})
this.getUIContext()?.ani... | https://gitcode.com/openharmony/arkui_ace_engine | 42ee37070afabac9ace791fb250f5f798958bd46 | gitcode |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/db/BaseDao.ets | arkts | queryListAsync | 异步 mapper 版本 — 适用于需要解密等异步操作的 fromResultSet | async queryListAsync(
predicates: relationalStore.RdbPredicates,
context: string,
asyncMapper: (rs: relationalStore.ResultSet) => Promise<T>
): Promise<T[]> {
let resultSet: relationalStore.ResultSet | null = null
try {
resultSet = await this.getStore().query(predicates)
const list: ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryListAsync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left predicates AST#identifier#Right AST#type_annotation#Lef... | async queryListAsync(
predicates: relationalStore.RdbPredicates,
context: string,
asyncMapper: (rs: relationalStore.ResultSet) => Promise<T>
): Promise<T[]> {
let resultSet: relationalStore.ResultSet | null = null
try {
resultSet = await this.getStore().query(predicates)
const list: ... | https://github.com/encorexin/WordPressCMS | a7d64dd329f789e0978c1abd37ee90093bb8e660 | github |
LZZLHY/hlib | entry/src/main/ets/utils/Layout.ets | arkts | useSettingsTwoColumn | 是否启用 Settings 双列布局(≥lg)。 | static useSettingsTwoColumn(bp: Breakpoint): boolean {
return bp === 'lg' || bp === 'xl';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left useSettingsTwoColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static useSettingsTwoColumn(bp: Breakpoint): boolean {
return bp === 'lg' || bp === 'xl';
} | https://github.com/LZZLHY/hlib | 96edad649f45f04526a855a97e5cf17ff467cc02 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/pages/DiscoverPage.ets | arkts | loadArticles | 加载文章列表 | loadArticles() {
if (this.isLoading) return;
this.isLoading = true;
const params = {
pageNo: this.currentPage,
pageSize: this.pageSize,
title: this.searchText.trim()
};
HttpUtil.get<{ records: ScienceArticle[]; total: number }>(ApiConstants.DISCOVER_ARTICLE_LIST, params)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left loadArticles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ... | loadArticles() {
if (this.isLoading) return;
this.isLoading = true;
const params = {
pageNo: this.currentPage,
pageSize: this.pageSize,
title: this.searchText.trim()
};
HttpUtil.get<{ records: ScienceArticle[]; total: number }>(ApiConstants.DISCOVER_ARTICLE_LIST, params)
... | https://github.com/LJ666-ui/harmony-health-care | 4c06d4a330ed9bc63138f379bb8004dd6f1fb1c8 | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | analyzeIndentGuides | Perform indent guide analysis on the managed document
@returns Indent guide analysis result | public analyzeIndentGuides(): IndentGuideResult {
if (this.nativeHandle == 0) {
return new IndentGuideResult();
}
let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeIndentGuides(this.nativeHandle);
return NativeBufferPack.readIndentGuideResult(buffer);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeIndentGuides AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left In... | public analyzeIndentGuides(): IndentGuideResult {
if (this.nativeHandle == 0) {
return new IndentGuideResult();
}
let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeIndentGuides(this.nativeHandle);
return NativeBufferPack.readIndentGuideResult(buffer);
} | https://github.com/FinalScave/SweetLine | b1c357f36f554fa50b8430a9a81b3aa32645e83b | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | aStarSearch | A*搜索算法
@param startNode 起点节点
@param endNode 终点节点
@param options 规划选项 | private aStarSearch(
startNode: GraphNode,
endNode: GraphNode,
options: PathPlanningOptions
): GraphNode[] {
// 开放列表(优先队列)
const openSet: PriorityQueueNode[] = [];
openSet.push({ node: startNode, fScore: 0 });
// 关闭列表
const closedSet: Set<string> = new Set();
// 记录路径来源
cons... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left aStarSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left startNode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private aStarSearch(
startNode: GraphNode,
endNode: GraphNode,
options: PathPlanningOptions
): GraphNode[] {
// 开放列表(优先队列)
const openSet: PriorityQueueNode[] = [];
openSet.push({ node: startNode, fScore: 0 });
// 关闭列表
const closedSet: Set<string> = new Set();
// 记录路径来源
cons... | https://github.com/LJ666-ui/harmony-health-care | 65a3a162518c1f09269f62bc8c5dba3f07ec6ffe | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | includes | Determines whether Int32Array includes a certain element, returning true or false as appropriate
@param { int } searchElement - The element to search for
@param { int } fromIndex - The position in this array at which to begin searching for searchElement
@returns { boolean } - true if searchElement is in Int32Array, fal... | public includes(searchElement: int, fromIndex: int): boolean {
return this.indexOf(searchElement.toInt(), fromIndex) != -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi... | public includes(searchElement: int, fromIndex: int): boolean {
return this.indexOf(searchElement.toInt(), fromIndex) != -1
} | https://gitcode.com/iop123123/arkts-static-skills | 541f7d24376af4ad8007d84394bdcdc55fe2a64a | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/multiplication/multiplication_int.ets | arkts | main | ---
desc: check multiplication of two integers
--- | function main(): void {
const a: int = {{v.left}}
const b: int = {{v.right}}
assert (a * b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: int = {{v.left}}
const b: int = {{v.right}}
assert (a * b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 39ac20447abdfdee171b3ee6990b03123d421e54 | gitee |
yanglfree/CopoHub-Multi | flutter/ohos/entry/src/main/ets/plugins/SharePlugin.ets | arkts | handleShare | ── share (text) ──────────────────────────────────────────────────────────── | private handleShare(call: MethodCall, result: MethodResult): void {
const text: string = ((call.argument('text') as string) ?? '').trim();
const subject: string = (call.argument('subject') as string) ?? '';
try {
const record: systemShare.SharedRecord = {
utd: utd.UniformDataType.PLAIN_TEXT,... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleShare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left call AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left M... | private handleShare(call: MethodCall, result: MethodResult): void {
const text: string = ((call.argument('text') as string) ?? '').trim();
const subject: string = (call.argument('subject') as string) ?? '';
try {
const record: systemShare.SharedRecord = {
utd: utd.UniformDataType.PLAIN_TEXT,... | https://github.com/yanglfree/CopoHub-Multi | b147e76a733649cc4649c15bc1707f538146d3c1 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | configUI | 配置界面UI位置 | configUI() {
if (this.mRangSeekBarOption.mThumbWidth) {
this.leftThumbWidth = this.mRangSeekBarOption.mThumbWidth;
this.rightThumbWidth = this.mRangSeekBarOption.mThumbWidth;
}
if (this.mRangSeekBarOption.mPaddingTopBottom) {
this.topPaddingWidth = this.mRangSeekBarOption.mPaddingTopBott... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left configUI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Lef... | configUI() {
if (this.mRangSeekBarOption.mThumbWidth) {
this.leftThumbWidth = this.mRangSeekBarOption.mThumbWidth;
this.rightThumbWidth = this.mRangSeekBarOption.mThumbWidth;
}
if (this.mRangSeekBarOption.mPaddingTopBottom) {
this.topPaddingWidth = this.mRangSeekBarOption.mPaddingTopBott... | https://github.com/openharmony/applications_app_samples | 8e19e225838d0b4b5074c1e8829db3db658e509e | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | constructor | 构造函数,保存上下文与文件名
@param {common.Context} context UIAbility 上下文
@param {string} prefsName 存储文件名(不含后缀) | constructor(context: common.Context, prefsName: string) {
this.context = context;
this.prefsName = prefsName;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left... | constructor(context: common.Context, prefsName: string) {
this.context = context;
this.prefsName = prefsName;
} | https://github.com/Joker-x-dev/CoolMallArkTS | a9eea4873efdce89081251f195665fdff1d28d37 | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | test_Array | 测试重载函数传入数组 | function test_Array() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface()
let numbers: int[] = [1, 2, 3, 4, 5];
let ocp = instance.overloadFunc(numbers)
arktest.assertEQ(ocp, (1).toInt());
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_Array AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declarat... | function test_Array() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface()
let numbers: int[] = [1, 2, 3, 4, 5];
let ocp = instance.overloadFunc(numbers)
arktest.assertEQ(ocp, (1).toInt());
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 4ed760707e3d53fa197cbd64330ef2e4d0778c7d | gitcode |
HarmonyCandies/extended_text | extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets | arkts | buildWithRegExp | 使用正则表达式进行构建 | buildWithRegExp(
data: string,
start: number,
copyRegExps: RegExpSpecialText[],
children: InlineSpan[],
context: Context,
textStyle?: text.TextStyle,
): void {
if (data === '') {
return;
}
if (copyRegExps.length === 0) {
children.push(new TextSpan({ text: data, style... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left buildWithRegExp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | buildWithRegExp(
data: string,
start: number,
copyRegExps: RegExpSpecialText[],
children: InlineSpan[],
context: Context,
textStyle?: text.TextStyle,
): void {
if (data === '') {
return;
}
if (copyRegExps.length === 0) {
children.push(new TextSpan({ text: data, style... | https://github.com/HarmonyCandies/extended_text | 93923aac5dc9c57018c71a9e0f8b511baf898d43 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/pages/CategoryManagement.ets | arkts | getSelectedParentIndex | 获取当前选中的父分类索引 | getSelectedParentIndex(): number {
if (!this.editingCategory || this.editingCategory.parentCategoryId === 0) {
return 0
}
const idx = this.availableParents.findIndex((cat: Category) =>
cat.categoryId === this.editingCategory!.parentCategoryId
)
return idx >= 0 ? idx + 1 : 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectedParentIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST... | getSelectedParentIndex(): number {
if (!this.editingCategory || this.editingCategory.parentCategoryId === 0) {
return 0
}
const idx = this.availableParents.findIndex((cat: Category) =>
cat.categoryId === this.editingCategory!.parentCategoryId
)
return idx >= 0 ? idx + 1 : 0
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6a45e1f4ab3d7268bc553d188154a2031ae87748 | github |
Joker-x-dev/HarmonyKit | feature/main/src/main/ets/viewmodel/NavigationViewModel.ets | arkts | hasResultDesc | 是否存在结果说明
@returns {boolean} 是否存在 | hasResultDesc(): boolean {
return this.resultDescription.length > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasResultDesc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state... | hasResultDesc(): boolean {
return this.resultDescription.length > 0;
} | https://github.com/Joker-x-dev/HarmonyKit | 53e08218f9d005037568a318af8d3034bad3656b | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityDataInput.ets | arkts | get | 获取值
@param key 键名
@returns 值,如果不存在返回 null | get(key: string): ValueType {
const value = this.data.get(key)
if (value === undefined) {
return null
}
return value
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Right ... | get(key: string): ValueType {
const value = this.data.get(key)
if (value === undefined) {
return null
}
return value
} | https://github.com/offlinecat-dev/OCNetORM | fa8ac63cd241726cdae78f6e1cfbba32322a2ebd | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineRadarDataSet.ets | arkts | setLineWidth | set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE:
thinner line == better performance, thicker line == worse performance
@param width | public setLineWidth(width: number): void {
if (width < 0.0)
width = 0.0;
if (width > 10.0)
width = 10.0;
this.mLineWidth = width;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public setLineWidth(width: number): void {
if (width < 0.0)
width = 0.0;
if (width > 10.0)
width = 10.0;
this.mLineWidth = width;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7fb841fd6be480d0429b7342e3b468515d796456 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setMaxAngle | Sets the max angle that is used for calculating the pie-circle. 360f means
it's a full PieChart, 180f results in a half-pie-chart. Default: 360f
@param maxangle min 90, max 360 | public setMaxAngle(maxangle: number): void {
if (maxangle > 360)
maxangle = 360;
if (maxangle < 90)
maxangle = 90;
this.mMaxAngle = maxangle;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaxAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxangle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public setMaxAngle(maxangle: number): void {
if (maxangle > 360)
maxangle = 360;
if (maxangle < 90)
maxangle = 90;
this.mMaxAngle = maxangle;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f7a28f1bd126cd967f845ca81143c4913d6d5aba | gitee |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/viewmodel/ListDataSource.ets | arkts | loadNextPage | 加载下一页数据 | public loadNextPage(): void {
const start = this.currentPage * this.pageSize;
const end = Math.min(start + this.pageSize, this.allData.length);
if (start >= end) return; // 没有更多数据
this.listData.push(...this.allData.slice(start, end));
this.notifyDataAdd(this.listData.length - 1);
this.current... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loadNextPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#R... | public loadNextPage(): void {
const start = this.currentPage * this.pageSize;
const end = Math.min(start + this.pageSize, this.allData.length);
if (start >= end) return; // 没有更多数据
this.listData.push(...this.allData.slice(start, end));
this.notifyDataAdd(this.listData.length - 1);
this.current... | https://github.com/ChangJing01/HarmonyOS-FinalProject | c23a469bf0494f787a9802bea5c637748c3cbac1 | github |
SuperBird007/HarmonyApp_beichengyu | entry/src/main/ets/util/PreferencesUtil.ets | arkts | delPreference | 销毁preferences实例 - 缓存、持久化文件一并销毁
@context 应用上下文 | async delPreference(context: Context) {
try {
await preferences.deletePreferences(context, this.sp_name)
console.log(`preferences[${this.sp_name}]销毁成功`)
} catch (err) {
console.error(`preferences[${this.sp_name}]销毁失败`)
console.error('err: ', JSON.stringify(err))
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delPreference AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async delPreference(context: Context) {
try {
await preferences.deletePreferences(context, this.sp_name)
console.log(`preferences[${this.sp_name}]销毁成功`)
} catch (err) {
console.error(`preferences[${this.sp_name}]销毁失败`)
console.error('err: ', JSON.stringify(err))
}
} | https://github.com/SuperBird007/HarmonyApp_beichengyu | 6f5f2c21ff1c140315b3be543a1fd46ca48a289d | github |
offlinecat-dev/OCNetORM | src/main/ets/types/EntityConstructor.ets | arkts | getInfo | 获取实体信息
@param entityName 实体类名称
@returns 实体信息,如果不存在返回 null | static getInfo(entityName: string): EntityInfo | null {
const info = EntityRegistry.entityMap.get(entityName)
if (info) {
return info
}
return null
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ... | static getInfo(entityName: string): EntityInfo | null {
const info = EntityRegistry.entityMap.get(entityName)
if (info) {
return info
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | 2a7d8c8fcd60e1e2607f551c5265250f5c590cd0 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/view/NetworkListDemoPage.ets | arkts | build | 构建 Network List Demo 示例页
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.demo_base_network_list_title"),
viewModel: this.vm
}) {
BaseNetWorkListView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.NetworkListDemoContent()
});
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: $r("app.string.demo_base_network_list_title"),
viewModel: this.vm
}) {
BaseNetWorkListView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.NetworkListDemoContent()
});
}
... | https://github.com/Joker-x-dev/HarmonyKit | 9ebb1b4e89b94cb087464b90d5526159a5c74fac | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets | arkts | isInWorkWindow | True when clockMinute falls within the active work window. | public isInWorkWindow(clockMinute: number): boolean {
if (!this.isCrossMidnight) {
return clockMinute >= this.workStartMinutes && clockMinute < this.workEndMinutes
}
return clockMinute >= this.workStartMinutes || clockMinute < this.workEndMinutes
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isInWorkWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left clockMinute AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | public isInWorkWindow(clockMinute: number): boolean {
if (!this.isCrossMidnight) {
return clockMinute >= this.workStartMinutes && clockMinute < this.workEndMinutes
}
return clockMinute >= this.workStartMinutes || clockMinute < this.workEndMinutes
} | https://github.com/OMGCA/sakipay | cf10d810caf90a07e66b1da51663af4323dd9985 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | setComment | Sets a comment in the XML output.
@param {string} comment - The comment string to be added to the XML output.
@throws {BusinessError} Throws an error if the `text` parameter is an empty string. | public setComment(text: string): void {
let stringBuilder = this.prepareBufferForNewItem(text);
stringBuilder.append(`<!--${text}-->`);
this.type = XmlDynamicType.OTHERS;
this.writeToBuffer(stringBuilder);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | public setComment(text: string): void {
let stringBuilder = this.prepareBufferForNewItem(text);
stringBuilder.append(`<!--${text}-->`);
this.type = XmlDynamicType.OTHERS;
this.writeToBuffer(stringBuilder);
} | https://gitcode.com/iop123123/arkts-static-skills | 2c96070948300091b3952d716c913b91d802c71b | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getLongestLabel | Returns the longest formatted label (in terms of characters), this axis
contains.
@return | public getLongestLabel(): string {
let longest: string = "";
let longestLength: number = 0;
for (let i = 0; i < this.mEntries.length; i++) {
let text: string = this.getFormattedLabel(i) || "";
const textLength = Utils.getLabelTextSizeWithoutPaint(text, this.textSizeCache).width;
if (text... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLongestLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST... | public getLongestLabel(): string {
let longest: string = "";
let longestLength: number = 0;
for (let i = 0; i < this.mEntries.length; i++) {
let text: string = this.getFormattedLabel(i) || "";
const textLength = Utils.getLabelTextSizeWithoutPaint(text, this.textSizeCache).width;
if (text... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c77a2f0a58ff570cba8246014d87be9cf107873c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | parsePdfWithKit | 使用 PDF Kit 解析 PDF 文档 | private async parsePdfWithKit(): Promise<PdfParseResult> {
try {
logger.info(TAG, `[PDF Kit] 开始解析: ${this.filePath}`);
// 创建 PdfDocument 对象
const pdfDocument = new pdfService.PdfDocument();
// 加载文档
const loadResult = pdfDocument.loadDocument(this.filePath);
logger... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left parsePdfWithKit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async parsePdfWithKit(): Promise<PdfParseResult> {
try {
logger.info(TAG, `[PDF Kit] 开始解析: ${this.filePath}`);
// 创建 PdfDocument 对象
const pdfDocument = new pdfService.PdfDocument();
// 加载文档
const loadResult = pdfDocument.loadDocument(this.filePath);
logger... | https://github.com/DaLongZhuaZi/manxia | 4726c83d1b0866cc202bdd425d4bc30aa5822cc6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationManager.ets | arkts | backTo | 返回到指定页面
@param url 目标页面路径
@returns Promise<void> | public async backTo(url: string): Promise<void> {
try {
this.logNavigation('BACK_TO', url);
// 使用 router.back() 返回到指定页面
// 注意:HarmonyOS router.back() 可以指定返回的页面
await router.back({ url: url });
// 清理历史记录
const index = this.navigationHistory.lastIndexOf(url);
if (index !=... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left backTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right... | public async backTo(url: string): Promise<void> {
try {
this.logNavigation('BACK_TO', url);
// 使用 router.back() 返回到指定页面
// 注意:HarmonyOS router.back() 可以指定返回的页面
await router.back({ url: url });
// 清理历史记录
const index = this.navigationHistory.lastIndexOf(url);
if (index !=... | https://github.com/LJ666-ui/harmony-health-care | e70eeb40b9eeaac16112e452140bdd1f284e8a60 | github |
openharmony/applications_app_samples | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets | arkts | onIndexChange | 监听一级列表获焦索引变化 | onIndexChange(s: string) {
const start = this.tagIndexPosition.start;
const end = this.tagIndexPosition.end;
if ((this.currentTagIndex === end || this.currentTagIndex === end - 1)) {
let leftScrollCount: number = this.currentTagIndex + 1;
leftScrollCount = leftScrollCount >= this.tagLists.leng... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onIndexChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS... | onIndexChange(s: string) {
const start = this.tagIndexPosition.start;
const end = this.tagIndexPosition.end;
if ((this.currentTagIndex === end || this.currentTagIndex === end - 1)) {
let leftScrollCount: number = this.currentTagIndex + 1;
leftScrollCount = leftScrollCount >= this.tagLists.leng... | https://github.com/openharmony/applications_app_samples | c4b68a0636012304fdd090463eecd7acc8cb8dfd | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/aiinsight/AIInsightState.ets | arkts | resetSelection | 重置笔记选择状态。 | resetSelection(): void {
this.selectedNoteIds = [];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetSelection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | resetSelection(): void {
this.selectedNoteIds = [];
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/AIInsightState.ets#L335-L337 | ae6be61a057b21229ab8550fca1fcf858d5649ee | github |
OHPG/FinVideo | entry/src/main/ets/player/VersionSelectStrategy.ets | arkts | screenTier | 将屏幕长边像素映射到目标档位 | private static screenTier(screenLongEdge: number): number {
if (screenLongEdge >= 3840) return 4
if (screenLongEdge >= 1920) return 3
return 2
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left screenTier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left screenLongEdge AST#identifier#Right AST#ERROR#Left AST#:... | private static screenTier(screenLongEdge: number): number {
if (screenLongEdge >= 3840) return 4
if (screenLongEdge >= 1920) return 3
return 2
} | https://github.com/OHPG/FinVideo | b5797b961ba2ebe66d774b631a84efcf4e791737 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | setBright | Setting the brightness. | setBright() {
let windowClass = GlobalContext.getContext().getObject('windowClass') as window.Window;
windowClass.setWindowBrightness(this.playerModel.bright);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setBright AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | setBright() {
let windowClass = GlobalContext.getContext().getObject('windowClass') as window.Window;
windowClass.setWindowBrightness(this.playerModel.bright);
} | https://gitee.com/openharmony/codelabs.git | 494d1f78cbb538146d8f4865d5ce913b137feedf | gitee |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | judgeContactExists | Check whether a contact exists. | judgeContactExists() {
let actionData: LooseObject = {};
actionData.telephones = [this.strContactsNumber];
ContactsService.getInstance().judgeContactExist(actionData, result => {
this.hasExitContact = result;
}, globalThis.mmsContext);
if (this.strContactsName == common.string.EMPTY_STR) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left judgeContactExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block... | judgeContactExists() {
let actionData: LooseObject = {};
actionData.telephones = [this.strContactsNumber];
ContactsService.getInstance().judgeContactExist(actionData, result => {
this.hasExitContact = result;
}, globalThis.mmsContext);
if (this.strContactsName == common.string.EMPTY_STR) {
... | https://gitee.com/openharmony/applications_mms.git | 01fa22412fa09655ed8d3183971bf4c02121d829 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/entryability/EntryAbility.ets | arkts | updateAvoidAreaHeight | 获取并更新避让区域高度 | private updateAvoidAreaHeight(): void {
if (this.mainWindow === null) {
return;
}
// 获取状态栏高度
try {
const systemAvoidArea = this.mainWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM);
const topHeight = systemAvoidArea.topRect.height;
setAppUiStateValue(AppStorageKeys.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateAvoidAreaHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left voi... | private updateAvoidAreaHeight(): void {
if (this.mainWindow === null) {
return;
}
// 获取状态栏高度
try {
const systemAvoidArea = this.mainWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM);
const topHeight = systemAvoidArea.topRect.height;
setAppUiStateValue(AppStorageKeys.... | https://github.com/LongLiveY96/chatcube | 9f784c7fb4fb6e177ddc4b23186b56434584ad2f | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | fixRightTopInFixedMode | In fixed mode, fix right top conner.
@param offsetHypot
@param isEnlarge | private fixRightTopInFixedMode(offsetHypot: number, isEnlarge: boolean) {
let crop = this.getCropRect();
let rate = this.ratio.getRate();
let rect = new RectF();
if (isEnlarge) {
let limit = this.limitRect;
let size = MathUtils.getMaxFixedRectSize(rate, limit.right - crop.left, crop.bottom... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixRightTopInFixedMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetHypot AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left num... | private fixRightTopInFixedMode(offsetHypot: number, isEnlarge: boolean) {
let crop = this.getCropRect();
let rate = this.ratio.getRate();
let rect = new RectF();
if (isEnlarge) {
let limit = this.limitRect;
let size = MathUtils.getMaxFixedRectSize(rate, limit.right - crop.left, crop.bottom... | https://gitee.com/openharmony/codelabs.git | ad2fd0ac7d67384afea0131b6e60934fb320ebcb | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/registry/CompatibilityResolver.ets | arkts | parseReasoningStrategyOverride | 用户覆盖字段(字符串)→ enum;支持旧别名(thinking_budget 之类) | function parseReasoningStrategyOverride(rawOverride?: string): ReasoningRequestStrategy | null {
switch (rawOverride) {
case ReasoningRequestStrategy.NONE:
return ReasoningRequestStrategy.NONE
case ReasoningRequestStrategy.OPENAI_REASONING_EFFORT:
return ReasoningRequestStrategy.OPENAI_REASONING_E... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseReasoningStrategyOverride AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left rawOverride AST#identifier#Right AST#?#Left ? AST#?#Rig... | function parseReasoningStrategyOverride(rawOverride?: string): ReasoningRequestStrategy | null {
switch (rawOverride) {
case ReasoningRequestStrategy.NONE:
return ReasoningRequestStrategy.NONE
case ReasoningRequestStrategy.OPENAI_REASONING_EFFORT:
return ReasoningRequestStrategy.OPENAI_REASONING_E... | https://github.com/LongLiveY96/chatcube | 5e8fa74f1e6963e942ab1891ed4ee82731cae8b6 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | checkCryptoStatusChange | 检测加密状态变更并执行对应的本地联动操作 (跨设备同步) | checkCryptoStatusChange(): void {
const newStatus: string = this.getCryptoStatus();
if (newStatus === '' || newStatus === this.lastKnownCryptoStatus) {
return;
}
hilog.info(0x0001, 'CloudSync',
"[checkCryptoStatusChange] " + this.lastKnownCryptoStatus + " → " + newStatus);
this.lastKno... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkCryptoStatusChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stat... | checkCryptoStatusChange(): void {
const newStatus: string = this.getCryptoStatus();
if (newStatus === '' || newStatus === this.lastKnownCryptoStatus) {
return;
}
hilog.info(0x0001, 'CloudSync',
"[checkCryptoStatusChange] " + this.lastKnownCryptoStatus + " → " + newStatus);
this.lastKno... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 3a1c4bd05d96fcebd6a127a4d41db3160a4e205d | github |
arkui-x/samples | CodeLab/Cases/feature/etswrapper/src/main/ets/wrapper/wrapper.ets | arkts | documentViewPickerSave | 封装后的documentViewPicker的Save方法,需要被注册到native侧
@param uiContext:调用本方法的UIContext
@param options:拉起picker时的options参数
@param thenWrapper:开发者自定义的then回调
@param catchWrapper:开发者自定义的catch回调 | function documentViewPickerSave(uiContext: UIContext, options: picker.DocumentSaveOptions, thenWrapper:
StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void {
//...
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left documentViewPickerSave AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uiContext AST#identifier#Right AST#type_annotation#Left AST#:#L... | function documentViewPickerSave(uiContext: UIContext, options: picker.DocumentSaveOptions, thenWrapper:
StringArrayCbWrapper, catchWrapper: CatchCbWrapper): void {
//...
} | https://gitcode.com/arkui-x/samples | 52796439a29118f4d03bf9f972fdc5ff2e70fa2f | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/deepseek/DeepSeekChatManager.ets | arkts | createConversation | 多轮对话 - 创建会话 | createConversation(userId: string): ConversationSession {
const sessionId = `conv_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
return siliconFlowClient.createOrGetSession(sessionId, userId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createConversation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#L... | createConversation(userId: string): ConversationSession {
const sessionId = `conv_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
return siliconFlowClient.createOrGetSession(sessionId, userId);
} | https://github.com/LJ666-ui/harmony-health-care | c05c83f929cb2850038b8eb3aabb618e3153eb50 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | keys | Returns an list of keys in Uint32Array
@returns { IterableIterator<int> } - iterator over keys
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public keys(): IterableIterator<int> {
return new Uint32ArrayIteratorKeys(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public keys(): IterableIterator<int> {
return new Uint32ArrayIteratorKeys(this)
} | https://gitcode.com/iop123123/arkts-static-skills | a06252b698a180b6b86041042b2742bd0c3a30b1 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets | arkts | updateChapterProgress | 更新章节进度 | private updateChapterProgress(chapterId: string, isSuccess: boolean, isError: boolean): void {
const progress = this.loadingChapters.get(chapterId);
if (!progress) {
return;
}
if (isSuccess) {
progress.loadedPages++;
}
if (isError) {
progress.failedPages++;
}
const ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateChapterProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | private updateChapterProgress(chapterId: string, isSuccess: boolean, isError: boolean): void {
const progress = this.loadingChapters.get(chapterId);
if (!progress) {
return;
}
if (isSuccess) {
progress.loadedPages++;
}
if (isError) {
progress.failedPages++;
}
const ... | https://github.com/DaLongZhuaZi/manxia | 7b59937eeea5cb350ce32c1326711d5a1f4b3361 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/remainder/remainder_ubyte.ets | arkts | main | ---
desc: check remainder of division operation for two unsigned byte operands
--- | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a % b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ubyte = {{v.left}}
const b: ubyte = {{v.right}}
assert (a % b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2017515ab5fe4e45b17d0dfcef6c77a6e845e7df | gitee |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/common/ScheduleData.ets | arkts | getAllCourses | 获取所有课程数据
@returns Promise<CourseModel[]> | static async getAllCourses(): Promise<CourseModel[]> {
if (!ScheduleManager.context) {
console.error('ScheduleManager: Context not initialized.');
return [];
}
try {
const pref = await dataPreferences.getPreferences(ScheduleManager.context, ScheduleManager.PREF_NAME);
const jsonSt... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getAllCourses AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | static async getAllCourses(): Promise<CourseModel[]> {
if (!ScheduleManager.context) {
console.error('ScheduleManager: Context not initialized.');
return [];
}
try {
const pref = await dataPreferences.getPreferences(ScheduleManager.context, ScheduleManager.PREF_NAME);
const jsonSt... | https://gitcode.com/openharmony/codelabs | ae50ae7d7a0452c022f5c2549a2adf5c11abc610 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieData.ets | arkts | getDataSetByIndex | The PieData object can only have one DataSet. Use getDataSet() method instead.
@param index
@return
@Override | public getDataSetByIndex(index: number): IPieDataSet | null {
return index == 0 ? this.getDataSet() : null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSetByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public getDataSetByIndex(index: number): IPieDataSet | null {
return index == 0 ? this.getDataSet() : null;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 487ce4b2e0b46c7097360797d8aa82820095f793 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | bufferToUint8Array | ArrayBuffer转Uint8Array
@param str
@returns | static bufferToUint8Array(src: ArrayBuffer): Uint8Array {
return new Uint8Array(src);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left bufferToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static bufferToUint8Array(src: ArrayBuffer): Uint8Array {
return new Uint8Array(src);
} | https://github.com/tdcare/tdwebrtc | 593d7e79159fd58f08bab890a40bb78141d45bbd | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | getRawFileAnimationData | 从 rawfile 资源文件夹中获取 json 动画对象
@param path 资源文件路径 | getRawFileAnimationData(path: string): Object {
const context: Context = ContextUtil.getUIAbilityCtx();
const data: Uint8Array = context.resourceManager.getRawFileContentSync(path)
const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true })
return JSON.parse(decoder.decodeToString(data))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRawFileAnimationData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#... | getRawFileAnimationData(path: string): Object {
const context: Context = ContextUtil.getUIAbilityCtx();
const data: Uint8Array = context.resourceManager.getRawFileContentSync(path)
const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true })
return JSON.parse(decoder.decodeToString(data))
} | https://github.com/Joker-x-dev/CoolMallArkTS | 3802f06d69ee0608527a5bac5614f9b72672347f | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/pages/CustomScanPage.ets | arkts | onComponentHide | 组件隐藏时执行 | onComponentHide() {
this.isDialogShow = false;
this.dialogController.close();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onComponentHide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | onComponentHide() {
this.isDialogShow = false;
this.dialogController.close();
} | https://gitcode.com/arkui-x/samples | 10b310c8da54473099137deae488451fb8da0f59 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/BaseTracker.ets | arkts | getTrackerId | 获取跟踪器ID | public getTrackerId(): TrackerId {
return this.trackerId;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTrackerId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left TrackerId... | public getTrackerId(): TrackerId {
return this.trackerId;
} | https://github.com/DaLongZhuaZi/manxia | 2976d99dead8dde662a00c644d4ed386ff5bfa03 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets | arkts | getLow | Returns the lower shadows lowest value.
@return | public getLow(): number {
return this.mShadowLow;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#R... | public getLow(): number {
return this.mShadowLow;
} | https://gitee.com/openharmony/developtools_profiler.git | 39c8f09d0829b7a55ef86c1a1e6aeb1c98d9aba8 | gitee |
richshaw2015/nds | ohos/entry/src/test/DependencyRelations.test.ets | arkts | registerDependency | 注册依赖关系
@param definition 依赖关系定义 | registerDependency(definition: DependencyDefinition): void {
this.dependencies.set(definition.parentKey, definition);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDependency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left definition AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DependencyDefinition AST#identi... | registerDependency(definition: DependencyDefinition): void {
this.dependencies.set(definition.parentKey, definition);
} | https://github.com/richshaw2015/nds | 5185bb89fc24d83cddea7a5e7db3189311ee24b1 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test44_original_index.ets | arkts | testMapForEach | --- Map forEach --- | function testMapForEach(): string {
let scores: Map<string, number> = new Map();
scores.set('Alice', 85);
scores.set('Bob', 92);
scores.set('Charlie', 78);
let total: number = 0;
let count: number = 0;
let keys: string[] = ['Alice', 'Bob', 'Charlie'];
for (let i: number = 0; i < keys.length; i++) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapForEach AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t... | function testMapForEach(): string {
let scores: Map<string, number> = new Map();
scores.set('Alice', 85);
scores.set('Bob', 92);
scores.set('Charlie', 78);
let total: number = 0;
let count: number = 0;
let keys: string[] = ['Alice', 'Bob', 'Charlie'];
for (let i: number = 0; i < keys.length; i++) {
... | https://github.com/miaochiahao/ark-ghidra | 075828ffef719199600e6c6bb3b69c9db72f21fe | github |
HarmonyOS_Samples/BestPracticeSnippets | AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets | arkts | build | [StartExclude cold_start_speed_optimization] | build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 9503ef99359a7784c25abe13ff5958d5e3c9337b | gitcode |
openharmony/web_webview | interfaces/kits/ani/webview/ets/@ohos.web.webview.ets | arkts | constructor | @syscap SystemCapability.Web.Webview.Core
@since 20 | constructor() {}; | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {}; | https://gitee.com/openharmony/web_webview.git | c834d67acf166195376517b29664d02ddb3679c6 | gitee |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/NumberPassPage.ets | arkts | handleForgotPassword | 方法: handleForgotPassword
描述: 打开忘记密码弹窗。
忘记密码 | handleForgotPassword() {
this.dialogForgotPassword.open();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleForgotPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | handleForgotPassword() {
this.dialogForgotPassword.open();
} | https://gitcode.com/openharmony/codelabs | 091c39bae257311634c4106c19ea7010d3685cae | gitcode |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | objToObjMap | 传入任意 Object 类型,获得 Map<Object, Object> 字典类型
@param obj 任意类型数据
@param def 默认值
@returns Map<string, Object> 字典类型 | public static objToObjMap(obj: Object | undefined | null, def?: Map<Object, Object>): Map<Object, Object> {
let result: Map<Object, Object> = def ?? new Map<Object, Object>();
// 传入的 obj 为空
if (obj === undefined || obj === null) {
return result;
}
// 是 Map 类型的
if (obj instanceof Map || ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left objToObjMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:... | public static objToObjMap(obj: Object | undefined | null, def?: Map<Object, Object>): Map<Object, Object> {
let result: Map<Object, Object> = def ?? new Map<Object, Object>();
// 传入的 obj 为空
if (obj === undefined || obj === null) {
return result;
}
// 是 Map 类型的
if (obj instanceof Map || ... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | 49d522285d2c67b3223763b400bb7bf619a5cba1 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.