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 |
|---|---|---|---|---|---|---|---|---|---|---|
ZHCOOL520/HarmonyOS-AUTOcall | entry/src/main/ets/utils/FileImportManager.ets | arkts | exportCallRecords | 导出通话记录到CSV | static async exportCallRecords(context: common.UIAbilityContext, phoneList: PhoneEntry[]): Promise<string> {
try {
const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
const fileName = `call_records_${timestamp}.csv`
const filePath = `${context.filesDir}/${fileName}`
// 创建CSV内... | 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 exportCallRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef... | static async exportCallRecords(context: common.UIAbilityContext, phoneList: PhoneEntry[]): Promise<string> {
try {
const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
const fileName = `call_records_${timestamp}.csv`
const filePath = `${context.filesDir}/${fileName}`
// 创建CSV内... | https://github.com/ZHCOOL520/HarmonyOS-AUTOcall | 1e944072afa346378eb65a2ccc05e0fd28e92ce7 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/webdav/WebDAVStorage.ets | arkts | listDir | 获取目录内容
@param path 目录路径
@returns 目录内容 | public async listDir(path: string): Promise<Array<FileInfo>> {
if (!this.client) {
hilog.error(DOMAIN, TAG, 'WebDAV not init:%{public}s', JSON.stringify(this.config));
return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.webdav_not_init'))... | 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 listDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Rig... | public async listDir(path: string): Promise<Array<FileInfo>> {
if (!this.client) {
hilog.error(DOMAIN, TAG, 'WebDAV not init:%{public}s', JSON.stringify(this.config));
return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.webdav_not_init'))... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/webdav/WebDAVStorage.ets#L164-L195 | 08af8b534309a852c1a199836e4125809e815a76 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/CommentNode.ets | arkts | rawText | 设置注释内容 | set rawText(val: string) {
this._rawText = val;
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left rawText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identif... | set rawText(val: string) {
this._rawText = val;
} | https://github.com/DaLongZhuaZi/manxia | 5e7a9d4678d177518b2d16a7ae0e1e5157597b96 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | fill | Fills the Uint16Array with specified value
@param { int } value - new valuy
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { Uint16Array } - modified Uint16Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: int, start?: int, end?: int): Uint16Array {
const k = normalizeIndex(start ?? 0, this.lengthInt)
const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt)
this.fillInternal(value, k, finalPos)
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide... | public fill(value: int, start?: int, end?: int): Uint16Array {
const k = normalizeIndex(start ?? 0, this.lengthInt)
const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt)
this.fillInternal(value, k, finalPos)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | c7af5b62b0764249707c016d2365b85f58587128 | gitcode |
openharmony/developtools_ace_ets2bundle | compiler/sample/pages/testcases/componentGridTest.ets | arkts | <arrow> | Data array | (item) => {
GridItem(){
Text(item)
}.width(100).height(50).backgroundColor(0x00ff00)
}, | AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#required_parameter#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#=>#Left => AST#=>#Right AST#call_expr... | (item) => {
GridItem(){
Text(item)
}.width(100).height(50).backgroundColor(0x00ff00)
}, | https://gitee.com/openharmony/developtools_ace_ets2bundle.git | e44edf266944e466c23bb0b1c881843622a7b3f0 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | applyPatchOperation | 应用补丁操作 | private async applyPatchOperation(pluginId: string, operation: PatchOperation): Promise<void> {
const pluginDir = `${this.sandboxManager.getDirectory('plugins')}/${pluginId}`;
const targetPath = `${pluginDir}/${operation.filePath}`;
switch (operation.type) {
case 'add':
if (operation.da... | 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 applyPatchOperation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pluginId AST#identifier#Right AST#ERROR#Left AST... | private async applyPatchOperation(pluginId: string, operation: PatchOperation): Promise<void> {
const pluginDir = `${this.sandboxManager.getDirectory('plugins')}/${pluginId}`;
const targetPath = `${pluginDir}/${operation.filePath}`;
switch (operation.type) {
case 'add':
if (operation.da... | https://github.com/DaLongZhuaZi/manxia | 5215456335182fccca2b4f8ed39f3de2e0ee3350 | github |
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets | arkts | nativeOnDestroy | Notifies engine TuanjiePlayerAbility destroyed. | public static nativeOnDestroy(): void {
tuanjie.nativeOnDestroy();
} | 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 nativeOnDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public static nativeOnDestroy(): void {
tuanjie.nativeOnDestroy();
} | https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | c30582e67ee97b61608e097f2273b2ef1a21c25a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets | arkts | getIndexOf | Gets the index of the specified value in the LightWeightSet
@param key the value to find the index of
@returns the index of the value, or a negative position if the value is not found | getIndexOf(key: T): int {
const index = this.buckets.getIndexOfKey(key).toInt();
if (index >= 0) {
return index;
} else {
const hashCode = this.hash(key);
let low: int = 0;
let high: int = this.buckets.length - 1;
while (low <= high... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ... | getIndexOf(key: T): int {
const index = this.buckets.getIndexOfKey(key).toInt();
if (index >= 0) {
return index;
} else {
const hashCode = this.hash(key);
let low: int = 0;
let high: int = this.buckets.length - 1;
while (low <= high... | https://gitcode.com/iop123123/arkts-static-skills | 2d7bfa1036027204c71eecc1fc1eadfa86a8eea2 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/MultiVideoApplication/commons/base/src/main/ets/utils/DeviceScreen.ets | arkts | getDeviceWidth | Get the screen width.
@returns screen width. | public static getDeviceWidth(): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelWidth = displayObject.width;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelWidth * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI);
} | 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 getDeviceWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getDeviceWidth(): number {
let displayObject = display.getDefaultDisplaySync();
let screenPixelWidth = displayObject.width;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelWidth * (CommonConstants.SCREEN_DPI_CONSTANT / screenDensityDPI);
} | https://gitee.com/harmonyos/codelabs.git | 6d78d2286d5073b85180b3340a3c7c3cd6880ccf | gitee |
openharmony-sig/ohos_byte_global_viewpool | byte_global_viewpool/src/main/ets/ViewPoolManager.ets | arkts | getPoolNodeCount | 获取当前缓存池中的节点数量
@param type
@return number | public getPoolNodeCount(type: string): number {
return ViewNodePool.getInstance().getNodeCount(type)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPoolNodeCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public getPoolNodeCount(type: string): number {
return ViewNodePool.getInstance().getNodeCount(type)
} | https://gitee.com/openharmony-sig/ohos_byte_global_viewpool.git | 7cc16b246effe9b9f09ff34f0d6dbfabfbfffe40 | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/AudioFocusManager.ets | arkts | initialize | Initialize audio focus manager | static async initialize(): Promise<boolean> {
console.info(`${TAG}: Initializing audio focus manager`);
try {
// Get audio manager instance
audioManager = audio.getAudioManager();
if (!audioManager) {
console.error(`${TAG}: Failed to get audio manager`);
return fa... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | static async initialize(): Promise<boolean> {
console.info(`${TAG}: Initializing audio focus manager`);
try {
// Get audio manager instance
audioManager = audio.getAudioManager();
if (!audioManager) {
console.error(`${TAG}: Failed to get audio manager`);
return fa... | https://github.com/tangwengang-del/freerdp-harmonyos | da18024d16660b854140dac142599ab4f5963f2c | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveClient.ets | arkts | get | 获取文件内容
@param path 文件路径(相对路径)
@returns Promise<HttpResponse> 结果信息 | public async get(path: string): Promise<HttpResponse> {
if (!this.axiosInstance) {
throw new Error('Axios instance not initialized');
}
try {
const apiPath = this.normalizePath(path, OneDrivePathType.CONTENT);
hilog.info(DOMAIN, TAG, `get: path=${path}, apiPath=${apiPath}`);
const ... | 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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right A... | public async get(path: string): Promise<HttpResponse> {
if (!this.axiosInstance) {
throw new Error('Axios instance not initialized');
}
try {
const apiPath = this.normalizePath(path, OneDrivePathType.CONTENT);
hilog.info(DOMAIN, TAG, `get: path=${path}, apiPath=${apiPath}`);
const ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L575-L588 | f64f154b5ce67e60661b7ff1a6d627b50c6e32ba | github |
honjow/Next2V | shared/src/main/ets/parser/V2exTabParser.ets | arkts | extractBlockedIdLists | Extract login-state ignored topic IDs and blocked member IDs from V2EX topic-list scripts. | static extractBlockedIdLists(html: string): V2exBlockedIdLists {
const ignoredTopics = V2exTabParser.extractJsNumberArray(html || '', 'ignored_topics')
const blockedMembers = V2exTabParser.extractJsNumberArray(html || '', 'blocked')
return {
ignoredTopicIds: ignoredTopics.ids,
blockedMemberIds... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractBlockedIdLists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static extractBlockedIdLists(html: string): V2exBlockedIdLists {
const ignoredTopics = V2exTabParser.extractJsNumberArray(html || '', 'ignored_topics')
const blockedMembers = V2exTabParser.extractJsNumberArray(html || '', 'blocked')
return {
ignoredTopicIds: ignoredTopics.ids,
blockedMemberIds... | https://github.com/honjow/Next2V | 733bc45dcb0188418d081a58f568851a5599fc22 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | isGreaterThan | Checks if this instance value is greater than value of provided instance
@param other Right hand side of the comparison
@returns true if this value is greater than provided, false otherwise | public isGreaterThan(other: Float): boolean {
return this.value > other.toFloat();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGreaterThan 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 F... | public isGreaterThan(other: Float): boolean {
return this.value > other.toFloat();
} | https://gitcode.com/iop123123/arkts-static-skills | d0797da0e4b6ce1df71b48ec500c3bc1de35ab94 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | notifyPendingConsumersLocked | Wakes another consumer already waiting on the not-empty condition.
The caller must hold the pop-side mutex while invoking this helper.
@param { int } previousSize The queue size before the dequeue.
@returns { void } No return value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | private notifyPendingConsumersLocked(previousSize: int): void {
if (previousSize - 1 > 0) {
this.popCondVar.notifyOne();
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyPendingConsumersLocked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left previousSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi... | private notifyPendingConsumersLocked(previousSize: int): void {
if (previousSize - 1 > 0) {
this.popCondVar.notifyOne();
}
} | https://gitcode.com/iop123123/arkts-static-skills | 2f8d44480bb6ab2aff2dc121eaf1f878088b0a31 | gitcode |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Game24Logic.ets | arkts | getSolvablePuzzle | 获取一个可解的24点题目
@param maxAttempts 最大尝试次数
@returns 可解的4张牌,如果超过最大尝试次数则返回null | static getSolvablePuzzle(maxAttempts: number = 100): Card[] | null {
for (let i = 0; i < maxAttempts; i++) {
const cards = Game24Logic.dealFourCards();
const numbers = cards.map(card => card.getRankValue());
if (Game24Logic.canMake24(numbers)) {
return cards;
}
}
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSolvablePuzzle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left maxAttempts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignm... | static getSolvablePuzzle(maxAttempts: number = 100): Card[] | null {
for (let i = 0; i < maxAttempts; i++) {
const cards = Game24Logic.dealFourCards();
const numbers = cards.map(card => card.getRankValue());
if (Game24Logic.canMake24(numbers)) {
return cards;
}
}
... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | c7c4bb591ca6a328905d4ca1968500a4afd6a2bc | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/ProfileViewModel.ets | arkts | initProfile | 初始化用户数据 | initProfile() {
console.info('ProfileViewModel: initProfile')
let request = Request.getInstance()
let url: string
//根据用户的类型,对于不同的url
switch (this.profileType) {
case ProfileType.Authorization:
//授权用户的API
url = UserAPI.GetAuthorizedProfile()
break
case ProfileType... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initProfile 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... | initProfile() {
console.info('ProfileViewModel: initProfile')
let request = Request.getInstance()
let url: string
//根据用户的类型,对于不同的url
switch (this.profileType) {
case ProfileType.Authorization:
//授权用户的API
url = UserAPI.GetAuthorizedProfile()
break
case ProfileType... | https://gitee.com/openharmony-sig/online_event.git | dab0a6e139961bf603db3d908992211197eb31e5 | gitee |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets | arkts | startAnimateTo | 自定义分段按钮切换动画
@param duration 动画时长
@param leftMargin 自定义分段按钮左侧边距 | startAnimateTo(duration: number, leftMargin: number) {
animateTo({
duration: duration, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
}, () => {
this.indicatorLeftMargin = leftMargin;
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAnimateTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AS... | startAnimateTo(duration: number, leftMargin: number) {
animateTo({
duration: duration, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal, // 动画模式
}, () => {
this.indicatorLeftMargin = leftMargin;
})
} | https://gitcode.com/arkui-x/samples | bd4b82bfd50f7c7cc4117c9b85f6ae8f2522b7e4 | gitcode |
somnio-software/my-bot-pal | entry/src/main/ets/utils/VersionUtils.ets | arkts | shouldDisplayForceUpdateAlert | Verifies if the app requires a force update alert.
@param config AppConfigResponse object containing app configuration.
@returns {boolean} Whether the app requires a force update. | static async shouldDisplayForceUpdateAlert(config: AppConfig, context: Context): Promise<boolean> {
const currentAppVersion: string = await VersionUtils.getCurrentAppVersion(context);
if (config.force_update_enabled) {
// Compare current app version with minimum supported version
const currentVe... | 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 shouldDisplayForceUpdateAlert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Righ... | static async shouldDisplayForceUpdateAlert(config: AppConfig, context: Context): Promise<boolean> {
const currentAppVersion: string = await VersionUtils.getCurrentAppVersion(context);
if (config.force_update_enabled) {
// Compare current app version with minimum supported version
const currentVe... | https://github.com/somnio-software/my-bot-pal | 41f3d2906537e895c929f592421369ec74f07e3b | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | player_callback | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
回调函数 //
//////////
播放器回调 // | private player_callback() {
// 准备就绪提示 //
const set_player_ready = () => {this.player_ready = true}
// 播放状态更新 //
const play_status_update = (status: string) => {this.send_play_status(status)}
// 播放进度更新 //
const current_time_update = (time: number) => {this.send_current_time(time)}
// 官方播放... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left player_callback 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#{#L... | private player_callback() {
// 准备就绪提示 //
const set_player_ready = () => {this.player_ready = true}
// 播放状态更新 //
const play_status_update = (status: string) => {this.send_play_status(status)}
// 播放进度更新 //
const current_time_update = (time: number) => {this.send_current_time(time)}
// 官方播放... | https://github.com/Nekofox-POT/LinMusic | 3b0f0ec4aeb7c3b3c765c672d686d82aa2304c78 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MangaDetailPage.ets | arkts | getCoverImageSourceForUI | 提供封面图片的 UI 渲染源:返回规范化后的路径、PixelMap或资源占位图 | getCoverImageSourceForUI(): string | ResourceStr | image.PixelMap {
// 优先使用PixelMap(通过OnlineImageLoader加载的带headers的图片)
if (this.coverPixelMap) {
return this.coverPixelMap;
}
const mg: Manga | null = this.currentManga;
if (mg && mg.coverImagePath && mg.coverImagePath.length > 0 && mg.coverSou... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCoverImageSourceForUI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Lef... | getCoverImageSourceForUI(): string | ResourceStr | image.PixelMap {
// 优先使用PixelMap(通过OnlineImageLoader加载的带headers的图片)
if (this.coverPixelMap) {
return this.coverPixelMap;
}
const mg: Manga | null = this.currentManga;
if (mg && mg.coverImagePath && mg.coverImagePath.length > 0 && mg.coverSou... | https://github.com/DaLongZhuaZi/manxia | 8b18ac68f5fe39c45b10366e9b0c853c81595619 | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | removeAssistant | 删 assistant:返回 DB 是否真的删了,删掉后从内存过滤 | async removeAssistant(assistantId: string): Promise<boolean> {
const deleted = await this.db.deleteAssistant(assistantId)
if (!deleted) {
return false
}
const current = this.getAssistants()
const next: Assistant[] = []
for (let i = 0; i < current.length; i++) {
if (current[i].id !=... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeAssistant AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistantId AST#identifier#Right AST#type_annotation#Left AST#:... | async removeAssistant(assistantId: string): Promise<boolean> {
const deleted = await this.db.deleteAssistant(assistantId)
if (!deleted) {
return false
}
const current = this.getAssistants()
const next: Assistant[] = []
for (let i = 0; i < current.length; i++) {
if (current[i].id !=... | https://github.com/LongLiveY96/chatcube | 460f6f12bc7a4c5b02108baf9335d3392e77e74d | github |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets | arkts | playNextMusic | 播放下一首音乐 | playNextMusic() {
if (this.currentMusicIndex + 1 == this.musicList.length) {
this.currentMusicIndex = 0
} else {
this.currentMusicIndex++
}
this.play(-1)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playNextMusic 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... | playNextMusic() {
if (this.currentMusicIndex + 1 == this.musicList.length) {
this.currentMusicIndex = 0
} else {
this.currentMusicIndex++
}
this.play(-1)
} | https://gitee.com/openharmony-sig/online_event.git | 2216dbaead676736e97f08e2bdc979775db7ca3a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/components/SuwayomiImage.ets | arkts | onSrcChange | 当 src 属性变化时重新加载图片
例如:封面缓存完成后,src 从 HTTP URL 变为 file:// 路径 | onSrcChange(): void {
if (this.src && this.src !== this.currentSrc) {
this.loadImage();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSrcChange 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#Lef... | onSrcChange(): void {
if (this.src && this.src !== this.currentSrc) {
this.loadImage();
}
} | https://github.com/DaLongZhuaZi/manxia | ba1d5c3c1e0a8d2425611714a857dae2c35d22cf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorLessThanEqual | Checks if this BigInt is less than or equal to another.
@param { BigInt } other The value to compare with.
@returns { boolean } True if this is less than or equal to other, false otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorLessThanEqual(other: BigInt): boolean {
return !(other < this)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorLessThanEqual 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#identifie... | public operatorLessThanEqual(other: BigInt): boolean {
return !(other < this)
} | https://gitcode.com/iop123123/arkts-static-skills | 02fdf051a19fd4649d9dbfba1ef53405446f91a9 | gitcode |
din0sauria/audio-deepfake-detection | entry/src/main/ets/Audio/AudioDB.ets | arkts | getAllData | 获取所有数据 * | getAllData() {
const pre = new relationalStore.RdbPredicates(this.tableName)
const res = this.store?.querySync(pre)
const list = [] as IInterviewAudioItem[]
while (res?.goToNextRow()) {
const row = res?.getRow() as IInterviewAudioItem
list.push(row)
}
res?.close()
return list
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAllData 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 AS... | getAllData() {
const pre = new relationalStore.RdbPredicates(this.tableName)
const res = this.store?.querySync(pre)
const list = [] as IInterviewAudioItem[]
while (res?.goToNextRow()) {
const row = res?.getRow() as IInterviewAudioItem
list.push(row)
}
res?.close()
return list
... | https://github.com/din0sauria/audio-deepfake-detection | 62ade6397854e20f96687395376a8a457394a928 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityData.ets | arkts | getTransientKeys | 获取所有临时数据的键
@returns 键数组 | getTransientKeys(): Array<string> {
const keys: Array<string> = []
this.transientData.forEach((_, key) => {
keys.push(key)
})
return keys
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTransientKeys 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#:#... | getTransientKeys(): Array<string> {
const keys: Array<string> = []
this.transientData.forEach((_, key) => {
keys.push(key)
})
return keys
} | https://github.com/offlinecat-dev/OCNetORM | 6838e333f6ec1376fc59309128f253ee55ee6625 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets | arkts | packToDataFromPicture | 将picture编码成buffer | async packToDataFromPicture(fileName: string): Promise<string> {
let context = getContext();
let filePath = context.filesDir + `/` + fileName;
let file = await fs.open(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let message = ndkTest.packToDataPicture(filePath);
if (message != 0) {
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left packToDataFromPicture AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileName AST#identifier#Right AST#type_annotatio... | async packToDataFromPicture(fileName: string): Promise<string> {
let context = getContext();
let filePath = context.filesDir + `/` + fileName;
let file = await fs.open(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let message = ndkTest.packToDataPicture(filePath);
if (message != 0) {
... | https://github.com/openharmony/applications_app_samples | 9aeda00f3d86e658020e97333c64ea5b1dffa893 | github |
YANGZX22/Voot | entry/src/main/ets/services/PipSubtitleManager.ets | arkts | registerLifecycleCallback | Register lifecycle callback | registerLifecycleCallback(callback: (state: PiPWindow.PiPState) => void): void {
this.lifecycleCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#identifier#Left registerLifecycleCallback AST#identifier#Right AST#(#Left ( AST#(#Right 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#ERROR#Left AST#id... | registerLifecycleCallback(callback: (state: PiPWindow.PiPState) => void): void {
this.lifecycleCallback = callback;
} | https://github.com/YANGZX22/Voot | 46202b252ed4019e8828a3c5f97274a8395a58e4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Uint8ClampedArray that satisfies the condition
@param { function } fn - condition
@returns { int } - the index of the last element that satisfies fn, -1 otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLastIndex(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; i--) {
if (fn(this.getUnsafe(i).toDouble(), i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; i--) {
if (fn(this.getUnsafe(i).toDouble(), i, this)) {
return i
}
}
return -1
} | https://gitcode.com/iop123123/arkts-static-skills | 33a3be00c0cf27d86708eebd4e14d9b26883c3f4 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | getLanguage | 获取语言设置 | async getLanguage(): Promise<AppLanguage> {
const lang = await this.getString(PreferenceKeys.LANGUAGE, AppLanguage.SYSTEM)
return normalizeAppLanguageValue(lang)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLanguage AST#identifier#Right AST#ERROR#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#generic_... | async getLanguage(): Promise<AppLanguage> {
const lang = await this.getString(PreferenceKeys.LANGUAGE, AppLanguage.SYSTEM)
return normalizeAppLanguageValue(lang)
} | https://github.com/LongLiveY96/chatcube | 963ef3738b1eb035b1ccbf52993c3897cb6578b9 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/pages/Minesweeper.ets | arkts | build | 构建用户界面 | build() {
Column() {
// 标题区域 - 居中对称布局
Column() {
Row() {
// 返回按钮
Button('←')
.width(40)
.height(40)
.backgroundColor(this.themeColors.buttonBackground)
.fontColor(this.themeColors.buttonText)
.borderRadius(20)
... | 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() {
// 标题区域 - 居中对称布局
Column() {
Row() {
// 返回按钮
Button('←')
.width(40)
.height(40)
.backgroundColor(this.themeColors.buttonBackground)
.fontColor(this.themeColors.buttonText)
.borderRadius(20)
... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 1c4a8418efec216628fb6ab06fe95a64ed057402 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/ThemeColors.ets | arkts | clone | 创建当前状态的副本(用于触发@State更新) | clone(): ThemeColorState {
const newState = new ThemeColorState();
// 复制ID以保持追踪
newState._id = this._id;
return newState;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clone 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 ThemeColorState AST#identifier#Right AST#ERROR#Right AST... | clone(): ThemeColorState {
const newState = new ThemeColorState();
// 复制ID以保持追踪
newState._id = this._id;
return newState;
} | https://github.com/DaLongZhuaZi/manxia | b55399efcc7de9abcb51da1c671ab2ac2a8f9a6d | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | formatNeteaseMusic | 格式化网易云音乐数据 | private formatNeteaseMusic(song: NeteaseSong): MusicInfo {
const singerNames: string[] = []
for (let i = 0; i < song.artists.length; i++) {
singerNames.push(song.artists[i].name)
}
const singers = singerNames.join('、')
const musicInfo: MusicInfo = {
id: `${song.id}`,
name: song.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatNeteaseMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private formatNeteaseMusic(song: NeteaseSong): MusicInfo {
const singerNames: string[] = []
for (let i = 0; i < song.artists.length; i++) {
singerNames.push(song.artists[i].name)
}
const singers = singerNames.join('、')
const musicInfo: MusicInfo = {
id: `${song.id}`,
name: song.... | https://github.com/cpdd5201314/harmonyOS-music-app | f65b3618382f915f3109a89958c53dbd758b12bb | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/DataView.ets | arkts | getFloat32 | === Float32 ===
Read bytes as they represent given type
@param byteOffset zero index to read
@returns read value (big endian) | public getFloat32(byteOffset: number): number {
return this.getFloat32(byteOffset as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFloat32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R... | public getFloat32(byteOffset: number): number {
return this.getFloat32(byteOffset as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b9021ccb2e89aed2964624b2d89f6020b825a815 | gitee |
YANGZX22/Voot | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getFormIds | Get all stored formIds | public static async getFormIds(context: Context): Promise<string[]> {
try {
const pref = await preferences.getPreferences(context, PREF_FILE);
const idsStr = await pref.get(FORM_IDS_KEY, '[]') as string;
return JSON.parse(idsStr) as string[];
} catch (e) {
console.error('[EntryFormAbil... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getFormIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context... | public static async getFormIds(context: Context): Promise<string[]> {
try {
const pref = await preferences.getPreferences(context, PREF_FILE);
const idsStr = await pref.get(FORM_IDS_KEY, '[]') as string;
return JSON.parse(idsStr) as string[];
} catch (e) {
console.error('[EntryFormAbil... | https://github.com/YANGZX22/Voot | 02d1eb289d61d0af404797738e49734335e67a29 | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getDaysOfWeekDesc | Convert the Days-of-week information of an alarm to the repetition information displayed in the alarm list.
@param daysOfWeek Days-of-week information for repetition
@return The repetition information to display | static getDaysOfWeekDesc(resourceManager: resmgr.ResourceManager, daysOfWeek: number[]): string {
const daysOfWeekLength = daysOfWeek.length;
if (daysOfWeekLength === 0) {
return resourceManager.getStringSync($r('app.string.only_ring_once').id);
}
if (daysOfWeekLength === DAYS_OF_WEEK_COUNT) {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDaysOfWeekDesc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left resourceManager AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | static getDaysOfWeekDesc(resourceManager: resmgr.ResourceManager, daysOfWeek: number[]): string {
const daysOfWeekLength = daysOfWeek.length;
if (daysOfWeekLength === 0) {
return resourceManager.getStringSync($r('app.string.only_ring_once').id);
}
if (daysOfWeekLength === DAYS_OF_WEEK_COUNT) {
... | https://gitee.com/openharmony-sig/applications_clock.git | f7fad53f5ec80d6276428889219dcddaa33924ac | gitee |
openharmony/applications_mms | entry/src/main/ets/pages/conversationlist/conversationListController.ets | arkts | clickToGroupDetail | Tap the avatar to go to the contact details page or recipient list page. | clickToGroupDetail(index) {
if (this.isJumping) {
return;
}
this.isJumping = true;
// Determine whether to redirect to the contact details page or to the list page of multiple recipients.
var contactsNum = this.messageList[index]?.contactsNum;
var telephon... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickToGroupDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST... | clickToGroupDetail(index) {
if (this.isJumping) {
return;
}
this.isJumping = true;
// Determine whether to redirect to the contact details page or to the list page of multiple recipients.
var contactsNum = this.messageList[index]?.contactsNum;
var telephon... | https://gitee.com/openharmony/applications_mms.git | 37640011b4d83443db41e4373a7fc4bbd18686b3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets | arkts | markAskedPermission | 标记已询问过用户权限 | public async markAskedPermission(): Promise<void> {
this.settings.hasAskedPermission = true;
await this.saveSettings();
logger.info(TAG, '已标记询问过用户权限');
} | 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 markAskedPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public async markAskedPermission(): Promise<void> {
this.settings.hasAskedPermission = true;
await this.saveSettings();
logger.info(TAG, '已标记询问过用户权限');
} | https://github.com/DaLongZhuaZi/manxia | d8a521a262d71b1ebe5f2d59fc0874ae5bdc6008 | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/common/utils/DateUtil.ets | arkts | now | 获取当前毫秒时间戳 | static now(): number {
return new Date().getTime();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left now 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#:#Right... | static now(): number {
return new Date().getTime();
} | https://gitcode.com/openharmony/codelabs | 91ec4aa4464ed37488605b43dc9d994e47630c38 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | tryToSegmentData | Converts an Cluster to a SegmentDataImpl
@param clusterData The cluster to convert
@param granularity The segmentation granularity
@param index The segment index
@param input The original input text
@returns A SegmentDataImpl instance | private static tryToSegmentData(
clusterData: Cluster,
granularity: SegmenterGranularity,
input: string
): SegmentDataImpl
{
return new SegmentDataImpl(
clusterData.index,
input,
clusterData.cluster,
... | 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 tryToSegmentData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left clusterData AST#identifier#Right AST#ERROR#Left AS... | private static tryToSegmentData(
clusterData: Cluster,
granularity: SegmenterGranularity,
input: string
): SegmentDataImpl
{
return new SegmentDataImpl(
clusterData.index,
input,
clusterData.cluster,
... | https://gitcode.com/iop123123/arkts-static-skills | 83ca3ff16d5c32f5865d3a945f1d15f588b856e6 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Exception.ets | arkts | getCause | Returns the cause of this excepiton
@returns the cause | public getCause(): Object | null {
if (this.cause == this) {
return null;
} else {
return this.cause;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCause 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#binary_expression#Left AST#id... | public getCause(): Object | null {
if (this.cause == this) {
return null;
} else {
return this.cause;
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b6aae4058ac5f7602b593cc9aa81e460c1f62cbc | gitee |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/Retrofit.ets | arkts | addConverterFactory | Add a converter factory for serialization and deserialization of objects. | addConverterFactory(factory: ConverterFactory): RetrofitBuilder {
this.converterFactories.unshift(factory);
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addConverterFactory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left factory AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ConverterFactory AST#identifier#R... | addConverterFactory(factory: ConverterFactory): RetrofitBuilder {
this.converterFactories.unshift(factory);
return this;
} | https://github.com/killetom/ktretrofit | 055b65ad3d4688afe6b8042e0f1c9e797ff934bc | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setShadowRadius | 设置阴影半径,单位:vp
@param shadowRadius
@returns | setShadowRadius(shadowRadius: number): Builder {
this.popupConfig.shadowRadius = shadowRadius
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setShadowRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shadowRadius AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left )... | setShadowRadius(shadowRadius: number): Builder {
this.popupConfig.shadowRadius = shadowRadius
return this
} | https://github.com/wuba/omni-ui | c60aee0d350748d0e556ff16306d2201f62440f9 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | setViewport | ==================== Viewport/Font/Appearance Configuration ==================== | setViewport(width: number, height: number): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.setEditorViewport(this.handle, width, height));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setViewport 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 number AST#identifier#Right AST#,#Left , AS... | setViewport(width: number, height: number): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.setEditorViewport(this.handle, width, height));
} | https://github.com/FinalScave/SweetEditor | ddb0b8d91323ff71347f4830507bbad3f2d26e79 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitInt32 | ========== 标量字段 ==========
访问 int32 字段
Wire type: 0 (varint) | visitInt32(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).int32(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitInt32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST... | visitInt32(value: number, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).int32(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 6c8129895a98c48c43c35d6829f49d8c0c0bf977 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | collectDebugInfoSync | 同步收集调试信息 | private collectDebugInfoSync(): HidebugDebugInfo {
const debugInfo: HidebugDebugInfo = {
isDebugState: false,
gwpAsanState: 0
};
try {
// 获取调试状态
debugInfo.isDebugState = hidebug.isDebugState();
// GWP-Asan状态当前不采集;如后续SDK暴露稳定方法,再在这里接入。
// try {
// // 使用正确的... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left collectDebugInfoSync 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#Lef... | private collectDebugInfoSync(): HidebugDebugInfo {
const debugInfo: HidebugDebugInfo = {
isDebugState: false,
gwpAsanState: 0
};
try {
// 获取调试状态
debugInfo.isDebugState = hidebug.isDebugState();
// GWP-Asan状态当前不采集;如后续SDK暴露稳定方法,再在这里接入。
// try {
// // 使用正确的... | https://github.com/DaLongZhuaZi/manxia | 367fb71db314ff6dc759dc3366b7b18d0001c76b | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateXY | Animates values along both the X and Y axes.
@param durationMillisX animation duration along the X axis
@param durationMillisY animation duration along the Y axis
@param easing EasingFunction for both axes | public animateXY(durationMillisX: number, durationMillisY: number, easing: EasingFunction) {
let xAnimator = xAnimator(durationMillisX, easing);
let yAnimator = yAnimator(durationMillisY, easing);
if (durationMillisX > durationMillisY) {
xAnimator.addUpdateListener(mListener);
} else {
yA... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateXY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMillisX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | public animateXY(durationMillisX: number, durationMillisY: number, easing: EasingFunction) {
let xAnimator = xAnimator(durationMillisX, easing);
let yAnimator = yAnimator(durationMillisY, easing);
if (durationMillisX > durationMillisY) {
xAnimator.addUpdateListener(mListener);
} else {
yA... | https://gitee.com/openharmony/developtools_profiler.git | 477a6748f6786c97cb5602309cefa936528d8a59 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getCachedPagePath | 获取缓存的页面路径(如果已缓存) | public getCachedPagePath(mangaTitle: string, chapterTitle: string, pageIndex: number): string | null {
try {
const pagePath = this.getPageCachePath(mangaTitle, chapterTitle, pageIndex);
if (!this.isReadableFile(pagePath)) {
return null;
}
return pagePath;
} catch (_error) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCachedPagePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public getCachedPagePath(mangaTitle: string, chapterTitle: string, pageIndex: number): string | null {
try {
const pagePath = this.getPageCachePath(mangaTitle, chapterTitle, pageIndex);
if (!this.isReadableFile(pagePath)) {
return null;
}
return pagePath;
} catch (_error) {
... | https://github.com/DaLongZhuaZi/manxia | 69aed57a0d5aeb1a35e842a92d34b77059147eea | github |
openharmony/applications_call | entry/src/main/ets/model/NotificationManager.ets | arkts | sendCapsuleNotification | send capsule notification
@param {Object} callData - call data
@param {boolean} isBackground - is background | sendCapsuleNotification(callData, isBackground) {
LogUtils.i(TAG, 'sendCapsuleNotification isBackground : ' + JSON.stringify(isBackground))
LogUtils.i(TAG, 'sendCapsuleNotification callData.startTime :')
const {callState, startTime} = callData;
let commonEventPublishData = {
bundleName: 'com.oho... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendCapsuleNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callData AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left isBackground AST#identifier#Right AST#)#Left... | sendCapsuleNotification(callData, isBackground) {
LogUtils.i(TAG, 'sendCapsuleNotification isBackground : ' + JSON.stringify(isBackground))
LogUtils.i(TAG, 'sendCapsuleNotification callData.startTime :')
const {callState, startTime} = callData;
let commonEventPublishData = {
bundleName: 'com.oho... | https://gitee.com/openharmony/applications_call.git | dc13021ae5e0ee9e47258d4973d0f1ea225dcbf8 | gitee |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | cancelAll | 取消所有任务 | public cancelAll(): void {
FLog.info(FFmpegManager.TAG, 'Cancelling all tasks...');
// 取消队列中的任务
this.taskQueue.forEach(task => {
task.cancel();
this.dispatchCallback(task, 'cancelled');
});
this.taskQueue = [];
// 取消当前执行的任务
if (this.currentTask) {
this.currentTa... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cancelAll 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_s... | public cancelAll(): void {
FLog.info(FFmpegManager.TAG, 'Cancelling all tasks...');
// 取消队列中的任务
this.taskQueue.forEach(task => {
task.cancel();
this.dispatchCallback(task, 'cancelled');
});
this.taskQueue = [];
// 取消当前执行的任务
if (this.currentTask) {
this.currentTa... | https://github.com/jjjjjjava/ffmpeg_tools | 4869091524fc1743bac66cfc8b26848d038a35ef | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | set | Copies all elements of arr to the current Uint16Array starting from insertPos.
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
@param { FixedArray<number> } arr - array to copy data from
@param { int } insertPos - start index where data from arr will be inserted
@... | public set(arr: FixedArray<number>, insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.lengthInt) {
throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint16Array.length")
}
for (let i = 0; i < arr.length; 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 arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<number>, insertPos: int): void {
if (insertPos < 0 || insertPos + arr.length > this.lengthInt) {
throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint16Array.length")
}
for (let i = 0; i < arr.length; i++) {
... | https://gitcode.com/iop123123/arkts-static-skills | 81ec934c5060a2856cd2725e2979d275c6f76738 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test5_original_index.ets | arkts | testSwitchBreak | === Switch with break pattern (explicit fallthrough prevention) === | function testSwitchBreak(val: number): number {
let result: number = 0;
switch (val) {
case 1:
result = 10;
break;
case 2:
result = 20;
break;
case 3:
result = 30;
break;
default:
result = 99;
break;
}
return result;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSwitchBreak AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left val AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function testSwitchBreak(val: number): number {
let result: number = 0;
switch (val) {
case 1:
result = 10;
break;
case 2:
result = 20;
break;
case 3:
result = 30;
break;
default:
result = 99;
break;
}
return result;
} | https://github.com/miaochiahao/ark-ghidra | a8a321098081beab53058c1a3bca82a252fd9b54 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/input/search/components/MixedStyleSearch.ets | arkts | SearchInput | Extract reusable Search input component | @Builder
function SearchInput() {
Search({ value: '', placeholder: $r('app.string.search_placeholder_label') })
.width(SizeToken.SIZE_PERCENT_100)
.height(SizeToken.SIZE_NUM_40)
.backgroundColor($r('sys.color.comp_background_tertiary'))
.placeholderColor($r('sys.color.font_secondary'))
.placeholde... | 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 SearchInput AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Lef... | @Builder
function SearchInput() {
Search({ value: '', placeholder: $r('app.string.search_placeholder_label') })
.width(SizeToken.SIZE_PERCENT_100)
.height(SizeToken.SIZE_NUM_40)
.backgroundColor($r('sys.color.comp_background_tertiary'))
.placeholderColor($r('sys.color.font_secondary'))
.placeholde... | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | fe1ed53e0ca670c3d424b78d673b43ce919cc61c | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/StatsCalculator.ets | arkts | calculate | 根据统一视图的 DiffLine 数组计算统计信息
@param diffLines 统一视图的差异行数组
@returns DiffStats 统计结果 | static calculate(diffLines: DiffLine[]): DiffStats {
let addedCount = 0;
let deletedCount = 0;
let modifiedCount = 0;
let unchangedCount = 0;
let diffBlockCount = 0;
let inDiffBlock = false;
for (const line of diffLines) {
switch (line.type) {
case DiffType.ADDED:
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left diffLines AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_express... | static calculate(diffLines: DiffLine[]): DiffStats {
let addedCount = 0;
let deletedCount = 0;
let modifiedCount = 0;
let unchangedCount = 0;
let diffBlockCount = 0;
let inDiffBlock = false;
for (const line of diffLines) {
switch (line.type) {
case DiffType.ADDED:
... | https://github.com/XJTUWYD/ArkDiff | bc9694569bff0d19e1b7684f76d6ae5eff4faa3e | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/FrontendActionController.ets | arkts | execute | 执行前端动作
@param action 要执行的前端动作 | execute(action: FrontendAction): void {
switch (action) {
case FrontendAction.PAUSE:
this.gameViewState.setIsPaused(true)
break
case FrontendAction.FAST_FORWARD:
this.gameViewState.setIsFastForwardEnabled(!this.gameViewState.getIsFastForwardEnabled())
break
case... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left execute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FrontendAction AST#identifier#Right AST#)#Left... | execute(action: FrontendAction): void {
switch (action) {
case FrontendAction.PAUSE:
this.gameViewState.setIsPaused(true)
break
case FrontendAction.FAST_FORWARD:
this.gameViewState.setIsFastForwardEnabled(!this.gameViewState.getIsFastForwardEnabled())
break
case... | https://github.com/richshaw2015/nds | 86ee775c7c871754aa3863177ed9e322cd639e98 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | replaceObjectVariables | 递归替换对象中的变量 | private replaceObjectVariables(obj: Record<string, Object | undefined>, variables: VariableMap): Record<string, Object | undefined> {
const result: Record<string, Object | undefined> = {};
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const va... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replaceObjectVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instant... | private replaceObjectVariables(obj: Record<string, Object | undefined>, variables: VariableMap): Record<string, Object | undefined> {
const result: Record<string, Object | undefined> = {};
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const va... | https://github.com/DaLongZhuaZi/manxia | 45bf92326763fc83eff19879e0d4861b072af39a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CloudSyncRecordDAO.ets | arkts | deleteOldRecords | 删除旧的同步记录(保留最近N条) | static async deleteOldRecords(userId: number, keepCount: number = 50): Promise<void> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
const sql: string = `DELETE FROM ${CloudSyncRecord.tableName}
WHERE user_id = ? AND sync_id NOT IN (
SELECT sync_id... | 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 deleteOldRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left ... | static async deleteOldRecords(userId: number, keepCount: number = 50): Promise<void> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
const sql: string = `DELETE FROM ${CloudSyncRecord.tableName}
WHERE user_id = ? AND sync_id NOT IN (
SELECT sync_id... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e14886c84b2f89cf7f2244e5c3cd95e8250770a8 | github |
gongshijier/harmonyLab | entry/src/main/ets/components/Stream.ets | arkts | getFlavor | get feed flavor by key | getFlavor(key: string): Flavor {
var flavor = new Flavor()
switch (key) {
case '1':
flavor.lanes = 2
break;
case '3':
flavor.lanes = 2
break;
default:
break;
}
return flavor
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFlavor 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#)#... | getFlavor(key: string): Flavor {
var flavor = new Flavor()
switch (key) {
case '1':
flavor.lanes = 2
break;
case '3':
flavor.lanes = 2
break;
default:
break;
}
return flavor
} | https://github.com/gongshijier/harmonyLab | c56dc4e131133ae231a9e8fbafe6e9bef70f9330 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | getCurrentRotatedImage | Get rotate image.
@returns | private getCurrentRotatedImage(): RectF {
let flipImage = this.getCurrentFlipImage();
let points = MathUtils.rectToPoints(flipImage);
let origin = this.getDisplayCenter();
let rotated = MathUtils.rotatePoints(points, this.rotationAngle, origin);
let i = Math.abs(this.rotationAngle / CropAngle.ONE_... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentRotatedImage 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#L... | private getCurrentRotatedImage(): RectF {
let flipImage = this.getCurrentFlipImage();
let points = MathUtils.rectToPoints(flipImage);
let origin = this.getDisplayCenter();
let rotated = MathUtils.rotatePoints(points, this.rotationAngle, origin);
let i = Math.abs(this.rotationAngle / CropAngle.ONE_... | https://gitee.com/openharmony/codelabs.git | 0a9a8ea3f0c459d8d44446653d0ce0e111b15adf | gitee |
openharmony/codelabs | Card/StepsCardJS/entry/src/main/ets/common/utils/DatabaseUtils.ets | arkts | addSimulationData | Add simulation data.
@param {DataRdb.RdbStore} rdbStore RDB database. | addSimulationData(rdbStore: DataRdb.RdbStore) {
if (!rdbStore) {
Logger.error(CommonConstants.DATABASE_TAG, 'addSimulationData rdbStore is undefined');
return;
}
// Add the simulation data of yesterday.
let yesterday: SensorData = new SensorData();
yesterday.date = DateUtils.getDate(Co... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addSimulationData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rdbStore AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifi... | addSimulationData(rdbStore: DataRdb.RdbStore) {
if (!rdbStore) {
Logger.error(CommonConstants.DATABASE_TAG, 'addSimulationData rdbStore is undefined');
return;
}
// Add the simulation data of yesterday.
let yesterday: SensorData = new SensorData();
yesterday.date = DateUtils.getDate(Co... | https://gitee.com/openharmony/codelabs.git | 91e178f30578eee0dc17152c5185fe42ccc9dea7 | gitee |
openharmony/codelabs | ETSUI/SchoolTimeTable/entry/src/main/ets/service/CourseDataService.ets | arkts | addCourse | --- 增删改逻辑:先更新 UI (AppStorage),再保存到磁盘 --- | addCourse(course: Course): void {
const currentList = this.getAllCourses();
// 必须创建一个新数组引用,ArkUI 才能检测到变化
const newList = [...currentList, course];
AppStorage.Set(COURSE_LIST_KEY, newList); // 1. 触发 UI 刷新
this.saveCoursesToPreferences(newList); // 2. 异步保存
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addCourse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left course AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Course AST#identifier#Right AST#)#Left ) AST... | addCourse(course: Course): void {
const currentList = this.getAllCourses();
// 必须创建一个新数组引用,ArkUI 才能检测到变化
const newList = [...currentList, course];
AppStorage.Set(COURSE_LIST_KEY, newList); // 1. 触发 UI 刷新
this.saveCoursesToPreferences(newList); // 2. 异步保存
} | https://gitcode.com/openharmony/codelabs | 0b4f9df394ae60dfb4f232667a57b106821e17b6 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | detectReceiptType | 识别票据类型 | static detectReceiptType(text: string, merchantName: string): string {
const lowerText = (text + ' ' + merchantName).toLowerCase();
// 超市
const supermarketKeywords = ['超市', '便利店', '华润', '沃尔玛', '永辉', '大润发', 'mart', 'store'];
for (let i = 0; i < supermarketKeywords.length; i++) {
if (lowerText.in... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectReceiptType 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#Lef... | static detectReceiptType(text: string, merchantName: string): string {
const lowerText = (text + ' ' + merchantName).toLowerCase();
// 超市
const supermarketKeywords = ['超市', '便利店', '华润', '沃尔玛', '永辉', '大润发', 'mart', 'store'];
for (let i = 0; i < supermarketKeywords.length; i++) {
if (lowerText.in... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 47a9d8ab5918112edb1caefa1d6dbf82800bc327 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/AccessibilityConfig.ets | arkts | getFontSizeConfig | 获取字体大小配置 | public getFontSizeConfig(): FontSizeConfig {
const baseConfig: FontSizeConfig = {
title: 20,
body: 16,
caption: 14,
button: 16,
input: 16
};
// 老年模式字体增大
if (this.config.isElderMode) {
return {
title: 24,
body: 20,
caption: 18,
bu... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFontSizeConfig 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 Font... | public getFontSizeConfig(): FontSizeConfig {
const baseConfig: FontSizeConfig = {
title: 20,
body: 16,
caption: 14,
button: 16,
input: 16
};
// 老年模式字体增大
if (this.config.isElderMode) {
return {
title: 24,
body: 20,
caption: 18,
bu... | https://github.com/LJ666-ui/harmony-health-care | 789e3e576768cb95640471df6b04d16fc2f87a29 | github |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/CustomCalendar.ets | arkts | getDateInfo | 获取上下个月的年份和月份方法 | getDateInfo(date,num = 0){
let m_len = [31,28,31,30,31,30,31,31,30,31,30,31]; //月份的天数
let dd = new Date(date);
let y = dd.getFullYear();
let m = dd.getMonth() + 1;
let d = dd.getDate();
if(m + num > 12){
y = y + num;
m = 1;
} else if(m + num == 0) {
y = y + num;
m =... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDateInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left date AST#identifier#Right AST#,#Left , AST#,#Right AST#assignment_expression#Left AST#identifier#Left num AST#identifier#Right AST#... | getDateInfo(date,num = 0){
let m_len = [31,28,31,30,31,30,31,31,30,31,30,31]; //月份的天数
let dd = new Date(date);
let y = dd.getFullYear();
let m = dd.getMonth() + 1;
let d = dd.getDate();
if(m + num > 12){
y = y + num;
m = 1;
} else if(m + num == 0) {
y = y + num;
m =... | https://gitee.com/openharmony-sig/ohos_easyui.git | 44b140dc969c211334de84c489933c451cd3bb4a | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets | arkts | get | Returns a value associated with key if present
@param k the key to find in the HashMap/class
@returns value if associated with key presents. | get(key: K): V | undefined {
if (!this.buckets.has(key)) {
return undefined;
}
return this.buckets.get(key);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#... | get(key: K): V | undefined {
if (!this.buckets.has(key)) {
return undefined;
}
return this.buckets.get(key);
} | https://gitcode.com/iop123123/arkts-static-skills | 59a827ab84773c2d06263197dbc9ef501ec92a7c | gitcode |
LambdaYH/ScrcpyForHarmonyOS | app/src/main/ets/helper/ServerManager.ets | arkts | getSocketName | 获取socket名称 | static getSocketName(): string {
return `scrcpy_${ServerManager.lastScid}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSocketName 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#s... | static getSocketName(): string {
return `scrcpy_${ServerManager.lastScid}`;
} | https://github.com/LambdaYH/ScrcpyForHarmonyOS | a937ca08632b020186de3e1ed007c1172933e73d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets | arkts | getFirst | Returns the first element in a BlockingQueue.
@returns { T | undefined } the first element or undefined when the queue is empty. | override getFirst(): T | undefined {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
if (this.isQueueEmpty) {
return undefined;
}
const value = this.array[this.curHeadIdx];
return value;
} fin... | AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#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#ERROR#Right AST#express... | override getFirst(): T | undefined {
ConcurrencyHelpers.mutexLock(this.mutex);
try {
if (this.isQueueEmpty) {
return undefined;
}
const value = this.array[this.curHeadIdx];
return value;
} fin... | https://gitcode.com/iop123123/arkts-static-skills | e22f1582b0834ed41bfc499f4d6ad88bb6dfecec | gitcode |
XJTUWYD/ArkDiff | entry/src/main/ets/services/AnalyticsService.ets | arkts | getCounts | 获取事件计数聚合(只读视图) | static getCounts(): Record<string, number> {
AnalyticsService.init();
return AnalyticsService.counts;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCounts 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_s... | static getCounts(): Record<string, number> {
AnalyticsService.init();
return AnalyticsService.counts;
} | https://github.com/XJTUWYD/ArkDiff | 8f5810d06e4454d6979899f3dae0dc7d6d95c719 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Utils.ets | arkts | getNormalizedAngle | returns an angle between 0.f < 360.f (not less than zero, less than 360) | public static getNormalizedAngle(angle: number): number {
while (angle < 0)
angle += 360;
return angle % 360;
} | 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 getNormalizedAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Lef... | public static getNormalizedAngle(angle: number): number {
while (angle < 0)
angle += 360;
return angle % 360;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ec0bd08edef13c21c0bbc91931ca4611e4fd0888 | gitee |
fbinba3955/Flymby | main/src/main/ets/pages/player/EmbyPlayer.ets | arkts | onWillAppear | 当前剧集索引
-------- 逻辑内容 --------- | onWillAppear() {
this.init()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWillAppear 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 ... | onWillAppear() {
this.init()
} | https://github.com/fbinba3955/Flymby | 6e5ed01de7e259da9f4ff198a0cc59cb745a218b | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | stopReminderTimer | 停止提醒定时器 | private stopReminderTimer(): void {
if (this.reminderTimer !== -1) {
clearInterval(this.reminderTimer);
this.reminderTimer = -1;
console.log('提醒定时器已停止');
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopReminderTimer 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#e... | private stopReminderTimer(): void {
if (this.reminderTimer !== -1) {
clearInterval(this.reminderTimer);
this.reminderTimer = -1;
console.log('提醒定时器已停止');
}
} | https://gitcode.com/openharmony/codelabs | 6526e455e3cd518ce2c9d85cbf4cd5457989c883 | gitcode |
genjishare/snake-game | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBoundaryCollisionFlow | 处理边界碰撞的分布式流转逻辑
优先使用现有连接,如无连接则建立新连接 | handleBoundaryCollisionFlow() {
hilog.info(DOMAIN, TAG, '开始处理边界碰撞分布式流转');
// 检查是否有现有的caller连接
if (caller) {
hilog.info(DOMAIN, TAG, '发现现有caller连接,尝试使用现有连接进行流转');
this.useExistingConnectionForFlow();
return;
}
// 检查是否有现有的gameDataObject
if (gameDataObject) {
hil... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleBoundaryCollisionFlow 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#statem... | handleBoundaryCollisionFlow() {
hilog.info(DOMAIN, TAG, '开始处理边界碰撞分布式流转');
// 检查是否有现有的caller连接
if (caller) {
hilog.info(DOMAIN, TAG, '发现现有caller连接,尝试使用现有连接进行流转');
this.useExistingConnectionForFlow();
return;
}
// 检查是否有现有的gameDataObject
if (gameDataObject) {
hil... | https://github.com/genjishare/snake-game | 45378b50a44c35d058f3fa59db15113da2334776 | github |
openharmony-tpc/ohos_mail_base | test/src/ohosTest/ets/test/store.test.ets | arkts | loopTest | 为方便每条用例测试多个邮箱,将共性代码抽离后,仅填写业务核心代码即可
P.S.目前无法使用!!!原因不明!!!仅供参考!!!
异常描述:会导致it方法直接返回测试通过
@param testCore 待测试业务的核心代码
@param foldNames 带创建的文件夹名称,如字段不为空,则会在每次循环结束时进行删除 | async function loopTest(testCore: (store: IStore, prop: Properties) => void, foldNames: string[] | null = null) {
for (let i = 0; i < props.length; i++) {
const store = new ImapStore();
const prop = props[i];
store.setProperties(prop);
testCore(store, prop)
if (foldNames) {
safeResetFold(sto... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left loopTest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left testCore AST#identifier#Right AST#type_a... | async function loopTest(testCore: (store: IStore, prop: Properties) => void, foldNames: string[] | null = null) {
for (let i = 0; i < props.length; i++) {
const store = new ImapStore();
const prop = props[i];
store.setProperties(prop);
testCore(store, prop)
if (foldNames) {
safeResetFold(sto... | https://gitee.com/openharmony-tpc/ohos_mail_base.git | 3798af316800b34540dabbadf73e6136fc8103ea | gitee |
Explore-In-HMOS-Wearable/how-to-use-weather-kit | entry/src/main/ets/constants/WearableLayout.ets | arkts | calculateCardHeight | Calculate card height based on content | static calculateCardHeight(
hasHeader: boolean = true,
hasContent: boolean = true,
hasFooter: boolean = false,
contentLines: number = 1
): number {
let height = 0;
if (hasHeader) {
height += 40
};
if (hasContent) {
height += Math.max(contentLines * 20, 60)
};
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateCardHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hasHeader AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignm... | static calculateCardHeight(
hasHeader: boolean = true,
hasContent: boolean = true,
hasFooter: boolean = false,
contentLines: number = 1
): number {
let height = 0;
if (hasHeader) {
height += 40
};
if (hasContent) {
height += Math.max(contentLines * 20, 60)
};
... | https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit | a677624f8f6258d10048a7ad6c81b9f2961ba111 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | bytesToHex | 字节数组转十六进制字符串 | private static bytesToHex(bytes: Uint8Array): string {
return Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
} | 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 bytesToHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : A... | private static bytesToHex(bytes: Uint8Array): string {
return Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ecd994251f3c5149befddc6ff0f8f6a3473e0d14 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an array-like object.
@param { ArrayLike<T> } arrayLike - An array-like object to convert to an array.
@param { function } mapfn - A mapping function to call on every element of the array.
@returns { Uint8ClampedArray } - A new Uint8ClampedArray
@static
@syscap SystemCapability.Utils.Lang
@FaAndSt... | public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Uint8ClampedArray {
let res = new Uint8ClampedArray(arrayLike.length)
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identif... | public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Uint8ClampedArray {
let res = new Uint8ClampedArray(arrayLike.length)
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda ... | https://gitcode.com/iop123123/arkts-static-skills | 6098d86a0fb81c89d82e4d3c44cfdc3534e7bdde | gitcode |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | updateCurTime | 更新播放歌曲当前进度时间
@param curTime 当前进度时间
@returns {void} | updateCurTime(curTime: number): void {
if (!this.curMusicModelRaw) {
return;
}
this.curTimeRaw = curTime;
this.curTimeStrRaw = this.genTimeStr(curTime);
this.curProgressRaw = curTime / this.curMusicModelRaw.totalTime * CommonConstants.MUSIC_SLIDER_MAX;
this.curMusiclyricsLineRaw = this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateCurTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left curTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#... | updateCurTime(curTime: number): void {
if (!this.curMusicModelRaw) {
return;
}
this.curTimeRaw = curTime;
this.curTimeStrRaw = this.genTimeStr(curTime);
this.curProgressRaw = curTime / this.curMusicModelRaw.totalTime * CommonConstants.MUSIC_SLIDER_MAX;
this.curMusiclyricsLineRaw = this.... | https://gitcode.com/arkui-x/samples | f42dce7bcfd50a2df4890f30b77e7ffc1b3de452 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/rollingText/index.ets | arkts | getTargetNumArr | 获取目标数字的数组 | getTargetNumArr(){
return padZero(this.targetNum, this.getLength()).split('')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTargetNumArr 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... | getTargetNumArr(){
return padZero(this.targetNum, this.getLength()).split('')
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/rollingText/index.ets#L96-L98 | 1b9e6116f666c1312e8f810728e2c038507fcca0 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Float32Array that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: float) => boolean): int {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.findLastIndex(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: float) => boolean): int {
let newF: (val: float, index: int, array: Float32Array) => boolean =
(val: float, index: int, array: Float32Array): boolean => { return fn(val) }
return this.findLastIndex(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f20d82d5804664fc0c523eaa61ef3c9b0d8f05b2 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test26_original_index.ets | arkts | testSetFromArray | --- Set constructor from array --- | function testSetFromArray(): string {
let nums: number[] = [1, 2, 2, 3, 3, 3, 4];
let s: Set<number> = new Set<number>();
for (let i: number = 0; i < nums.length; i++) {
s.add(nums[i]);
}
return String(s.size);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSetFromArray 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 testSetFromArray(): string {
let nums: number[] = [1, 2, 2, 3, 3, 3, 4];
let s: Set<number> = new Set<number>();
for (let i: number = 0; i < nums.length; i++) {
s.add(nums[i]);
}
return String(s.size);
} | https://github.com/miaochiahao/ark-ghidra | f80222ea521c5bd488a740a16a87b72f4ecb2657 | github |
2763981847/Clock-Alarm | entry/src/main/ets/pages/AlarmClockPage.ets | arkts | aboutToDisappear | 在页面即将消失时触发的生命周期函数 | aboutToDisappear() {
// 清除定时器
clearInterval(this.intervalId);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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#L... | aboutToDisappear() {
// 清除定时器
clearInterval(this.intervalId);
} | https://github.com/2763981847/Clock-Alarm | 3b692d5dd60e593b435a6ebb17a15ec1569affac | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | removeListener | 移除监听器 | public removeListener(listener: TrackRecordListener): void {
this.listeners.delete(listener);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public removeListener(listener: TrackRecordListener): void {
this.listeners.delete(listener);
} | https://github.com/DaLongZhuaZi/manxia | 967c7949ce02bd9132dcfe4934328fc03373ee24 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets | arkts | getAllTags | 获取所有标签 | async getAllTags(): Promise<Tag[]> {
if (!this.rdbStore) {
return []
}
try {
const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_TAG)
predicates.orderByAsc('createdAt')
const resultSet = await this.rdbStore.query(predicates)
const tags: Tag[] = []
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllTags AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#... | async getAllTags(): Promise<Tag[]> {
if (!this.rdbStore) {
return []
}
try {
const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_TAG)
predicates.orderByAsc('createdAt')
const resultSet = await this.rdbStore.query(predicates)
const tags: Tag[] = []
... | https://gitcode.com/openharmony/codelabs | 5abc2a426a6eca69e8b76456112ba26e9f9e2f74 | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | onProgressChange | Fetches url and title from controller and syncs it to the UI.
Also calls to save web state and history. | onProgressChange() {
try {
let url = this.controller?.getUrl();
if (url == this.url) {
return;
}
// Update Settings
this.getUrlTitleFromController(); // Update class attributes.
this.updateWebSettings();
// Update info & UI
this.syncUrlUI();
meow(`o... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onProgressChange 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#L... | onProgressChange() {
try {
let url = this.controller?.getUrl();
if (url == this.url) {
return;
}
// Update Settings
this.getUrlTitleFromController(); // Update class attributes.
this.updateWebSettings();
// Update info & UI
this.syncUrlUI();
meow(`o... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 8924eef2e9280c50106ab2fd93d505e35fa59a61 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | showRemoveFromGroupDialog | 显示从分组移除对话框 | showRemoveFromGroupDialog(): void {
this.openGroupPickerDialog('remove');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showRemoveFromGroupDialog 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#st... | showRemoveFromGroupDialog(): void {
this.openGroupPickerDialog('remove');
} | https://github.com/DaLongZhuaZi/manxia | a7ef68c07659e2eac1e182be5863037ede270b34 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | writableLength | Size of data that can be flushed, in bytes or objects. | get writableLength(): int {
return this.writableLengthInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left writableLength 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 int AST#identifi... | get writableLength(): int {
return this.writableLengthInner;
} | https://gitcode.com/iop123123/arkts-static-skills | a6e7f38e4e7093d77dabdbb54ae94c38778b15b1 | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | approvalAction | 审批操作(同意/拒绝/转交) | async approvalAction(data: { approvalId: string; nodeId: string; action: string; comment?: string; transferAssigneeId?: string }): Promise<ApiResponse<any>> {
return this.post<any>('/api/approval/approvals/action', data)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left approvalAction AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async approvalAction(data: { approvalId: string; nodeId: string; action: string; comment?: string; transferAssigneeId?: string }): Promise<ApiResponse<any>> {
return this.post<any>('/api/approval/approvals/action', data)
} | https://github.com/David8Idira/AI-OA | e518647f9f1bcac271c10fa09400b86607852e8c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/NativeHidController.ets | arkts | inputLoop | ArkTS 后备轮询循环(当 Native Poller 不可用时使用) | private async inputLoop(): Promise<void> {
const buffer = new Uint8Array(this.inputMaxPacketSize);
// USB 读取超时时间(与 Android 一致为 3000ms)
// 用于判断错误是超时还是真正的 I/O 错误
const BULK_READ_TIMEOUT = 3000;
// 快速失败阈值:如果读取在超时之前就失败(耗时 < 1秒),认为是 I/O 错误
const QUICK_FAIL_THRESHOLD = 1000;
// 轮询率统计
... | 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 inputLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | private async inputLoop(): Promise<void> {
const buffer = new Uint8Array(this.inputMaxPacketSize);
// USB 读取超时时间(与 Android 一致为 3000ms)
// 用于判断错误是超时还是真正的 I/O 错误
const BULK_READ_TIMEOUT = 3000;
// 快速失败阈值:如果读取在超时之前就失败(耗时 < 1秒),认为是 I/O 错误
const QUICK_FAIL_THRESHOLD = 1000;
// 轮询率统计
... | https://github.com/AlkaidLab/moonlight-harmony | ee5d9a9d2d6769712ba17d161fe6ebe31b1c4a8c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/settings/MainMenuSettingsSubPage.ets | arkts | getMangaDetailPageType | 获取漫画场景的详情页类型 | static getMangaDetailPageType(): DetailPageType {
// 强制模式下直接返回 UNIFIED
if (PageSettingsHelper.isForceUnifiedEnabled()) {
return DetailPageType.UNIFIED;
}
const type = PageSettingsHelper.settingsManager.getString(PageSettingKeys.MANGA_DETAIL_PAGE_TYPE, DetailPageType.DEFAULT);
return type as ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMangaDetailPageType 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... | static getMangaDetailPageType(): DetailPageType {
// 强制模式下直接返回 UNIFIED
if (PageSettingsHelper.isForceUnifiedEnabled()) {
return DetailPageType.UNIFIED;
}
const type = PageSettingsHelper.settingsManager.getString(PageSettingKeys.MANGA_DETAIL_PAGE_TYPE, DetailPageType.DEFAULT);
return type as ... | https://github.com/DaLongZhuaZi/manxia | 1351bd2c22203f81f3732ba1b99825b904ce6bb6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | set | Copies all elements of arr to the current Int8Array.
@param arr array to copy data from | public set(arr: number[]): void {
this.set(arr, 0)
} | 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 arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: number[]): void {
this.set(arr, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 14cbaf82ef389cf30ef76b53dd43f79ee739a209 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/expandabletext/OmniExpandableText.ets | arkts | getTextHeight | 返回文本所占布局高度,单位为px
@param options
@returns | getTextHeight(options: MeasureOptions) {
return this.getUIContext().getMeasureUtils().measureTextSize(options).height as number;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTextHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MeasureOptions AST#ident... | getTextHeight(options: MeasureOptions) {
return this.getUIContext().getMeasureUtils().measureTextSize(options).height as number;
} | https://github.com/wuba/omni-ui | 52597fdf0b149051001cc5383f82752654493da4 | github |
2763981847/Accounting-app | entry/src/main/ets/common/database/Rdb.ets | arkts | insertData | 插入单条数据
@param data - 要插入的数据
@param callback - 插入成功后的回调函数 | insertData(data: relationalStore.ValuesBucket, callback: Function = () => {
}): void {
// 调用批量插入的方法,传入单条数据
this.batchInsert([data], callback);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertData 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#member_expression#Left AST#identifier#Left relationalStore AS... | insertData(data: relationalStore.ValuesBucket, callback: Function = () => {
}): void {
// 调用批量插入的方法,传入单条数据
this.batchInsert([data], callback);
} | https://github.com/2763981847/Accounting-app | cfb4694b469f10fad7a42de227ab62757d77f81a | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/MessageManager.ets | arkts | generateMessageId | Generate unique message ID. | private static generateMessageId(): string {
return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | 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 generateMessageId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private static generateMessageId(): string {
return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | https://github.com/Harrisonls2004/WaterFlow | 3a97761d3b6338cb07f53a28a2c672d6cd88f45a | github |
yangyongzhen/hmmovie | entry/src/main/ets/utils/EfAVPlayer.ets | arkts | onTimeUpdate | 用于设置时间更新的回调函数。
@param callback - 时间更新的回调函数,接收时间参数并返回 void。 | async onTimeUpdate(callback: (time: number) => void) {
this.timeUpdateCallback = callback;
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onTimeUpdate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left... | async onTimeUpdate(callback: (time: number) => void) {
this.timeUpdateCallback = callback;
} | https://github.com/yangyongzhen/hmmovie | 93991f5e2dd28e776d8860eca1d2bacd7a92104c | github |
arkui-x/samples | CodeLab/Cases/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets | arkts | setCrossAxis | 设置交叉轴位置 | setCrossAxis(event: GestureEvent) {
// list当前没有在移动 && 交叉轴时候如果没有放大也不移动
let isScale = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue;
let listOffset = Math.abs(this.imageListOffset);
if (listOffset > this.moveMaxOffset) {
this.isMoveCrossAxis = false;
}
if (this.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCrossAxis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GestureEvent AST#identifier... | setCrossAxis(event: GestureEvent) {
// list当前没有在移动 && 交叉轴时候如果没有放大也不移动
let isScale = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue;
let listOffset = Math.abs(this.imageListOffset);
if (listOffset > this.moveMaxOffset) {
this.isMoveCrossAxis = false;
}
if (this.... | https://gitcode.com/arkui-x/samples | f180dae6903126fb6d1145c9b2dcdc985579c386 | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/deviceAwareness/facades/AccessibilityFacade.ets | arkts | buildAccessibilityHint | 生成推荐的无障碍提示文本(hint) | buildAccessibilityHint(action: string): string {
return '双击执行: ' + action;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildAccessibilityHint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | buildAccessibilityHint(action: string): string {
return '双击执行: ' + action;
} | https://github.com/DaLongZhuaZi/NGF | b2356c237db96a12d41dcded1b9d02fa7896ccc0 | github |
asasugar/HarmoneyNote | entry/src/main/ets/viewmodel/BusinessViewModel.ets | arkts | getTabItems | Get tab items of businessCard page.
@return {Array<TabItemData>} tabItems. | getTabItems(): Array<TabItemData> {
let tabItems: Array<TabItemData> = [];
for (let i = 0; i < CommonConstants.TAB_SIZE; i++) {
let tabItem = new TabItemData();
tabItem.index = i;
tabItem.imageOriginal = $r('app.media.ic_tab_normal');
tabItem.imageActivated = $r('app.media.ic_tab_activ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTabItems 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 ... | getTabItems(): Array<TabItemData> {
let tabItems: Array<TabItemData> = [];
for (let i = 0; i < CommonConstants.TAB_SIZE; i++) {
let tabItem = new TabItemData();
tabItem.index = i;
tabItem.imageOriginal = $r('app.media.ic_tab_normal');
tabItem.imageActivated = $r('app.media.ic_tab_activ... | https://github.com/asasugar/HarmoneyNote | 52cbc782a80f8125621daf4b0872408360321697 | github |
HarmonyOS_Samples/arkts-clock | entry/src/main/ets/utils/DrawClock.ets | arkts | drawMinute | Draw the minute hand | drawMinute(context: CanvasRenderingContext2D, radius: number, minute: number) {
context.save();
context.beginPath();
context.lineWidth = 5;
context.lineCap = 'round';
let rad = 2 * Math.PI / 60 * minute;
context.rotate(rad);
context.moveTo(0, 10);
context.strokeStyle = '#000';
cont... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawMinute 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#identifier#Left CanvasRenderingContext2D AS... | drawMinute(context: CanvasRenderingContext2D, radius: number, minute: number) {
context.save();
context.beginPath();
context.lineWidth = 5;
context.lineCap = 'round';
let rad = 2 * Math.PI / 60 * minute;
context.rotate(rad);
context.moveTo(0, 10);
context.strokeStyle = '#000';
cont... | https://gitcode.com/HarmonyOS_Samples/arkts-clock | 57d44d8fbbf42278f465285dd8b6eb7e0001efdd | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/ChatService.ets | arkts | generateMessageId | 生成消息ID | private generateMessageId(): string {
return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateMessageId 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 strin... | private generateMessageId(): string {
return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | https://github.com/LJ666-ui/harmony-health-care | a3cdd9acef5d06b13a9bd79c57f04e26c2ab9a8f | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.