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
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ImageCropper.ets
arkts
computeCropRectWithOptions
根据对齐与缩放选项计算裁剪矩形
function computeCropRectWithOptions(srcWidth: number, srcHeight: number, options: CropOptions): CropRect { const baseRect = computeCenterCropRect(srcWidth, srcHeight, options.targetRatio); const zoomFactor = options.zoom <= 1.0 ? 1.0 : options.zoom; // 按缩放系数缩小裁剪区域,保持比例不变 const targetWidth = Math.max(1, Math.fl...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left computeCropRectWithOptions AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left srcWidth AST#identifier#Right AST#type_annotation#Left AST#...
function computeCropRectWithOptions(srcWidth: number, srcHeight: number, options: CropOptions): CropRect { const baseRect = computeCenterCropRect(srcWidth, srcHeight, options.targetRatio); const zoomFactor = options.zoom <= 1.0 ? 1.0 : options.zoom; // 按缩放系数缩小裁剪区域,保持比例不变 const targetWidth = Math.max(1, Math.fl...
https://github.com/DaLongZhuaZi/manxia
d19955faa1d135ab1921358ff4fee97d3d0f02e9
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/TimerViewModel.ets
arkts
getRemaining
获取剩余时间
getRemaining(): number { return this.remaining; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRemaining AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement...
getRemaining(): number { return this.remaining; }
https://github.com/zcg741/chengyu-game
973d5b24269bdbc1593fe152b4d8bc20c394f546
github
apap6628114/nga_oh
entry/src/main/ets/parser/bbcode/parser.ets
arkts
parseListItems
解析列表项:[*] 分隔,每项 trim 后递归解析。
function parseListItems(state: ParseState): BBNode[] { const items: BBNode[] = [] while (state.pos < state.len) { const starIdx = state.content.indexOf('[*]', state.pos) const closeIdx = state.content.indexOf('[/list]', state.pos) if (starIdx < 0 || (closeIdx >= 0 && starIdx > closeIdx)) { if (clo...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseListItems AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left state AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function parseListItems(state: ParseState): BBNode[] { const items: BBNode[] = [] while (state.pos < state.len) { const starIdx = state.content.indexOf('[*]', state.pos) const closeIdx = state.content.indexOf('[/list]', state.pos) if (starIdx < 0 || (closeIdx >= 0 && starIdx > closeIdx)) { if (clo...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/bbcode/parser.ets#L198-L222
236298e3ab4a36484ff2cd8dd7bfdc9ac1e15e3e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
processAction
处理单个操作,替换变量
private processAction(action: Action, variables: VariableMap): Action { const processedAction = this.cloneAction(action); // 替换字符串字段中的变量 if (this.hasUrlProperty(processedAction) && (processedAction as NavigateAction).url) { (processedAction as NavigateAction).url = this.replaceVariables((processe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processAction 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#Le...
private processAction(action: Action, variables: VariableMap): Action { const processedAction = this.cloneAction(action); // 替换字符串字段中的变量 if (this.hasUrlProperty(processedAction) && (processedAction as NavigateAction).url) { (processedAction as NavigateAction).url = this.replaceVariables((processe...
https://github.com/DaLongZhuaZi/manxia
cef6fd0b82ee8b41f79f02397df0e2419d07a9bd
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnRegionPickerViewModel.ets
arkts
toggleCustomRegionPicker
切换自定义数据选择器弹出层显示状态
toggleCustomRegionPicker(): void { this.customRegionOpen = !this.customRegionOpen; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleCustomRegionPicker 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#sta...
toggleCustomRegionPicker(): void { this.customRegionOpen = !this.customRegionOpen; }
https://github.com/codelably/tuniao-ui
90bba80e8e618f12dbe82eb02de235e529e37337
github
LZZLHY/hlib
entry/src/main/ets/storage/ReadingPositionStore.ets
arkts
get
读单本进度,返回 0..100 或 undefined。
static async get(bookId: string): Promise<number | undefined> { if (bookId.length === 0) { return undefined; } const map = await ReadingPositionStore.loadAll(); const v: number | undefined = map[bookId]; return typeof v === 'number' && Number.isFinite(v) ? v : undefined; }
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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right...
static async get(bookId: string): Promise<number | undefined> { if (bookId.length === 0) { return undefined; } const map = await ReadingPositionStore.loadAll(); const v: number | undefined = map[bookId]; return typeof v === 'number' && Number.isFinite(v) ? v : undefined; }
https://github.com/LZZLHY/hlib
ee1f81a12cce1d4ff6acedbd0d20c3b516c33601
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getGlassRadius
获取玻璃效果圆角(使用延迟加载的用户配置)
private getGlassRadius(): number { const _theme = this.themeState.currentTheme; return this.userThemeCornerRadius; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getGlassRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number A...
private getGlassRadius(): number { const _theme = this.themeState.currentTheme; return this.userThemeCornerRadius; }
https://github.com/DaLongZhuaZi/manxia
5194238bef7168f7f3d266a0a1b5b7aa62a7b709
github
arkui-x/samples
CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/ArrayUtil.ets
arkts
listNoRepeatDate
删除数组中重复元素 param 数组对象 @returns Array
static listNoRepeatDate<T>(list: T[]) { if (null === list || undefined === list || list.length === 0) { return; } return Array.from(new Set(list)); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left listNoRepeatDate AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#parenthesized_expressio...
static listNoRepeatDate<T>(list: T[]) { if (null === list || undefined === list || list.length === 0) { return; } return Array.from(new Set(list)); }
https://gitcode.com/arkui-x/samples
ba61cfca8054559ecb4825f81bf5193ce2e7e1d4
gitcode
dingzhilin1990/zhilinclaw
src/skills/SkillRegistry.ets
arkts
getAllSkills
获取所有技能
public getAllSkills(): Skill[] { return Array.from(this.skills.values()).map(w => w.skill); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllSkills 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 Skill AST...
public getAllSkills(): Skill[] { return Array.from(this.skills.values()).map(w => w.skill); }
https://github.com/dingzhilin1990/zhilinclaw
c9f0e1164c037dfa7b8c99cce9e56be47a1b759d
github
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
saveUsers
保存用户数据
private async saveUsers(users: Map<string, UserInfo>): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const usersObj: Record<string, object> = {}; users.forEach((value: UserInfo, key: string) => { const userRecord: Record<string, string | number> = ...
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 saveUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left users AST#identifier#Rig...
private async saveUsers(users: Map<string, UserInfo>): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const usersObj: Record<string, object> = {}; users.forEach((value: UserInfo, key: string) => { const userRecord: Record<string, string | number> = ...
https://github.com/the-wwyang/kids-learning-app
9f72b958036203866d7ed5b49da4225a0185b026
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
getStatistics
获取训练数据统计
static async getStatistics(userId: number): Promise<TrainingStatistics> { try { const store = DatabaseManager.getDatabase(); // 统计总记录数和各类型数量 const sql = ` SELECT COUNT(*) as total_records, SUM(CASE WHEN training_type = 'manual' OR training_type = 'auto' THEN 1 ELSE 0...
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 getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A...
static async getStatistics(userId: number): Promise<TrainingStatistics> { try { const store = DatabaseManager.getDatabase(); // 统计总记录数和各类型数量 const sql = ` SELECT COUNT(*) as total_records, SUM(CASE WHEN training_type = 'manual' OR training_type = 'auto' THEN 1 ELSE 0...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
71db9d3c15cb8a522498def09384f7905e342202
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onSliderAngleChange
Change rotate angle.
onSliderAngleChange(angle: number): void { Logger.debug(TAG, `onSliderAngleChange: angle[${angle}]`); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); this.refresh(); } this.sliderAngle = angle; this.cropShow.syncHorizontalAngle(this.sliderA...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSliderAngleChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L...
onSliderAngleChange(angle: number): void { Logger.debug(TAG, `onSliderAngleChange: angle[${angle}]`); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); this.refresh(); } this.sliderAngle = angle; this.cropShow.syncHorizontalAngle(this.sliderA...
https://gitee.com/openharmony/codelabs.git
58894359662b07300f32689ffc37c01be963a08f
gitee
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/custom/styles/StylesPage.ets
arkts
globalFancy
定义在全局的@Styles封装的样式 是一个函数 TODO 只支持通用属性 不能传参数
@Styles function globalFancy() { .width(150) .height(100) .backgroundColor(Color.Pink) .onClick(() => { promptAction.showToast({message: "点击了全局样式"}) }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Styles AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left globalFancy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left...
@Styles function globalFancy() { .width(150) .height(100) .backgroundColor(Color.Pink) .onClick(() => { promptAction.showToast({message: "点击了全局样式"}) }) }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/custom/styles/StylesPage.ets#L5-L13
23b725b29d5a43e96e36d537903197e327e8735c
github
arkui-x/samples
CodeLab/Cases/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets
arkts
setDate
将数据写入缓存的Preferences实例中,并使数据持久化 @param { Context } Context - 应用上下文 @param { DateModel } dateModel - 日期数据类 @param { function } callback - 回调函数
static setDate(context: Context, dateModel: DateModel, callback: () => void) { try { // 获取Preferences实例 let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferences) => { try { // 将数据写入缓存的Preferences实例中 let setPromise...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left setDate AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Right AST#,#Left , AST#,#R...
static setDate(context: Context, dateModel: DateModel, callback: () => void) { try { // 获取Preferences实例 let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferences) => { try { // 将数据写入缓存的Preferences实例中 let setPromise...
https://gitcode.com/arkui-x/samples
f85730fcd4304e3cf5440fc36394239ef53542ef
gitcode
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets
arkts
onDeleteSurface
Called by the native engine after a surface has been destroyed. Delegates to the host component to unmount the corresponding AGenUIContainer. @param surface - The destroyed surface descriptor.
onDeleteSurface(surface: Surface): void { hilog.info(DOMAIN, TAG, `Surface destroyed: ${surface.surfaceId}`); if (this.indexComponent) { this.indexComponent.removeAGenUIContainer(surface.surfaceId); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDeleteSurface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left surface AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Surface AST#identifier#Right AST#)#Le...
onDeleteSurface(surface: Surface): void { hilog.info(DOMAIN, TAG, `Surface destroyed: ${surface.surfaceId}`); if (this.indexComponent) { this.indexComponent.removeAGenUIContainer(surface.surfaceId); } }
https://github.com/AGenUI/AGenUI
ae0a9f918d9fe693b3ba5f36a64ecf40f6186fdd
github
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets
arkts
dialogDisappear
弹框消失的回调,需要判断是否是用户主动终止解密流程
public async dialogDisappear(requestId: string): Promise<void> { this.printAllDecryptingMap(); HiLog.info(TAG, `OpeningDialogManager dialogDisappear requestId ${requestId}`); this._showDialogState = false; const decryptingState: DecryptingState | undefined = this._decryptingMap.get(requestId); if ...
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 dialogDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async dialogDisappear(requestId: string): Promise<void> { this.printAllDecryptingMap(); HiLog.info(TAG, `OpeningDialogManager dialogDisappear requestId ${requestId}`); this._showDialogState = false; const decryptingState: DecryptingState | undefined = this._decryptingMap.get(requestId); if ...
https://gitee.com/openharmony/applications_dlp_manager.git
10a8f8956054bcf12edacfabb4ed5509a18de526
gitee
OHPG/FinMusic
entry/src/main/ets/data/Repository.ets
arkts
getRandomMedia
查询随机音频 @returns
public async getRandomMedia(): Promise<Array<BaseItemDto>> { return this.requireApi().getRandomMedia(this.currentLibrary?.Id) }
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 getRandomMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async getRandomMedia(): Promise<Array<BaseItemDto>> { return this.requireApi().getRandomMedia(this.currentLibrary?.Id) }
https://github.com/OHPG/FinMusic
9cfefec096069bd30d6e18a7c96a2831e77f7a75
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseDataSet.ets
arkts
setColorsByVariable
Sets the colors that should be used fore this DataSet. Colors are reused as soon as the number of Entries the DataSet represents is higher than the size of the colors array. If you are using colors from the resources, make sure that the colors are already prepared (by calling getResources().getColor(...)) before adding...
public setColorsByVariable(colors: number[]): void { this.mColors = ColorTemplate.createColors(colors); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setColorsByVariable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_...
public setColorsByVariable(colors: number[]): void { this.mColors = ColorTemplate.createColors(colors); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
3c1d371d2167c9e5e9ece220973e46b82b6305af
gitee
ibestservices/ibest-ui
library/src/main/ets/components/contactAddress/index.ets
arkts
setFormValues
设置表单数据
setFormValues(val: IBestContactAddressFormResult) { this.phone = val.phone this.provinceCityDistrict = [ { text: val.province, value: val.provinceCode }, { text: val.city, value: val.cityCode }, { text: val.area, value: val.areaCode }, ] this.provinceCityDistrictStr = this.provinceCityDistrict .fil...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFormValues 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 IBestContactAddressFormResul...
setFormValues(val: IBestContactAddressFormResult) { this.phone = val.phone this.provinceCityDistrict = [ { text: val.province, value: val.provinceCode }, { text: val.city, value: val.cityCode }, { text: val.area, value: val.areaCode }, ] this.provinceCityDistrictStr = this.provinceCityDistrict .fil...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/contactAddress/index.ets#L140-L156
6794c4b6de46b943c46eb3f4fb3b9110cc89c464
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/models/repo/TagModel.ets
arkts
fromJSON
tag颜色 从json获取数据
fromJSON(json: string) { let obj = JSON.parse(json) this._name = obj.name this._color = `#${obj.color}` }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fromJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#...
fromJSON(json: string) { let obj = JSON.parse(json) this._name = obj.name this._color = `#${obj.color}` }
https://gitee.com/openharmony-sig/online_event.git
0633359639f8569dbe78515605e07e2dc9b3ff74
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/AccessibilityConfig.ets
arkts
getPagePadding
获取页面边距
public getPagePadding(): number { return this.config.isElderMode ? 20 : 16; // dp }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPagePadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#...
public getPagePadding(): number { return this.config.isElderMode ? 20 : 16; // dp }
https://github.com/LJ666-ui/harmony-health-care
4e17419f8725d3cc5680cdf54788a57591781f1c
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/PaginationManager.ets
arkts
hasPrefetchedPage
判断指定页是否已有预取缓存。 @param page - 页码 @returns 是否已缓存
hasPrefetchedPage(page: number): boolean { return this.prefetchedPages.has(page) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasPrefetchedPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left...
hasPrefetchedPage(page: number): boolean { return this.prefetchedPages.has(page) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L69-L71
8d4ccf230d99a97f2597c32efe74b55b46e77dbe
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
importFromJSON
导入书源(从JSON字符串) 支持单个书源或书源数组,同时持久化到数据库
async importFromJSON( jsonStr: string, persistToDb: boolean = true, options?: NovelSourceImportOptions ): Promise<LegadoSourceImportResult[]> { const results: LegadoSourceImportResult[] = []; const parser = new LegadoSourceParser(); const sources = parser.parseMultipleFromJSON(jsonStr); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importFromJSON AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left jsonStr AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async importFromJSON( jsonStr: string, persistToDb: boolean = true, options?: NovelSourceImportOptions ): Promise<LegadoSourceImportResult[]> { const results: LegadoSourceImportResult[] = []; const parser = new LegadoSourceParser(); const sources = parser.parseMultipleFromJSON(jsonStr); ...
https://github.com/DaLongZhuaZi/manxia
da48d8217f70f2911616fed01349fca05b42d5b2
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
markVideoExported
标记视频为已导出
public async markVideoExported(videoId: number): Promise<void> { const predicates = new relationalStore.RdbPredicates("t_video_record"); predicates.equalTo("id", videoId); try { await this.getStore().update({ is_exported: 1 }, predicates); hilog.info(DOMAIN, TAG, `markVideoExported id=${videoI...
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 markVideoExported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left videoId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async markVideoExported(videoId: number): Promise<void> { const predicates = new relationalStore.RdbPredicates("t_video_record"); predicates.equalTo("id", videoId); try { await this.getStore().update({ is_exported: 1 }, predicates); hilog.info(DOMAIN, TAG, `markVideoExported id=${videoI...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L757-L768
1a85d7b2fc4e663046d1b33f994dcf8f2897a60f
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/FileFolderUtil.ets
arkts
deleteFileFolder
删除文件夹
static deleteFileFolder(context: Context, file_folder: FileFolder, fileDataSource?: FileFolderDataSource) { let folders = Preferences.getFileFolder(context) folders = folders.filter(i => i.date !== file_folder.date) Preferences.saveFileFolder(context, folders) if (fileDataSource) { fileDataSourc...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left deleteFileFolder 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#L...
static deleteFileFolder(context: Context, file_folder: FileFolder, fileDataSource?: FileFolderDataSource) { let folders = Preferences.getFileFolder(context) folders = folders.filter(i => i.date !== file_folder.date) Preferences.saveFileFolder(context, folders) if (fileDataSource) { fileDataSourc...
https://github.com/Yebingiscn/SweetVideo
970a39b3f1a4b2d9ce13b6fc89bcb33488f7647e
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
gt
大于 @param field 字段 @param value 值 @returns Wrapper
gt(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} > ?`) this.valueList.push(value) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left gt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right...
gt(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} > ?`) this.valueList.push(value) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L126-L132
6a357c5057c3053d1260e767da891df7a7fa17e6
github
LongLiveY96/chatcube
entry/src/main/ets/pages/ChatPage.ets
arkts
handleModelSelect
处理模型选择
handleModelSelect(providerId: string, modelId: string, modelName: string): void { const selection = this.findProviderModelSelection(providerId, modelId) if (selection === null) { console.warn('ChatPage', `[handleModelSelect] Model not found: ${providerId}/${modelId}`) return } this.applyMo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleModelSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left ,...
handleModelSelect(providerId: string, modelId: string, modelName: string): void { const selection = this.findProviderModelSelection(providerId, modelId) if (selection === null) { console.warn('ChatPage', `[handleModelSelect] Model not found: ${providerId}/${modelId}`) return } this.applyMo...
https://github.com/LongLiveY96/chatcube
1dcad3401c10eba48edca1d6f715be5ad36326bb
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/FileService.ets
arkts
openFile
用默认应用打开一个文件。带上 MIME type,否则部分应用(如 WPS)只会打开主页不加载文件。
static async openFile(context: common.UIAbilityContext, filePath: string): Promise<boolean> { try { const uri = fileUri.getUriFromPath(filePath); const want: Want = { action: 'ohos.want.action.viewData', uri: uri, type: mimeOf(filePath), flags: wantConstant.Flags.FLAG_A...
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 openFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:...
static async openFile(context: common.UIAbilityContext, filePath: string): Promise<boolean> { try { const uri = fileUri.getUriFromPath(filePath); const want: Want = { action: 'ohos.want.action.viewData', uri: uri, type: mimeOf(filePath), flags: wantConstant.Flags.FLAG_A...
https://github.com/picklerick422/zju-learning-assistant-OH
e8dd914903f813ed7a2e79e19c8049862990bc28
github
xiebyapps/ClipLink
entry/src/main/ets/services/SyncClipboardService.ets
arkts
getHistoryRecord
Get single history record
async getHistoryRecord(profileId: string): Promise<HistoryRecordDto> { return await this.httpClient.get<HistoryRecordDto>(`/api/history/${profileId}`); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getHistoryRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left profileId AST#identifier#Right AST#type_annotation#Left AST#:#...
async getHistoryRecord(profileId: string): Promise<HistoryRecordDto> { return await this.httpClient.get<HistoryRecordDto>(`/api/history/${profileId}`); }
https://github.com/xiebyapps/ClipLink
d9893751956ee7663a4800d37b9e32700fedf34c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/OnlineComicConverter.ets
arkts
convertToOnlineChapterInfoArray
批量转换数据库记录为 OnlineChapterInfo 数组 @param records 数据库记录数组 @returns OnlineChapterInfo 数组
public static convertToOnlineChapterInfoArray(records: DatabaseRecord[]): OnlineChapterInfo[] { // 简化日志:仅在有错误时输出详细信息 // logger.info(TAG, `开始批量转换 ${records.length} 个在线章节记录`); const chapters: OnlineChapterInfo[] = []; let errorCount = 0; for (let i = 0; i < records.length; i++) { try...
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 convertToOnlineChapterInfoArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#...
public static convertToOnlineChapterInfoArray(records: DatabaseRecord[]): OnlineChapterInfo[] { // 简化日志:仅在有错误时输出详细信息 // logger.info(TAG, `开始批量转换 ${records.length} 个在线章节记录`); const chapters: OnlineChapterInfo[] = []; let errorCount = 0; for (let i = 0; i < records.length; i++) { try...
https://github.com/DaLongZhuaZi/manxia
4be06a3d35b8715f97ca6e0862567d335c01fb1e
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelReaderPage.ets
arkts
onTapCenter
点击中间区域回调 - 显示/隐藏工具栏 TextReaderComponent 内部已经处理了点击区域判断,这里只需要切换工具栏状态
onTapCenter(): void { this.toggleToolbar(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTapCenter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#...
onTapCenter(): void { this.toggleToolbar(); }
https://github.com/DaLongZhuaZi/manxia
0882b2af637e861bd590a2b8274928d8e9982259
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/DownloadDirManager.ets
arkts
createInitFile
创建初始化标记文件
private createInitFile(): void { try { const initFilePath = `${this.downloadDirPath}/.manxia_init`; const file = SafeFileUtils.openSync(initFilePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); SafeFileUtils.writeSync(file.fd, `漫匣应用目录初始化文件\n创建时间: ${new Date().toISOString()}`); SafeFileUt...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createInitFile 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#v...
private createInitFile(): void { try { const initFilePath = `${this.downloadDirPath}/.manxia_init`; const file = SafeFileUtils.openSync(initFilePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); SafeFileUtils.writeSync(file.fd, `漫匣应用目录初始化文件\n创建时间: ${new Date().toISOString()}`); SafeFileUt...
https://github.com/DaLongZhuaZi/manxia
11039f26521dca15b98da4df5a015d3895cd3e1f
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/FamilyPackService.ets
arkts
childPacksLatestUrl
V0.8.1 merged child vocabulary (global + family); auth is device Bearer.
private childPacksLatestUrl(familyId: string): string { const fid: string = familyId.trim().length > 0 ? familyId.trim() : '_'; return `${this.baseUrl}/api/v1/family/${fid}/packs/latest.json`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left childPacksLatestUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left familyId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
private childPacksLatestUrl(familyId: string): string { const fid: string = familyId.trim().length > 0 ? familyId.trim() : '_'; return `${this.baseUrl}/api/v1/family/${fid}/packs/latest.json`; }
https://github.com/terryma2024/happyword
9b3350e951f571231306b5d596b0f38f179d5e38
github
openharmony/developtools_ace_ets2bundle
arkui-plugins/test/demo/mock/decorators/watch/watch-basic.ets
arkts
ProvideOnChange
objectLinkOnChange(propName: string) {}
ProvideOnChange(propName: string) {}
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ProvideOnChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A...
ProvideOnChange(propName: string) {}
https://gitee.com/openharmony/developtools_ace_ets2bundle.git
77193e047dd9089995c1c7a22ec7d53659a6de77
gitee
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
calculateUnlockDuration
计算联动解锁时长 @param {number} targetIndex - 目标索引 @returns {number} 解锁时长(毫秒)
private calculateUnlockDuration(targetIndex: number): number { const distance: number = Math.abs(targetIndex - this.lastSideBarIndex); this.lastSideBarIndex = targetIndex; return Math.min(1200, Math.max(240, distance * 120)); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateUnlockDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left nu...
private calculateUnlockDuration(targetIndex: number): number { const distance: number = Math.abs(targetIndex - this.lastSideBarIndex); this.lastSideBarIndex = targetIndex; return Math.min(1200, Math.max(240, distance * 120)); }
https://github.com/Joker-x-dev/CoolMallArkTS
b8e78a36f8539fcefc61345fd32bc9180975ff28
github
XHXYT/Pixark
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initAppEnvironment
--- 核心初始化 --- 初始化应用基础环境 (偏好设置、数据库、颜色、图片缓存等)
private async initAppEnvironment() { // 初始化上下文 _PixState.Context = this.context // 初始化首选项 await preferenceUtil.init(this.context, 'pixark_preference'); // 初始化KV数据库 await kvDbUtil.initKVManager(this.context, 'pixark') // 加载设置数据 await appSettings.load() await UISettings.load() /...
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 initAppEnvironment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async initAppEnvironment() { // 初始化上下文 _PixState.Context = this.context // 初始化首选项 await preferenceUtil.init(this.context, 'pixark_preference'); // 初始化KV数据库 await kvDbUtil.initKVManager(this.context, 'pixark') // 加载设置数据 await appSettings.load() await UISettings.load() /...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L112-L137
40fdf1b34437b9cc9e98c089cb3e0b85595e7c76
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toFixed
Return a string representing the value of this Decimal in normal (fixed-point). @returns { string } the string type
public toFixed(): string { let str = this.finiteToString(false); return this.isNegative() && !this.isZero() ? '-' + str : str; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toFixed 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#string#...
public toFixed(): string { let str = this.finiteToString(false); return this.isNegative() && !this.isZero() ? '-' + str : str; }
https://gitcode.com/iop123123/arkts-static-skills
ec3a9a2c953e3d2b2b646cdb177270399218b822
gitcode
openharmony-sig/applications_clock
common/src/main/ets/utils/FormUtil.ets
arkts
notifyFormDataChanged
notify FormData Changed @param formId formId @param formData formData
public static async notifyFormDataChanged(formId: string, formData: Object): Promise<void> { try { let bindData = formBindingData.createFormBindingData(formData); LogUtil.info(TAG, `notifyFormDataChanged --> formId: ${formId}, formData = ${JSON.stringify(bindData)}`); formProvider.updateForm(for...
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 notifyFormDataChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L...
public static async notifyFormDataChanged(formId: string, formData: Object): Promise<void> { try { let bindData = formBindingData.createFormBindingData(formData); LogUtil.info(TAG, `notifyFormDataChanged --> formId: ${formId}, formData = ${JSON.stringify(bindData)}`); formProvider.updateForm(for...
https://gitee.com/openharmony-sig/applications_clock.git
8a48f913d26db29ce4b9dc77fda298d52ba7d0fd
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
createRecordFromResultSet
==================== 私有辅助方法 ==================== 从ResultSet创建记录对象
private async createRecordFromResultSet(tableName: string, resultSet: relationalStore.ResultSet): Promise<DatabaseRecord | null> { try { const recordType = this.getRecordTypeFromTableName(tableName); if (!recordType) { logger.error(TAG, `未知的表名: ${tableName}`); return null; } ...
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 createRecordFromResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#L...
private async createRecordFromResultSet(tableName: string, resultSet: relationalStore.ResultSet): Promise<DatabaseRecord | null> { try { const recordType = this.getRecordTypeFromTableName(tableName); if (!recordType) { logger.error(TAG, `未知的表名: ${tableName}`); return null; } ...
https://github.com/DaLongZhuaZi/manxia
ef52f38d814d54a8e1d2a132771b15f73c5fd270
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
setShowBootScreen
设置是否显示启动画面 对齐 Android EmulatorConfiguration.showBootScreen
static setShowBootScreen(show: boolean): boolean { return MelonDSNative.native.setShowBootScreen(show); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setShowBootScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static setShowBootScreen(show: boolean): boolean { return MelonDSNative.native.setShowBootScreen(show); }
https://github.com/richshaw2015/nds
fd9b099cb82d92e5f7520e2d47512052214800a1
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
getRecursionDepth
获取当前递归深度
getRecursionDepth(): number { return this.recursionDepth }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecursionDepth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stat...
getRecursionDepth(): number { return this.recursionDepth }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
81f918b4c55a20a484faeb5da5ab80bc6e98f352
gitcode
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Tabs/MyTabsComp.ets
arkts
onTabsChange
当 Tabs 发生变化 && 页面显示 时(监听父组件的 currentIndex 和 isPageShow)
onTabsChange() { if (this.currentIndex === 2 && this.isPageShow === true) { this.getDebugInfo() this.getStatfsInfo() this.getBatteryInfo() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTabsChange 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 ...
onTabsChange() { if (this.currentIndex === 2 && this.isPageShow === true) { this.getDebugInfo() this.getStatfsInfo() this.getBatteryInfo() } }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
60e08a7d7cbb58895ec8dde4e4539ea67ff27ac9
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_long.ets
arkts
main
--- desc: check prefix increment for long integer operand ---
function main(): void { let value: long = {{v.value}} let result: long = ++value assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: long = {{v.value}} let result: long = ++value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
939cb80b5488e44fe134b379f3841bf56e18cc0e
gitee
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
instanceToValueBucket
将 EventInstance 转换为数据库值对象
private instanceToValueBucket(instance: EventInstance): relationalStore.ValuesBucket { const now = Date.now(); return { id: instance.id, original_id: instance.originalId, title: instance.title, description: instance.description || '', instance_time: instance.instanceTime, c...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left instanceToValueBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private instanceToValueBucket(instance: EventInstance): relationalStore.ValuesBucket { const now = Date.now(); return { id: instance.id, original_id: instance.originalId, title: instance.title, description: instance.description || '', instance_time: instance.instanceTime, c...
https://gitcode.com/openharmony/codelabs
0ed818231d0790d0fdfe58a6070186bd635bac81
gitcode
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/MainViewMdoel.ets
arkts
onError
错误回调函数
onError() { },
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#object#Left AST#{#Left { AST#{#Right AST#}#Left } AST#}#Right AST#object#Right AST#,#Left , AST...
onError() { },
https://gitee.com/openharmony-sig/online_event.git
e49a9e383c358d9e977bbf3ab95c13c855dc5736
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/ReaderKitParser.ets
arkts
isSupportedFormat
检查 Reader Kit 是否支持该格式
public static isSupportedFormat(format: EBookFormat): boolean { const supportedFormats = [ EBookFormat.TXT, EBookFormat.EPUB, EBookFormat.MOBI, EBookFormat.AZW, EBookFormat.AZW3 ]; return supportedFormats.includes(format); }
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 isSupportedFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Lef...
public static isSupportedFormat(format: EBookFormat): boolean { const supportedFormats = [ EBookFormat.TXT, EBookFormat.EPUB, EBookFormat.MOBI, EBookFormat.AZW, EBookFormat.AZW3 ]; return supportedFormats.includes(format); }
https://github.com/DaLongZhuaZi/manxia
e28075c1145b6461cc1c11d01bd783f9a165fbe4
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/DataCollector.ets
arkts
setCollectionInterval
设置采集间隔
public setCollectionInterval(interval: number): void { this.collectionInterval = interval; console.log(`DataCollector: Collection interval set to ${interval}ms`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCollectionInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left interval AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST...
public setCollectionInterval(interval: number): void { this.collectionInterval = interval; console.log(`DataCollector: Collection interval set to ${interval}ms`); }
https://github.com/LJ666-ui/harmony-health-care
3bc059f840f345d8f228d640e41244d1eac5a703
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/01.kinds_of_conversion/10.string_conversion/str_prim.ets
arkts
main
--- desc: >- A value x of primitive type T is first converted to a reference value as if by giving it as an argument to an appropriate class instance creation expression. ---
function main(): int { {%- for t in case['types'] %} let src_{{loop.index}}: {{t.type}} = ({{t.val|safe}}) as {{t.type}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left i...
function main(): int { {%- for t in case['types'] %} let src_{{loop.index}}: {{t.type}} = ({{t.val|safe}}) as {{t.type}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ff4d2804f5f35353f08397c4422e4c16bfc94e45
gitee
huaiminqin/TankWar-Master-with-Many-Tasks
game/src/main/ets/mission/MissionFactory.ets
arkts
createRandomMission
根据关卡随机选择任务类型
static createRandomMission(level: number): Mission { // 前3关使用经典模式 if (level <= 3) { return MissionFactory.createClassicMission(level); } const rand = Math.floor(Math.random() * 100); if (rand < 25) { return MissionFactory.createEscortMission(level); } else if (rand < 45) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createRandomMission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static createRandomMission(level: number): Mission { // 前3关使用经典模式 if (level <= 3) { return MissionFactory.createClassicMission(level); } const rand = Math.floor(Math.random() * 100); if (rand < 25) { return MissionFactory.createEscortMission(level); } else if (rand < 45) { ...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
6506b16b2d0937ce378bd99abf029c4d987ccd96
github
openharmony-tpc/MMKV
entry/src/main/ets/pages/index.ets
arkts
showMsg
show toast @param msg show massage
showMsg(msg: string) { // 整改后的代码 let option: ShowToastOptions = { message: msg } prompt.showToast(option) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#...
showMsg(msg: string) { // 整改后的代码 let option: ShowToastOptions = { message: msg } prompt.showToast(option) }
https://gitee.com/openharmony-tpc/MMKV.git
1b0b296b2ee22012bb317f4cd80b93ba52266f5e
gitee
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets
arkts
calculateHasMore
计算是否还有更多数据 @param {NetworkPageData<T>} pageData - 分页数据 @returns {boolean} 是否还有更多
protected calculateHasMore(pageData: NetworkPageData<T>): boolean { const pagination: NetworkPageMeta | null = pageData.pagination; return pagination !== null && pagination.total !== null && pagination.size !== null && pagination.page !== null && pagination.size * pagination.page < pag...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left calculateHasMore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#in...
protected calculateHasMore(pageData: NetworkPageData<T>): boolean { const pagination: NetworkPageMeta | null = pageData.pagination; return pagination !== null && pagination.total !== null && pagination.size !== null && pagination.page !== null && pagination.size * pagination.page < pag...
https://github.com/Joker-x-dev/CoolMallArkTS
8e1f81f289c076777d8767946d4e552f12675c26
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
lerp
Linear interpolation
static lerp(a: Offset | null, b: Offset | null, t: number): Offset | null { if (b === null) { return a ? a.multiply(1.0 - t) : null; } else { return a ? new Offset( lerpDouble(a.dx, b.dx, t), lerpDouble(a.dy, b.dy, t) ) : b.multiply(t); } }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left lerp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#...
static lerp(a: Offset | null, b: Offset | null, t: number): Offset | null { if (b === null) { return a ? a.multiply(1.0 - t) : null; } else { return a ? new Offset( lerpDouble(a.dx, b.dx, t), lerpDouble(a.dy, b.dy, t) ) : b.multiply(t); } }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L143-L152
8677c11c4396873b83b8cd3c655c93278475b5f5
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/DateUtils.ets
arkts
isNotToday
获取日期是否不是今天
public static isNotToday(data: Date | undefined): boolean { return !DateUtils.isToday(data); }
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 isNotToday AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:...
public static isNotToday(data: Date | undefined): boolean { return !DateUtils.isToday(data); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/DateUtils.ets#L78-L80
38fa57c39de57bdcb96a3b6617a9cb0d1fc0990b
github
aimilin6688/KeePassHO
entry/src/main/ets/services/DataService.ets
arkts
saveKdbx
保存数据库
public static saveKdbx(param: SaveKdbxParam): Promise<void> { return KdbxExportService.getFileContent(param).then(result => { LoadingDialog.showLoading($r("app.string.handling")); const location = param.locationInfo; return new KdbxFileManager(location.storageType, location.storageConfig).write(...
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 saveKdbx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#...
public static saveKdbx(param: SaveKdbxParam): Promise<void> { return KdbxExportService.getFileContent(param).then(result => { LoadingDialog.showLoading($r("app.string.handling")); const location = param.locationInfo; return new KdbxFileManager(location.storageType, location.storageConfig).write(...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/DataService.ets#L24-L34
a0acf82e3e8d2f3f004fac7e785c205b49955b3e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
getSuggestedActions
获取建议的操作
private getSuggestedActions(): string[] { const actions: string[] = []; const currentPhaseDetail = this.phases.get(this.currentPhase); if (!currentPhaseDetail) { return ['重新初始化系统']; } if (currentPhaseDetail.state === LoadingState.FAILED) { if (currentPhaseDetail.retryCount < ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSuggestedActions 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...
private getSuggestedActions(): string[] { const actions: string[] = []; const currentPhaseDetail = this.phases.get(this.currentPhase); if (!currentPhaseDetail) { return ['重新初始化系统']; } if (currentPhaseDetail.state === LoadingState.FAILED) { if (currentPhaseDetail.retryCount < ...
https://github.com/DaLongZhuaZi/manxia
8fa6280c55d35be8036bc770e94eab9f456baccd
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets
arkts
gravity
重力插值器
static gravity(acceleration: number = 1.0): curves.ICurve { return AnimationInterpolator.accelerate(acceleration * 2); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left gravity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left acceleration AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expre...
static gravity(acceleration: number = 1.0): curves.ICurve { return AnimationInterpolator.accelerate(acceleration * 2); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
703be2264a66980193cd0a66011473230189d083
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/ThemeManager.ets
arkts
removeThemeChangeListener
移除主题变更监听器 @param listener 监听器函数
public removeThemeChangeListener(listener: ThemeChangeListener): void { const index = this.themeChangeListeners.indexOf(listener); if (index !== -1) { this.themeChangeListeners.splice(index, 1); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeThemeChangeListener 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#id...
public removeThemeChangeListener(listener: ThemeChangeListener): void { const index = this.themeChangeListeners.indexOf(listener); if (index !== -1) { this.themeChangeListeners.splice(index, 1); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ThemeManager.ets#L138-L143
079763dd4cf01f9894938786c502d26db250e43e
github
openharmony-tpc/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
addHeader
全局添加单个请求头header @param key 请求头属性 @param value 请求头值
addHeader(key: string, value: Object) { this.headerMap.set(key, value) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addHeader 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#...
addHeader(key: string, value: Object) { this.headerMap.set(key, value) }
https://gitee.com/openharmony-tpc/ImageKnife.git
c99dccbfe9a5f96e6fe2f5e7a04a20b6acc11b17
gitee
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/ProcessingInterfaceTest/entry/src/main/ets/utils/AVPlayerDemo.ets
arkts
preDownloadDemo
以下demo为通过setMediaSource设置自定义头域及媒体播放优选参数实现初始播放参数设置
async preDownloadDemo() { try { // 创建avPlayer实例对象 let avPlayer: media.AVPlayer = await media.createAVPlayer(); let mediaSource: media.MediaSource = media.createMediaSourceWithUrl('http://xxx', { 'User-Agent': 'User-Agent-Value' }); let playbackStrategy: media.PlaybackStrategy = { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left preDownloadDemo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#...
async preDownloadDemo() { try { // 创建avPlayer实例对象 let avPlayer: media.AVPlayer = await media.createAVPlayer(); let mediaSource: media.MediaSource = media.createMediaSourceWithUrl('http://xxx', { 'User-Agent': 'User-Agent-Value' }); let playbackStrategy: media.PlaybackStrategy = { ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
3026ba634636afb9a71331f62a88fa6d1e51fff9
gitcode
apap6628114/nga_oh
entry/src/main/ets/common/managers/PaginationManager.ets
arkts
resetGeneration
重置 generation 计数器。子类 reset 须调用以同步清零。
protected resetGeneration(): void { this.generation = 0 }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left resetGeneration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left voi...
protected resetGeneration(): void { this.generation = 0 }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L60-L62
5d59f4435665d6fca0302faae3ad93040e6e7a74
github
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/RemoteDeviceModel.ets
arkts
startDeviceDiscovery
Searching for Devices on a Distributed Network by SUBSCRIBE_ID.
startDeviceDiscovery() { let discoverParam: Record<string, number> = { 'discoverTargetType': 1 }; let filterOptions: Record<string, number> = { 'availableStatus': 0 }; try { if (this.deviceManager !== undefined) { // Discover peripheral devices. The discovery status lasts...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startDeviceDiscovery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo...
startDeviceDiscovery() { let discoverParam: Record<string, number> = { 'discoverTargetType': 1 }; let filterOptions: Record<string, number> = { 'availableStatus': 0 }; try { if (this.deviceManager !== undefined) { // Discover peripheral devices. The discovery status lasts...
https://gitee.com/harmonyos/codelabs.git
bc495d9ec1bb512d9c8c0b7cc65267311150f4ab
gitee
HarmonyOS_Samples/guide-snippets
Ability/InsightIntentConfigDevelopment/entry/src/main/ets/abilities/MusicPlayerAbility.ets
arkts
attachWindowStage
接收执行器传递的窗口舞台(用于前台模式加载页面)
attachWindowStage(stage: window.WindowStage) { this.windowStage = stage; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left attachWindowStage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#...
attachWindowStage(stage: window.WindowStage) { this.windowStage = stage; }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
b8f414d032b8c149cc28574b35432231c9a23c1b
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleContent.ets
arkts
startTimer
-- Internals --
private startTimer(initialDelayMs: number): void { this.stopTimer(); const fireTick = async (): Promise<void> => { if (this.waitTicks > 0) { this.waitTicks--; return; } if (!this.shouldFetchContents) return; if (this.isInContentZone) return; try { await this.fetchContents(null); } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left initialDelayMs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n...
private startTimer(initialDelayMs: number): void { this.stopTimer(); const fireTick = async (): Promise<void> => { if (this.waitTicks > 0) { this.waitTicks--; return; } if (!this.shouldFetchContents) return; if (this.isInContentZone) return; try { await this.fetchContents(null); } ...
https://github.com/Countly/countly-sdk-hos
4e4f792c1983acb590457491dc8c8da69ed6e961
github
openharmony-sig/node_pool
nodepool/src/main/ets/lib/NodePool.ets
arkts
getInstance
获取单例节点池 @returns NodePool
public static getInstance() { if (!NodePool.instance) { NodePool.instance = new NodePool(); } return NodePool.instance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR...
public static getInstance() { if (!NodePool.instance) { NodePool.instance = new NodePool(); } return NodePool.instance; }
https://gitee.com/openharmony-sig/node_pool.git
597a562565c663ae9a305c80f3b1598ca5c24f49
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
every
/ === with element lambda functions === Checks that all elements of Int16Array satisfy the passed function @param fn check function @returns true if all elements satisfy fn
public every(fn: (element: short) => boolean): boolean { let newF: (element: short, index: int, array: Int16Array) => boolean = (element: short, index: int, array: Int16Array): boolean => { return fn(element) } return this.every(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig...
public every(fn: (element: short) => boolean): boolean { let newF: (element: short, index: int, array: Int16Array) => boolean = (element: short, index: int, array: Int16Array): boolean => { return fn(element) } return this.every(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4c857df3d2dae2f3ae16daf2287b9789883d05bd
gitee
OHPG/FinSdk
network/src/main/ets/api/HttpClient.ets
arkts
updateBaseUrl
运行时更新 baseURL,重建内部连接。
protected updateBaseUrl(baseUrl: string): void { this.initClient(baseUrl) }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left updateBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
protected updateBaseUrl(baseUrl: string): void { this.initClient(baseUrl) }
https://github.com/OHPG/FinSdk
663401df2e81b6dbec62af844dd14be9a3f5398b
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets
arkts
getEventInstancesByOriginalId
根据原始事件ID获取事件实例
async getEventInstancesByOriginalId(originalId: string): Promise<EventInstance[]> { try { return await this.eventDao.getEventInstancesByOriginalId(originalId); } catch (error) { console.error('获取事件实例失败:', error); return []; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEventInstancesByOriginalId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left originalId AST#identifier#Right AST#type_annotati...
async getEventInstancesByOriginalId(originalId: string): Promise<EventInstance[]> { try { return await this.eventDao.getEventInstancesByOriginalId(originalId); } catch (error) { console.error('获取事件实例失败:', error); return []; } }
https://gitcode.com/openharmony/codelabs
6a1397d4a8086ff69a010a3ab7c79dd51d104560
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test48_original_index.ets
arkts
isAlpha
--- charCode range check (isAlpha) ---
function isAlpha(ch: string): boolean { let code: number = ch.charCodeAt(0); return (code >= 65 && code <= 90) || (code >= 97 && code <= 122); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isAlpha AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ch AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function isAlpha(ch: string): boolean { let code: number = ch.charCodeAt(0); return (code >= 65 && code <= 90) || (code >= 97 && code <= 122); }
https://github.com/miaochiahao/ark-ghidra
afb1d00a45a24446ddca86bd6f6c998b6afef110
github
fbinba3955/Flymby
main/src/main/ets/pages/collection/MyFavoritePage.ets
arkts
createParamByType
构建不同类型的查询参数
createParamByType(favoriteType: string) { const requestParams = this.createCommonParam() requestParams['IncludeItemTypes'] = favoriteType // 这个属性用来查找不同类型的数据 return requestParams }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createParamByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left favoriteType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#R...
createParamByType(favoriteType: string) { const requestParams = this.createCommonParam() requestParams['IncludeItemTypes'] = favoriteType // 这个属性用来查找不同类型的数据 return requestParams }
https://github.com/fbinba3955/Flymby
063d467c0fc5ca6096b6f1087554e612052a53c5
github
richshaw2015/nds
ohos/entry/src/test/LayoutRestoreProperty.test.ets
arkts
generateBackupLayouts
Generate a random array of INTERNAL-only LayoutEntry objects (simulating backup file).
function generateBackupLayouts(rng: PRNG): LayoutEntry[] { const length = rng.nextInt(0, 10); const layouts: LayoutEntry[] = []; for (let i = 0; i < length; i++) { layouts.push(generateLayoutEntry(rng, 'INTERNAL')); } return layouts; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateBackupLayouts AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function generateBackupLayouts(rng: PRNG): LayoutEntry[] { const length = rng.nextInt(0, 10); const layouts: LayoutEntry[] = []; for (let i = 0; i < length; i++) { layouts.push(generateLayoutEntry(rng, 'INTERNAL')); } return layouts; }
https://github.com/richshaw2015/nds
a7e448fa34a75bf806160ae540cac209cecf2d6f
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
hasAll
Checks if all values from another LightWeightSet are present in this LightWeightSet @param set the LightWeightSet to check values from @returns true if all values are present, false otherwise
hasAll(set: LightWeightSet<T>): boolean { if (set.length > this.buckets.length) { return false; } for (let index: int = 0; index < set.length; index++) { const value = set.getValueAt(index)!; if (!this.has(value)) { return false; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left LightWeightSet A...
hasAll(set: LightWeightSet<T>): boolean { if (set.length > this.buckets.length) { return false; } for (let index: int = 0; index < set.length; index++) { const value = set.getValueAt(index)!; if (!this.has(value)) { return false; ...
https://gitcode.com/iop123123/arkts-static-skills
63a61ad80517402413cacf2f625b992c9f471dc9
gitcode
erosTeam/NextE
shared/src/main/ets/parser/EhUconfigParser.ets
arkts
parseFieldNames
Every input/select/textarea name present, so absent fields (e.g. oi for accounts without it) hide.
private static parseFieldNames(html: string): string[] { const out: string[] = [] const re: RegExp = /<(?:input|select|textarea)[^>]*name="([a-z0-9_-]+)"/g let m: RegExpExecArray | null = re.exec(html) while (m !== null) { if (out.indexOf(m[1]) < 0) { out.push(m[1]) } m = re....
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 parseFieldNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left...
private static parseFieldNames(html: string): string[] { const out: string[] = [] const re: RegExp = /<(?:input|select|textarea)[^>]*name="([a-z0-9_-]+)"/g let m: RegExpExecArray | null = re.exec(html) while (m !== null) { if (out.indexOf(m[1]) < 0) { out.push(m[1]) } m = re....
https://github.com/erosTeam/NextE
1864f0eba518a180d8d38153953859d51a4ef734
github
azhu0001/localsend-harmony
entry/src/main/ets/service/upload/UploadServer.ets
arkts
sendChunked
发送分片数据 @param url 请求路径(相对路径) @param fileSize 文件大小, @param stream 分片数据 @param fileType 文件类型 @param isFirst 是否为初次发送 @returns
private async sendChunked(url: string, fileSize: number, stream: ArrayBuffer, fileType: string, isFirst: boolean): Promise<void> { await this.connect() if (!isFirst) { const protocol = new HttpProtocol(this.hostname, this.port) protocol.method = 'POST' protocol.hostname = this.hostname ...
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 sendChunked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST...
private async sendChunked(url: string, fileSize: number, stream: ArrayBuffer, fileType: string, isFirst: boolean): Promise<void> { await this.connect() if (!isFirst) { const protocol = new HttpProtocol(this.hostname, this.port) protocol.method = 'POST' protocol.hostname = this.hostname ...
https://gitcode.com/azhu0001/localsend-harmony
92b8cd5a3c3451631c12fc0d5d6a9d725478f469
gitcode
openharmony-sig/commons-cli
library/src/main/ets/components/cli/DefaultParser.ets
arkts
checkRequiredOptions
Throws a {@link MissingOptionException} if all of the required options are not present. @throws MissingOptionException if any of the required Options are not present.
protected checkRequiredOptions(): void { // if there are required options that have not been processed if (!(this.expectedOpts.length() == 0)) { let buf = "Missing required option"; buf += this.expectedOpts.length() == 1 ? "" : "s"; buf += ": "; for (let index = 0;index < this.expected...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left checkRequiredOptions 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#Ri...
protected checkRequiredOptions(): void { // if there are required options that have not been processed if (!(this.expectedOpts.length() == 0)) { let buf = "Missing required option"; buf += this.expectedOpts.length() == 1 ? "" : "s"; buf += ": "; for (let index = 0;index < this.expected...
https://gitee.com/openharmony-sig/commons-cli.git
f45b49f8a7c22f340d26b5c43419311c4aed8c05
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets
arkts
mapSearchErrorToValidation
将搜索错误类型映射到校验错误类型
private mapSearchErrorToValidation(searchError: SearchErrorType): ValidationErrorType { switch (searchError) { case SearchErrorType.TIMEOUT: return ValidationErrorType.TIMEOUT; case SearchErrorType.SSL_ERROR: return ValidationErrorType.SSL_ERROR; case SearchErrorType.NETWORK_ERRO...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapSearchErrorToValidation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left searchError AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right...
private mapSearchErrorToValidation(searchError: SearchErrorType): ValidationErrorType { switch (searchError) { case SearchErrorType.TIMEOUT: return ValidationErrorType.TIMEOUT; case SearchErrorType.SSL_ERROR: return ValidationErrorType.SSL_ERROR; case SearchErrorType.NETWORK_ERRO...
https://github.com/DaLongZhuaZi/manxia
deedd4bd9e819f2f17216112d15f0d78b35b9537
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test31_original_index.ets
arkts
testConditionalChain
--- Conditional chaining with ternary ---
function testConditionalChain(): string { let x: number = 15; let label: string = ''; if (x > 100) { label = 'huge'; } else if (x > 50) { label = 'big'; } else if (x > 10) { label = 'medium'; } else if (x > 0) { label = 'small'; } else { label = 'none'; } return label; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testConditionalChain 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#predef...
function testConditionalChain(): string { let x: number = 15; let label: string = ''; if (x > 100) { label = 'huge'; } else if (x > 50) { label = 'big'; } else if (x > 10) { label = 'medium'; } else if (x > 0) { label = 'small'; } else { label = 'none'; } return label; }
https://github.com/miaochiahao/ark-ghidra
22e606b0bead9ffc3815154329998ea4e391202b
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/AIService.ets
arkts
testConnection
测试网络连接。
async testConnection(): Promise<string> { if (!this.hasUsableConfig()) { return '请先前往“我的”页完整配置 API Key、Base URL 和 Model'; } const httpRequest = http.createHttp(); try { const result = await httpRequest.request(this.resolveModelsUrl(), { method: http.RequestMethod.GET, heade...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testConnection AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ...
async testConnection(): Promise<string> { if (!this.hasUsableConfig()) { return '请先前往“我的”页完整配置 API Key、Base URL 和 Model'; } const httpRequest = http.createHttp(); try { const result = await httpRequest.request(this.resolveModelsUrl(), { method: http.RequestMethod.GET, heade...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/AIService.ets#L201-L225
9f6434c2a5fccbc0b445737e1e57cbc45dfb3fa4
github
openharmony/applications_mms
entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets
arkts
updateAdvancedPageSwitchValue
Update Switch Value
updateAdvancedPageSwitchValue(messageCode, actionData) { settingService.updateSettingValue(messageCode, actionData, function (result) { if (result.code == common.int.SUCCESS) { HiLog.i(TAG, 'updateAdvancedPageSwitchValue, success'); } else { HiLog.w(TA...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateAdvancedPageSwitchValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left messageCode AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left actionData AST#identifier#Right AST...
updateAdvancedPageSwitchValue(messageCode, actionData) { settingService.updateSettingValue(messageCode, actionData, function (result) { if (result.code == common.int.SUCCESS) { HiLog.i(TAG, 'updateAdvancedPageSwitchValue, success'); } else { HiLog.w(TA...
https://gitee.com/openharmony/applications_mms.git
300ee04c139d9554f688f30630cfd1976197e94a
gitee
CLMC2025/Vignette
entry/src/main/ets/vocabulary/UnknownWordHandler.ets
arkts
determineHandlingStrategy
确定处理策略
determineHandlingStrategy(wordInfo: UnknownWordInfo, userLevel: number): HandlingResult { const result = new HandlingResult(HandlingStrategy.SKIP_IGNORE); // 根据优先级和用户水平确定策略 if (wordInfo.priority === Priority.HIGH) { // 高优先级:立即学习 result.strategy = HandlingStrategy.IMMEDIATE_LEARN; result...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left determineHandlingStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UnknownWordInfo AST#identi...
determineHandlingStrategy(wordInfo: UnknownWordInfo, userLevel: number): HandlingResult { const result = new HandlingResult(HandlingStrategy.SKIP_IGNORE); // 根据优先级和用户水平确定策略 if (wordInfo.priority === Priority.HIGH) { // 高优先级:立即学习 result.strategy = HandlingStrategy.IMMEDIATE_LEARN; result...
https://github.com/CLMC2025/Vignette
9f6cbad177953279a9116ac0f3eb25dd4c4df6bc
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/utils/TimeUtils.ets
arkts
msToHHMMSS
毫秒转换为“HH:mm:ss”字符串格式
static msToHHMMSS(timeMs: number): string { const MS_ONE_SECOND: number = 1000; const SECONDS_ONE_HOUR: number = 3600; const SECONDS_ONE_MIN: number = 60; const FLAG_NUMBER: number = 10; // 显示两位数判断 let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND)); let hourStr = hours + ':';...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left msToHHMMSS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeMs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
static msToHHMMSS(timeMs: number): string { const MS_ONE_SECOND: number = 1000; const SECONDS_ONE_HOUR: number = 3600; const SECONDS_ONE_MIN: number = 60; const FLAG_NUMBER: number = 10; // 显示两位数判断 let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND)); let hourStr = hours + ':';...
https://github.com/openharmony/applications_app_samples
5f3f9368ea40c81c9133a4fb92094d79550f668a
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/EntryOhos.ets
arkts
copy
returns an exact copy of the entry @return
public copy(): EntryOhos { let data: Object | null = this.getData(); if (data === null) { return new EntryOhos(this.x, this.getY()); } else { return new EntryOhos(this.x, this.getY(), undefined, data); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left copy AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public copy(): EntryOhos { let data: Object | null = this.getData(); if (data === null) { return new EntryOhos(this.x, this.getY()); } else { return new EntryOhos(this.x, this.getY(), undefined, data); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6f761c03ba78a974ed7b8d3dff4057bdd8f87698
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/settings/classes/meowManagedSettings.ets
arkts
initFrom
Init from settings file. @param settingsFilePath The path to the settings file. By default is the settingsFileSavePath initialized in the constructor. If the file doesn't exist, then nothing would happen. @returns A meowManagedSettingsInitResult. @author ChatGLM @ Apr 4, modified by awa_Liny.
async initFrom(settingsFilePath: string = this.settingsFileSavePath): Promise<meowManagedSettingsInitResult> { let settingsText: string = ''; const startTime = Date.now(); try { settingsText = fastbuffer.from(await readArrayBufferConcurrent(settingsFilePath)).toString(); meow(`Read settingsTe...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initFrom AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left settingsFilePath AST#identifier#Right AST#type_annotation#Lef...
async initFrom(settingsFilePath: string = this.settingsFileSavePath): Promise<meowManagedSettingsInitResult> { let settingsText: string = ''; const startTime = Date.now(); try { settingsText = fastbuffer.from(await readArrayBufferConcurrent(settingsFilePath)).toString(); meow(`Read settingsTe...
https://github.com/awaLiny2333/LinysBrowser_NEXT
2b67558d45ae47fa66481816efb65eaa1e2a526b
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Float64Array with respect to buf. @param buf data initializer
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Float64Array.BYTES_PER_ELEMENT) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer) { this(buf, 0, buf.getByteLength() / Float64Array.BYTES_PER_ELEMENT) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
802fb71ea8b74d5e97fb0fa2ed403bbf1fa856d0
gitee
harmonyos/codelabs
HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets
arkts
loadAssent
Play music by index. @param musicIndex
async loadAssent(musicIndex: number) { if (musicIndex >= this.songList.length) { Logger.error(TAG, `current musicIndex ${musicIndex}`); return; } BackgroundUtil.startContinuousTask(this.context); this.updateMusicIndex(musicIndex); if (this.isFirst && this.avPlayer) { this.isFirst...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadAssent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left musicIndex AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async loadAssent(musicIndex: number) { if (musicIndex >= this.songList.length) { Logger.error(TAG, `current musicIndex ${musicIndex}`); return; } BackgroundUtil.startContinuousTask(this.context); this.updateMusicIndex(musicIndex); if (this.isFirst && this.avPlayer) { this.isFirst...
https://gitee.com/harmonyos/codelabs.git
fcd990147032e663c9cd71a4b9cf2abb7d7548c0
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/EventControl.ets
arkts
setEventDisable
根据事件类型禁用事件
public setEventDisable(evType: EventType) { this.setEvent(evType, false); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEventDisable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left evType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setEventDisable(evType: EventType) { this.setEvent(evType, false); return this; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
78e8cbf9518ca926075ed6a8988cbf85c1381826
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/ShareExtAbility/ShareExtAbility.ets
arkts
getFileType
获取文件类型
private getFileType(uri: string): string { const lowerUri = uri.toLowerCase(); const extension = this.getFileExtension(uri); // 漫画压缩包 if (lowerUri.endsWith('.zip') || lowerUri.endsWith('.cbz') || lowerUri.endsWith('.cbr') || lowerUri.endsWith('.rar') || lowerUri.endsWith('.7z') ||...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
private getFileType(uri: string): string { const lowerUri = uri.toLowerCase(); const extension = this.getFileExtension(uri); // 漫画压缩包 if (lowerUri.endsWith('.zip') || lowerUri.endsWith('.cbz') || lowerUri.endsWith('.cbr') || lowerUri.endsWith('.rar') || lowerUri.endsWith('.7z') ||...
https://github.com/DaLongZhuaZi/manxia
56ec90a574bd56989daf9f162e629ada80ba7437
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
getMember
获取用户在账本中的成员身份
static async getMember(ledgerId: number, userId: number): Promise<LedgerMember | null> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerMember.tableName); predicates.equalTo...
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 getMember AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
static async getMember(ledgerId: number, userId: number): Promise<LedgerMember | null> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerMember.tableName); predicates.equalTo...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1bfe61b4041c6b04c9c554a88b88e3b4915f489d
github
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/pages/IntroductionPage.ets
arkts
getIntroductionData
Get the introduction by currentZoneId.
getIntroductionData() { let zoneList = zonesViewModel.getZonesList(); this.introductionData = zoneList.filter((item) => item.id === this.currentZoneId)[0]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIntroductionData 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_bloc...
getIntroductionData() { let zoneList = zonesViewModel.getZonesList(); this.introductionData = zoneList.filter((item) => item.id === this.currentZoneId)[0]; }
https://gitee.com/harmonyos/codelabs.git
818f8a57959b846f80d3ae76350e7507d3aa7d8f
gitee
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
getFrequencyStats
获取词汇频率统计
getFrequencyStats(): Map<string, number> { const frequency = new Map<string, number>(); this.vocabulary.forEach((record: VocabularyRecord) => { const count = record.contextCount; frequency.set(record.word, count); }); return frequency; }
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFrequencyStats 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...
getFrequencyStats(): Map<string, number> { const frequency = new Map<string, number>(); this.vocabulary.forEach((record: VocabularyRecord) => { const count = record.contextCount; frequency.set(record.word, count); }); return frequency; }
https://github.com/CLMC2025/Vignette
1f3d53d0f22efc87983c137bcc71508b60b956ce
github
YANGZX22/Voot
entry/src/main/ets/pages/Index.ets
arkts
updateThemeMode
更新主题模式并计算 isDarkMode
updateThemeMode(mode: number) { this.themeMode = mode; // 获取应用上下文并设置系统颜色模式 try { const context = getContext(this) as common.UIAbilityContext; const applicationContext = context.getApplicationContext(); if (mode === 0) { // 浅色模式 this.isDarkMode = false; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateThemeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Rig...
updateThemeMode(mode: number) { this.themeMode = mode; // 获取应用上下文并设置系统颜色模式 try { const context = getContext(this) as common.UIAbilityContext; const applicationContext = context.getApplicationContext(); if (mode === 0) { // 浅色模式 this.isDarkMode = false; ...
https://github.com/YANGZX22/Voot
a673caaf258a675fd3a0e54f1be87f0bccd3e39e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets
arkts
onResourceRequest
资源请求拦截回调(由WebView组件调用)
onResourceRequest(url: string): void { if (!this.currentTask) return; const options = this.currentTask.options; // 检查sourceRegex if (options.sourceRegex) { try { const regex = new RegExp(options.sourceRegex); if (regex.test(url)) { this.interceptedUrl = url; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onResourceRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ...
onResourceRequest(url: string): void { if (!this.currentTask) return; const options = this.currentTask.options; // 检查sourceRegex if (options.sourceRegex) { try { const regex = new RegExp(options.sourceRegex); if (regex.test(url)) { this.interceptedUrl = url; ...
https://github.com/DaLongZhuaZi/manxia
1fc71923f226dd858be7d538fd10c76bc73366ff
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
getCustomYAxisLabels
Get Y-axis custom labels @param numbers labels
public getCustomYAxisLabels(): number[] { return this.customYAxisLabels; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomYAxisLabels 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...
public getCustomYAxisLabels(): number[] { return this.customYAxisLabels; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e8a5307fa83c9031b23b8045cb2cde0384f0962c
gitee
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
replace
替换字符串中匹配的正则为给定的字符串 @param str 待替换的字符串 @param pattern 要匹配的内容正则或字符串 @param replaceValue 替换的内容 @returns
static replace(str: string, pattern: RegExp | string, replaceValue: string = ''): string { return str.replace(pattern, replaceValue); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left replace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
static replace(str: string, pattern: RegExp | string, replaceValue: string = ''): string { return str.replace(pattern, replaceValue); }
https://github.com/tdcare/tdwebrtc
0e9ed46a61e0bdc7ec59a006b8d26997bd6140f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/ComicInfoParser.ets
arkts
parseXmlString
解析XML字符串 @param xmlContent XML内容字符串 @returns 解析后的漫画信息
public parseXmlString(xmlContent: string): ComicInfo { try { logger.debug(TAG, '开始解析ComicInfo.xml内容'); // 重置解析状态 this.comicInfo = {}; this.currentElement = ''; this.currentValue = ''; // 编码XML字符串 const textEncoder = new util.TextEncoder(); const arrBuffer = ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left parseXmlString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xmlContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
public parseXmlString(xmlContent: string): ComicInfo { try { logger.debug(TAG, '开始解析ComicInfo.xml内容'); // 重置解析状态 this.comicInfo = {}; this.currentElement = ''; this.currentValue = ''; // 编码XML字符串 const textEncoder = new util.TextEncoder(); const arrBuffer = ...
https://github.com/DaLongZhuaZi/manxia
ab191795ae2b50c48c6415fd3dd07f77513cc843
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_ulong.ets
arkts
main
--- desc: check addition of two unsigned long integers ---
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a + b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a + b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
6f8793b58a0471541b6e8e644301e8e862ab2e2d
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxFileManager.ets
arkts
getInfo
获取KDBX文件信息 @param path 文件路径 @return Promise<FileInfo> 文件信息 @throws 如果获取失败则抛出异常
public async getInfo(path: string): Promise<FileInfo> { try { return await this.storage.getInfo(path); } catch (error) { hilog.error(DOMAIN, TAG, `Failed to get KDBX file info: ${error.message}`) throw new Error(error.message); } }
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 getInfo 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 getInfo(path: string): Promise<FileInfo> { try { return await this.storage.getInfo(path); } catch (error) { hilog.error(DOMAIN, TAG, `Failed to get KDBX file info: ${error.message}`) throw new Error(error.message); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxFileManager.ets#L92-L99
8c88f2c05b740545091a6be6b3ba9950a2b4f6fe
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
fill
Fills the Float32Array with specified value @param value new valuy @returns modified Float32Array
public fill(value: number, start: number, end: number): Float32Array { return this.fill(value as double as int as float, start as int, end as int) }
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#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start: number, end: number): Float32Array { return this.fill(value as double as int as float, start as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4edc20a07edf6e0ab10cee5057790b5d1fd8e33b
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/CartManager.ets
arkts
addToCart
Add item to cart. If same product+specs exists, update quantity. 支持 ProductItem 类和 IProductItem 接口(普通对象)
static async addToCart(product: IProductItem, quantity: number, color: string, capacity: string): Promise<void> { console.log(`CartManager.addToCart: product.name=${product.name}, product.price=${product.price}, quantity=${quantity}`); // Check for duplicate (same id, color, capacity) let existingInd...
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 addToCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left product AST#identifier#Right AST#:#Left : AST#...
static async addToCart(product: IProductItem, quantity: number, color: string, capacity: string): Promise<void> { console.log(`CartManager.addToCart: product.name=${product.name}, product.price=${product.price}, quantity=${quantity}`); // Check for duplicate (same id, color, capacity) let existingInd...
https://github.com/Harrisonls2004/WaterFlow
c7f9c000e5f508db8cac1a3477efc710eeadbfdc
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets
arkts
getElementType
获取节点类型
public getElementType(): string{ return this._formatResultObj[SVGAttrConstants.ATTR_KEY_TYPE] as string; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getElementType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#...
public getElementType(): string{ return this._formatResultObj[SVGAttrConstants.ATTR_KEY_TYPE] as string; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
220c14fe9d5e794af01d352bdbb4acd25aa15487
gitee
dingzhilin1990/zhilinclaw
examples/WeatherPlugin.ets
arkts
onLoad
插件加载时的初始化
async onLoad(): Promise<void> { console.log('[WeatherPlugin] 插件加载中...'); // 初始化资源 }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onLoad 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#gene...
async onLoad(): Promise<void> { console.log('[WeatherPlugin] 插件加载中...'); // 初始化资源 }
https://github.com/dingzhilin1990/zhilinclaw
92c91f83709c91ae85bcc7fbaf7fe9ff56ad6921
github