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/Managers/SettingsManager.ets
arkts
setDuplicateDetectionTitleWeight
设置重复检测标题权重
async setDuplicateDetectionTitleWeight(weight: number): Promise<void> { await this.setNumber(SettingKeys.DUPLICATE_DETECTION_TITLE_WEIGHT, weight); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setDuplicateDetectionTitleWeight AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#i...
async setDuplicateDetectionTitleWeight(weight: number): Promise<void> { await this.setNumber(SettingKeys.DUPLICATE_DETECTION_TITLE_WEIGHT, weight); }
https://github.com/DaLongZhuaZi/manxia
5247cbb09b445537b6a24493804fbfaed18fdbbd
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets
arkts
supports
判断是否为用户模板
supports(template: ITemplate): boolean { return isUserTemplate(template); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left supports AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ITemplate AST#identifier#Right AST#)#Left )...
supports(template: ITemplate): boolean { return isUserTemplate(template); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets#L309-L311
1a3be551446d49e5c176ef053a897c8d297ee1d2
github
iHongRen/harmony-study-demo
entry/src/main/ets/pages/transcoder/Transcoder.ets
arkts
setAVTranscoderCallback
注册avTranscoder回调函数。
setAVTranscoderCallback() { if (Transcoder.canIUse()) { if (this.avTranscoder != undefined) { // 转码完成回调函数。 this.avTranscoder.on('complete', async () => { console.log(`AVTranscoder is completed`); this.processCallback?.(true, this.currentProgress) await this.rele...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAVTranscoderCallback 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_...
setAVTranscoderCallback() { if (Transcoder.canIUse()) { if (this.avTranscoder != undefined) { // 转码完成回调函数。 this.avTranscoder.on('complete', async () => { console.log(`AVTranscoder is completed`); this.processCallback?.(true, this.currentProgress) await this.rele...
https://github.com/iHongRen/harmony-study-demo
6a315fb3438b4c11bf02ef11a0062714751dda4e
github
Blue1-0/wanandroid_harmonyos
entry/src/main/ets/components/WechatArticleComponent.ets
arkts
mapForNameNewList
@returns 取name作为一个新的集合展示
mapForNameNewList(): string[] { return this.wxChapters.map(article => article.name).filter(name => name) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left mapForNameNewList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) A...
mapForNameNewList(): string[] { return this.wxChapters.map(article => article.name).filter(name => name) }
https://github.com/Blue1-0/wanandroid_harmonyos/blob/bb01bf64e40a14c6304363a3290077ea7baaed81/entry/src/main/ets/components/WechatArticleComponent.ets#L82-L84
4b395299a0802866d6f1043d842f61c94c281140
github
the-wwyang/kids-learning-app
src/main/ets/storage/WrongQuestionStorageService.ets
arkts
updateWrongQuestion
更新错题记录 @param record 错题记录
static async updateWrongQuestion(record: WrongQuestionRecord): Promise<void> { try { const records = await WrongQuestionStorageService.loadWrongQuestions(); const index = records.findIndex(r => r.id === record.id); if (index >= 0) { records[index] = record; await WrongQuestionSt...
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 updateWrongQuestion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Le...
static async updateWrongQuestion(record: WrongQuestionRecord): Promise<void> { try { const records = await WrongQuestionStorageService.loadWrongQuestions(); const index = records.findIndex(r => r.id === record.id); if (index >= 0) { records[index] = record; await WrongQuestionSt...
https://github.com/the-wwyang/kids-learning-app
eddfc4f9f00103cce6725df33321124129ca332a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
toLocaleString
Converts Uint8Array to a string with respect to locale @param locales @param options @returns string representation
public toLocaleString(locales: Object, options: Object): string { throw new Error("Uint8Array.toLocaleString: not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide...
public toLocaleString(locales: Object, options: Object): string { throw new Error("Uint8Array.toLocaleString: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3dcf3c5b1b07af11c0704d1de822e44b13af8dc3
gitee
Yebingiscn/SweetVideo
entry/src/main/ets/controller/MpvController/MpvController.ets
arkts
registerSurfaceModeErrorCallback
注册Surface模式错误回调
private registerSurfaceModeErrorCallback() { if (this.surfaceModeErrorCallbackRegistered) { return } try { mpvRegisterSurfaceModeErrorCallback((errorMessage: string) => { if (this.isInState(MpvPlayerState.RELEASING) || this.isInState(MpvPlayerState.IDLE)) { salmonLogger.addLo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerSurfaceModeErrorCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_b...
private registerSurfaceModeErrorCallback() { if (this.surfaceModeErrorCallbackRegistered) { return } try { mpvRegisterSurfaceModeErrorCallback((errorMessage: string) => { if (this.isInState(MpvPlayerState.RELEASING) || this.isInState(MpvPlayerState.IDLE)) { salmonLogger.addLo...
https://github.com/Yebingiscn/SweetVideo
b576ff0f12eec0b185df4245f3942f00eca77300
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Int16Array that satisfies the condition @param fn condition @returns the index of the last element that satisfies fn, -1 otherwise
public findLastIndex(fn: (val: short) => boolean): int { let newF: (val: short, index: int, array: Int16Array) => boolean = (val: short, index: int, array: Int16Array): boolean => { return fn(val) } return this.findLastIndex(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public findLastIndex(fn: (val: short) => boolean): int { let newF: (val: short, index: int, array: Int16Array) => boolean = (val: short, index: int, array: Int16Array): boolean => { return fn(val) } return this.findLastIndex(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a705ecc709267e0b8eebba141c4f8d504ffed261
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceMethod.ets
arkts
isGetter
Checks if the method is a getter method. @returns { boolean } Returns true if the method is a getter, otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isGetter(): boolean { return (this.attributes & Attributes.GETTER) != 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool...
public isGetter(): boolean { return (this.attributes & Attributes.GETTER) != 0 }
https://gitcode.com/iop123123/arkts-static-skills
7f661dbb0995c31fbc372e47f5418165d0e46488
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
segment
Segments a document into clusters based on the configured granularity @param doc The input text to segment @returns A Segments iterator containing segmented data
public segment(doc: string): Segments { let result = this.segmentWith(doc, this._granularity) let segments = new SegmentDataImpl[result.length](new SegmentDataImpl()); for (let i = 0; i < result.length; ++i) { segments[i] = Segmenter.tryToSegmentData(result[i...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left segment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left doc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
public segment(doc: string): Segments { let result = this.segmentWith(doc, this._granularity) let segments = new SegmentDataImpl[result.length](new SegmentDataImpl()); for (let i = 0; i < result.length; ++i) { segments[i] = Segmenter.tryToSegmentData(result[i...
https://gitcode.com/iop123123/arkts-static-skills
f671ccc822b828f4598f43c62b05ca78d246fbe2
gitcode
openharmony/arkui_ace_engine
examples/ScrollableComponentTest/entry/src/main/ets/pages/List/DragAndDropSorting/ListItemGroup.ets
arkts
registerDataChangeListener
该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { console.info('add listener'); this.listeners.push(listener); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#id...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { console.info('add listener'); this.listeners.push(listener); } }
https://gitee.com/openharmony/arkui_ace_engine.git
568aa5ead1c41ce2e36ca589b096b9c22225972e
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_minus/unary_minus_uint.ets
arkts
main
--- desc: check unary minus operation for unsigned integer operand ---
function main(): void { const value: uint = {{v.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 { const value: uint = {{v.value}} assert -(value) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a31d4336364d324356bed4d728ea55d202f44fcd
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setCenterTextOffset
Sets the offset the center text should have from it's original position in vp. Default x = 0, y = 0 @param x @param y
public setCenterTextOffset(x: number, y: number): void { this.mCenterTextOffset.x = Utils.handleDataValues(x); this.mCenterTextOffset.y = Utils.handleDataValues(y); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCenterTextOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setCenterTextOffset(x: number, y: number): void { this.mCenterTextOffset.x = Utils.handleDataValues(x); this.mCenterTextOffset.y = Utils.handleDataValues(y); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6afc5812a8191fedb7dd95dbdf8cd5b27688da20
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
getInt8
=== Int8 === Read bytes as they represent given type @param byteOffset zero index to read @returns read value (big endian)
public getInt8(byteOffset: number): number { return this.getInt8(byteOffset as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Righ...
public getInt8(byteOffset: number): number { return this.getInt8(byteOffset as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c9a507bd41f01087bd7965dba20540023bc5a464
gitee
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
migrateDatabase
执行数据库迁移 每次升级版本时,在这里添加对应的迁移逻辑
private async migrateDatabase(fromVersion: number, toVersion: number): Promise<void> { if (!this.rdbStore) return; console.info(`[DatabaseService] Migrating from v${fromVersion} to v${toVersion}`); // 逐版本升级 for (let version = fromVersion; version < toVersion; version++) { await this.migrateToV...
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 migrateDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fromVersion AST#identifier#Right AST#ERROR#Left AST#...
private async migrateDatabase(fromVersion: number, toVersion: number): Promise<void> { if (!this.rdbStore) return; console.info(`[DatabaseService] Migrating from v${fromVersion} to v${toVersion}`); // 逐版本升级 for (let version = fromVersion; version < toVersion; version++) { await this.migrateToV...
https://github.com/pangpang20/antennaPodHM
0977f28d95907852a6b17cedb47c97521e6a8088
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/IconUtils.ets
arkts
getIconResourcePath
获取图标资源路径 @param iconId 图标ID @returns 图标资源路径
static getIconResourcePath(iconId: number | string): ResourceStr { // 默认图标 let iconResource: Resource = $r('app.media.C48_Folder'); if (typeof iconId === 'string') { let icon = KdbxUtils.getCustomIcon(iconId, FileService.getInstance().getDbFileParam().database.meta); if (icon) { retur...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getIconResourcePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iconId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_exp...
static getIconResourcePath(iconId: number | string): ResourceStr { // 默认图标 let iconResource: Resource = $r('app.media.C48_Folder'); if (typeof iconId === 'string') { let icon = KdbxUtils.getCustomIcon(iconId, FileService.getInstance().getDbFileParam().database.meta); if (icon) { retur...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/IconUtils.ets#L19-L244
cf942cd80bbbe3bc15eb0036f5296fb357eec101
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
setMinWidth
Sets the minimum width that the axis should take (in dp). @param minWidth
public setMinWidth(minWidth: number): void { this.mMinWidth = minWidth; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
public setMinWidth(minWidth: number): void { this.mMinWidth = minWidth; }
https://gitee.com/openharmony/developtools_profiler.git
d2d6eb7d23f83aabd666e7a7d23e11e700d7be82
gitee
HarmonyOS_Samples/BestPracticeSnippets
PCProject/entry/src/main/ets/pages/Index.ets
arkts
build
[End create_float_window_background]
build() { Column() { Button('Start Ability windowMode', { controlSize: ControlSize.SMALL }) .width(448) .margin({ right: 16, bottom: 16, left: 16 }) .onClick(() => { // [Start start_ability_full_screens] let want: Want = { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { Button('Start Ability windowMode', { controlSize: ControlSize.SMALL }) .width(448) .margin({ right: 16, bottom: 16, left: 16 }) .onClick(() => { // [Start start_ability_full_screens] let want: Want = { ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
003cd9e456104a4002b3b53a5db6bf6838631472
gitcode
OSpark-Team/Free-PCM
entry/src/main/ets/pages/Index.ets
arkts
build
=== 主界面构建 ===
build() { Column() { // 头部区域 Column() { Text(this.message) .fontSize(20) .fontWeight(700) .margin({ top: 15, bottom: 5 }) Text( this.durationMs > 0 ? `${this.formatTime(this.currentPosMs)} / ${this.formatTime(this.durationMs)}` ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { // 头部区域 Column() { Text(this.message) .fontSize(20) .fontWeight(700) .margin({ top: 15, bottom: 5 }) Text( this.durationMs > 0 ? `${this.formatTime(this.currentPosMs)} / ${this.formatTime(this.durationMs)}` ...
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/entry/src/main/ets/pages/Index.ets#L483-L672
66bf1fc59ddc5a0a6e135d53fb90c46bb6f72119
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnRadioViewModel.ets
arkts
setRadioValue1
设置单选框组1的选中值 @param value 新的选中值
setRadioValue1(value: string): void { this.radioValue1 = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRadioValue1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
setRadioValue1(value: string): void { this.radioValue1 = value; }
https://github.com/codelably/tuniao-ui
bf21effb473dc256ab63d399390247d9521268ed
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
map
Creates a new BigUint64Array using fn(arr[i]) over all elements of current BigUint64Array @param fn a function to apply for each element of current BigUint64Array @returns a new BigUint64Array where for each element from current BigUint64Array fn was applied
public map(fn: (val: BigInt) => BigInt): BigUint64Array { let newF: (val: BigInt, index: int) => BigInt = (val: BigInt, index: int): BigInt => { return fn(new BigInt(val)) } return this.map(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map 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#Right...
public map(fn: (val: BigInt) => BigInt): BigUint64Array { let newF: (val: BigInt, index: int) => BigInt = (val: BigInt, index: int): BigInt => { return fn(new BigInt(val)) } return this.map(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b911f475947125e2dc9a4abc282195c243dba1a1
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnRadioViewModel.ets
arkts
setRadioValue4
设置单选框组4的选中值 @param value 新的选中值
setRadioValue4(value: string): void { this.radioValue4 = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRadioValue4 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
setRadioValue4(value: string): void { this.radioValue4 = value; }
https://github.com/codelably/tuniao-ui
309cde5aa7c41239c71b6b1a356f4995af7c0774
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test11_original_index.ets
arkts
testLogicalDefault
--- Logical OR default pattern ---
function testLogicalDefault(maybeVal: string | undefined): string { let val: string; if (maybeVal !== undefined && maybeVal !== null) { val = maybeVal; } else { val = 'default'; } return val; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLogicalDefault AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left maybeVal AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function testLogicalDefault(maybeVal: string | undefined): string { let val: string; if (maybeVal !== undefined && maybeVal !== null) { val = maybeVal; } else { val = 'default'; } return val; }
https://github.com/miaochiahao/ark-ghidra
faee67071cb923a1456847b98ed05a370aa2e35f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/LimitLine.ets
arkts
setLabelPosition
Sets the position of the LimitLine value label (either on the right or on the left edge of the chart). Not supported for RadarChart. @param pos
public setLabelPosition(pos: LimitLabelPosition) { this.mLabelPosition = pos; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLabelPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public setLabelPosition(pos: LimitLabelPosition) { this.mLabelPosition = pos; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
7e095622c8a8e44b30798c8500026eb6aa57cfbe
gitee
HarmonyOS_Samples/BestPracticeSnippets
DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets
arkts
initCamera
Initializes the camera function @param surfaceId - Surface ID @param cameraDeviceIndex - Camera equipment index @returns No return value
async initCamera(cameraDeviceIndex: number, uiContext: UIContext): Promise<void> { Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`); try { await this.releaseCamera(); // Get the Camera Manager instance this.cameraManager = this.getCameraManagerFn(uiContext); if (...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cameraDeviceIndex AST#identifier#Right AST#type_annotation#...
async initCamera(cameraDeviceIndex: number, uiContext: UIContext): Promise<void> { Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`); try { await this.releaseCamera(); // Get the Camera Manager instance this.cameraManager = this.getCameraManagerFn(uiContext); if (...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
af54401273b1988103f5416c222f64fe707e7ae4
gitcode
honjow/Next2V
feature/node/src/main/ets/viewmodel/NodeViewModel.ets
arkts
prefillFromCache
Cache-first prefill. Fill only empty fields so a network publish that already landed (or lands first) is never clobbered by stale cache — the request-id/source arbitration stays authoritative.
prefillFromCache(node: V2exNode | null, topics: V2exTopic[]): void { if (node && !this.nodeDetail) { this.nodeDetail = node } if (topics.length > 0 && this.nodeTopics.length === 0) { this.nodeTopics = topics } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left prefillFromCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left V2exNode AST...
prefillFromCache(node: V2exNode | null, topics: V2exTopic[]): void { if (node && !this.nodeDetail) { this.nodeDetail = node } if (topics.length > 0 && this.nodeTopics.length === 0) { this.nodeTopics = topics } }
https://github.com/honjow/Next2V
188d047889a424195f2b6b306a0497612c0dd1e1
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
getObjectInfoForTable
Converts an object into a map of string key-value pairs for table representation. Handles various types including primitives, collections, arrays, classes, and functions. @param obj - The object to be converted into table info @returns A Map containing string representations of object properties
private static getObjectInfoForTable(obj: Any): Map<string, string> { const mapping = new Map<string, string>(); // Handle primitive types if (obj === null) { mapping.set("Values", "null"); } else if (obj === undefined) { mapping.set("Values", "undefined"); ...
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 getObjectInfoForTable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:...
private static getObjectInfoForTable(obj: Any): Map<string, string> { const mapping = new Map<string, string>(); // Handle primitive types if (obj === null) { mapping.set("Values", "null"); } else if (obj === undefined) { mapping.set("Values", "undefined"); ...
https://gitcode.com/iop123123/arkts-static-skills
2a17e6bb787589ef11364ef09cfa0b3a27fc9df1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setDouble
Sets a current JsonElement to a double value. @param {double} value - The double value to set
setDouble(value: double): void { this.setUndefined() this.maybeDoubleValue = value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right AST#)#Left ) AST#...
setDouble(value: double): void { this.setUndefined() this.maybeDoubleValue = value }
https://gitcode.com/iop123123/arkts-static-skills
c5b091a890cf7066e6f89e2cd4309137f67dfabe
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
mod
Return a new Decimal whose value is the value of this Decimal modulo `n`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value } n {double | string | Decimal} @returns { Decimal }the Decimal type
public mod(n: Value): Decimal { let y = new Decimal(n); if (!this.d || !y.s || y.d && !y.d![0]) { return new Decimal(NaN); } if (!y.d || this.d && !this.d![0]) { return Utils.finalise(new Decimal(this), Decimal.precision, Decimal.rounding); } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mod AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
public mod(n: Value): Decimal { let y = new Decimal(n); if (!this.d || !y.s || y.d && !y.d![0]) { return new Decimal(NaN); } if (!y.d || this.d && !this.d![0]) { return Utils.finalise(new Decimal(this), Decimal.precision, Decimal.rounding); } ...
https://gitcode.com/iop123123/arkts-static-skills
116a7b2f52dee0ca7580a6c1034cd12bf8ab5903
gitcode
banggx/account_app_harmonyos
entry/src/main/ets/service/account.ets
arkts
statsConsumeByDate
按日期统计消费
statsConsumeByDate(records: AccountPO[]) { const groupRes = records.reduce<Record<number, StatsByDate>>((map, item) => { const dateTime = item.time; if (!map[dateTime]) { map[dateTime] = { time: dateTime, expenses: 0, income: 0, } } const { acc...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left statsConsumeByDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#ident...
statsConsumeByDate(records: AccountPO[]) { const groupRes = records.reduce<Record<number, StatsByDate>>((map, item) => { const dateTime = item.time; if (!map[dateTime]) { map[dateTime] = { time: dateTime, expenses: 0, income: 0, } } const { acc...
https://github.com/banggx/account_app_harmonyos
a076db3bb301e9d13bdd721c412549c50db9133f
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
fill
Fills the Int16Array with specified value @param value new valuy @returns modified Int16Array
public fill(value: number, start: number, end: number): Int16Array { return this.fill(value as double as int as short, 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): Int16Array { return this.fill(value as double as int as short, start as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7fc5d17f625ac9120e579d9f18081347e0e57c90
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
isHostLikeUrlWithoutScheme
检测是否为缺少协议头的主机地址(如 192.168.1.2:4567/api/...)
private isHostLikeUrlWithoutScheme(url: string): boolean { const slashIndex = url.indexOf('/'); const hostPart = slashIndex >= 0 ? url.substring(0, slashIndex) : url; const pathPart = slashIndex >= 0 ? url.substring(slashIndex) : ''; if (!hostPart) { return false; } const isIpv4Host = /...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isHostLikeUrlWithoutScheme 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#ide...
private isHostLikeUrlWithoutScheme(url: string): boolean { const slashIndex = url.indexOf('/'); const hostPart = slashIndex >= 0 ? url.substring(0, slashIndex) : url; const pathPart = slashIndex >= 0 ? url.substring(slashIndex) : ''; if (!hostPart) { return false; } const isIpv4Host = /...
https://github.com/DaLongZhuaZi/manxia
f5691120dec013dddd12af01fab8cafa287af345
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setPinchZoom
If set to true, both x and y axis can be scaled simultaneously with 2 fingers, if false, x and y axis can be scaled separately. default: false @param enabled
public setPinchZoom(enabled: boolean): void { this.mPinchZoomEnabled = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPinchZoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public setPinchZoom(enabled: boolean): void { this.mPinchZoomEnabled = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
bb6dfee5490979bdbd245a4509eeb1e79cb83b07
gitee
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
entry/src/main/ets/model/Theme.ets
arkts
getThemeDescription
获取主题对应的描述 @param themeType 主题类型 @returns 主题描述
static getThemeDescription(themeType: ThemeType): string { return themeType === ThemeType.LIGHT ? '浅色主题' : '深色主题'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getThemeDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left themeType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
static getThemeDescription(themeType: ThemeType): string { return themeType === ThemeType.LIGHT ? '浅色主题' : '深色主题'; }
https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
a591098eecdbc8004e51d13c56b235f8a4468130
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
processAlipayResult
处理支付宝支付结果 @param {Map<string, string>} result - 支付结果 @returns {void} 无返回值
processAlipayResult(result: Map<string, string>): void { const resultStatus: string | undefined = result.get("resultStatus"); if (resultStatus === "9000") { ToastUtils.showSuccess($r("app.string.payment_success")); this.handleBackAfterPayment(true); return; } if (resultStatus === "60...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left processAlipayResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left result AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifi...
processAlipayResult(result: Map<string, string>): void { const resultStatus: string | undefined = result.get("resultStatus"); if (resultStatus === "9000") { ToastUtils.showSuccess($r("app.string.payment_success")); this.handleBackAfterPayment(true); return; } if (resultStatus === "60...
https://github.com/Joker-x-dev/CoolMallArkTS
c590ad1a3ad48a963c15cf25c6d97023736b0119
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/security/PermissionDemo.ets
arkts
requestPermissionOnSetting
被拒后再次申请指定的用户授权
requestPermissionOnSetting(permissions: Array<Permissions>) { let context: Context = this.getUIContext().getHostContext()! /* * abilityAccessCtrl.createAtManager() - 创建权限管理器 * requestPermissionOnSetting() - 被拒后再次申请指定的用户授权,会弹出用户授权框(返回值是一个 Array<abilityAccessCtrl.GrantStatus> 数组,用于说明此次请求的每个权限的授权状态) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestPermissionOnSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left permissions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
requestPermissionOnSetting(permissions: Array<Permissions>) { let context: Context = this.getUIContext().getHostContext()! /* * abilityAccessCtrl.createAtManager() - 创建权限管理器 * requestPermissionOnSetting() - 被拒后再次申请指定的用户授权,会弹出用户授权框(返回值是一个 Array<abilityAccessCtrl.GrantStatus> 数组,用于说明此次请求的每个权限的授权状态) ...
https://github.com/webabcd/HarmonyDemo
43869f0b09c1189dde3e7da6034e9518362961c6
github
Tianpei-Shi/MusicDash
src/services/UserService.ets
arkts
savePlayHistory
保存播放历史
async savePlayHistory(song: MusicItem): Promise<boolean> { if (!this.currentUser) { return false; } // 获取当前历史记录 const history = this.currentUser.history || ''; // 添加新歌曲到历史记录 if (history.length > 0) { // 检查是否已存在这首歌 const songs = history.split(','); if (!songs.i...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left savePlayHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left song AST#identifier#Right AST...
async savePlayHistory(song: MusicItem): Promise<boolean> { if (!this.currentUser) { return false; } // 获取当前历史记录 const history = this.currentUser.history || ''; // 添加新歌曲到历史记录 if (history.length > 0) { // 检查是否已存在这首歌 const songs = history.split(','); if (!songs.i...
https://github.com/Tianpei-Shi/MusicDash
c8b1bc6181b6a2ed4dffe0edcab15904ec85ce7e
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/deviceAwareness/facades/DeviceAdaptationFacade.ets
arkts
updateDeviceInfo
更新设备信息并发布到 AppStorage
private updateDeviceInfo(reason: string): void { try { // 重要:每次都重新获取 display 对象,因为旋转后属性会变化 this.displayObj = display.getDefaultDisplaySync(); const viewport: NGFViewportMetrics = this.resolveViewportMetrics(); const widthPx: number = viewport.widthPx; const heightPx: number = viewpo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateDeviceInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private updateDeviceInfo(reason: string): void { try { // 重要:每次都重新获取 display 对象,因为旋转后属性会变化 this.displayObj = display.getDefaultDisplaySync(); const viewport: NGFViewportMetrics = this.resolveViewportMetrics(); const widthPx: number = viewport.widthPx; const heightPx: number = viewpo...
https://github.com/DaLongZhuaZi/NGF
fc92f138def3767038e3abf8c48caad51f714bf4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
isMediumLayout
判断是否是中等布局(手机横屏/小平板)
public static isMediumLayout(): boolean { return ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint() === Breakpoint.SM; }
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 isMediumLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public static isMediumLayout(): boolean { return ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint() === Breakpoint.SM; }
https://github.com/DaLongZhuaZi/manxia
fb6c8326e027d95de6cdbd35e342ad37046ea27b
github
HarmonyOS_Samples/BestPracticeSnippets
ClickResponseOptimization/entry/src/main/ets/pages/VisionOptPage.ets
arkts
pageTransition
[Start pagetransition] Page A transition animation settings
pageTransition() { PageTransitionEnter({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left) PageTransitionExit({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition 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#Lef...
pageTransition() { PageTransitionEnter({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left) PageTransitionExit({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left) }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
7376b4ddadb8e61c32875f66af1067a3205bb321
gitcode
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets
arkts
setTypeface
/** * set typeface * * @param font
public setTypeface(font: string): DanmakuContext { if (this.mFont != font) { this.mFont = font; this.mDisplayer.clearTextHeightCache(); this.mDisplayer.setTypeFace(font); this.notifyConfigureChanged(DanmakuConfigTag.TYPEFACE); } return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTypeface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left font AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public setTypeface(font: string): DanmakuContext { if (this.mFont != font) { this.mFont = font; this.mDisplayer.clearTextHeightCache(); this.mDisplayer.setTypeFace(font); this.notifyConfigureChanged(DanmakuConfigTag.TYPEFACE); } return this; }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
aaced5ceb534a2ea06ad0e3cacf136129be5835c
gitee
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/net/wanAPI/WanHttpClient.ets
arkts
collect
收藏站内文章 https://www.wanandroid.com/lg/collect/{id}/json @param id 文章id @returns
public collect(id: number): Promise<AxiosResponse<IWanCommonResponse<any>>> { return this.postRequest("/lg/collect/" + id + "/json") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left collect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST...
public collect(id: number): Promise<AxiosResponse<IWanCommonResponse<any>>> { return this.postRequest("/lg/collect/" + id + "/json") }
https://github.com/RedRackham-R/WanAndroidHarmoney
f1cfe6bd741b049baf414091a81ba6e7ae562223
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets
arkts
parseDirectoryListing
解析目录列表
private parseDirectoryListing(data: string, basePath: string): WebDAVFile[] { const files: WebDAVFile[] = []; // 尝试解析WebDAV XML响应 if (data.includes('<D:response>') || data.includes('<d:response>')) { return this.parseWebDAVXml(data); } // 尝试解析HTML目录列表 if (data.includes('<a href...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseDirectoryListing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private parseDirectoryListing(data: string, basePath: string): WebDAVFile[] { const files: WebDAVFile[] = []; // 尝试解析WebDAV XML响应 if (data.includes('<D:response>') || data.includes('<d:response>')) { return this.parseWebDAVXml(data); } // 尝试解析HTML目录列表 if (data.includes('<a href...
https://github.com/DaLongZhuaZi/manxia
381326a62d6ce683931ad704d66a9d48e6875136
github
the-wwyang/kids-learning-app
src/main/ets/services/ProfileService.ets
arkts
getCurrentProfile
获取当前档案
public getCurrentProfile(): UserProfile | null { return this.currentProfile; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Le...
public getCurrentProfile(): UserProfile | null { return this.currentProfile; }
https://github.com/the-wwyang/kids-learning-app
3ab99bf4c93a5dfec832867bcf72703ecdaf519d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
isUseAutoScaleMinRestriction
Returns true if autoscale restriction for axis min value is enabled @Deprecated
public isUseAutoScaleMinRestriction(): boolean { return this.mUseAutoScaleRestrictionMin; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isUseAutoScaleMinRestriction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#L...
public isUseAutoScaleMinRestriction(): boolean { return this.mUseAutoScaleRestrictionMin; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
aacadeefd79e7561bb39e27d777a159d1817af86
gitee
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/ExportService.ets
arkts
pickExportFolder
让用户选导出文件夹,成功则持久化授权并返回 URI;取消/失败返回 null。
static async pickExportFolder(context: common.UIAbilityContext): Promise<string | null> { try { const opt = new picker.DocumentSelectOptions(); opt.selectMode = picker.DocumentSelectMode.FOLDER; opt.maxSelectNumber = 1; const uris: string[] = await new picker.DocumentViewPicker(context).se...
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 pickExportFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left...
static async pickExportFolder(context: common.UIAbilityContext): Promise<string | null> { try { const opt = new picker.DocumentSelectOptions(); opt.selectMode = picker.DocumentSelectMode.FOLDER; opt.maxSelectNumber = 1; const uris: string[] = await new picker.DocumentViewPicker(context).se...
https://github.com/picklerick422/zju-learning-assistant-OH
2857c0b657cf3aaa1c1318f9b97389055d02318a
github
751496032/ZRouter
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
buildAnimParam
注册路由转场动画,相关参数构建 @param modifier @param ctx
buildAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder { const callback = this.registerAnimParam(component, ctx) return NavAnimParamBuilder.builder(callback) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildAnimParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left component AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#object#Left object AST#object#Right AST#ERROR#Right AST#,#Left , AST...
buildAnimParam(component: object, ctx: NavDestinationContext): NavAnimParamBuilder { const callback = this.registerAnimParam(component, ctx) return NavAnimParamBuilder.builder(callback) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L326-L329
5b6791b5fb8a222c20df22d3ca22d939fc25f647
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SourceUpdateManager.ets
arkts
syncRepository
同步仓库(只更新JSON文件,不删除数据库条目)
public async syncRepository(): Promise<boolean> { if (!this.repoUrl || this.repoUrl.length === 0) { logger.warn(TAG, '未设置仓库URL,无法同步'); return false; } try { logger.info(TAG, '开始同步仓库...'); // 获取远程索引 const indexUrl = this.repoUrl.endsWith('/') ? `${this.repoUrl...
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 syncRepository AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async syncRepository(): Promise<boolean> { if (!this.repoUrl || this.repoUrl.length === 0) { logger.warn(TAG, '未设置仓库URL,无法同步'); return false; } try { logger.info(TAG, '开始同步仓库...'); // 获取远程索引 const indexUrl = this.repoUrl.endsWith('/') ? `${this.repoUrl...
https://github.com/DaLongZhuaZi/manxia
204949f9e17f802c098da9a62993328210c03554
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
executeNavigate
执行导航操作(智能等待:轮询 readyState + 最小额外等待)
private async executeNavigate(action: NavigateAction, context: ActionContext): Promise<string> { const url = this.replaceVariables(action.url, context.variables); const waitAfterLoad = action.waitAfterLoad !== undefined ? action.waitAfterLoad : 1000; const minReadyWait = 300; // 页面 ready 后的最小额外等待(确保 JS 执行...
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 executeNavigate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Lef...
private async executeNavigate(action: NavigateAction, context: ActionContext): Promise<string> { const url = this.replaceVariables(action.url, context.variables); const waitAfterLoad = action.waitAfterLoad !== undefined ? action.waitAfterLoad : 1000; const minReadyWait = 300; // 页面 ready 后的最小额外等待(确保 JS 执行...
https://github.com/DaLongZhuaZi/manxia
147d11cfeeca342545609fd9543c07e75b2cace8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets
arkts
constructor
Constructs a ConcurrentSet from a Set @param { Set<T> } set another Set
constructor(set: Set<T>) { this.elements = new ConcurrentHashMap<T, T>(); set.forEach((value: T) => { this.add(value); }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#L...
constructor(set: Set<T>) { this.elements = new ConcurrentHashMap<T, T>(); set.forEach((value: T) => { this.add(value); }); }
https://gitcode.com/iop123123/arkts-static-skills
1bc866f0c506aa6995dc5aef7a65cf5f557bfbe4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets
arkts
extractCharacters
提取主角/配角信息
private static extractCharacters(headerText: string): CharacterInfo { const result: CharacterInfo = { protagonists: [], supporting: [], others: [] }; // 提取主角 const protagonistMatch = headerText.match(/主角[::]\s*([^┃|│\n]+)/); if (protagonistMatch && protagonistMatch[1]) { c...
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 extractCharacters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left headerText AST#identifier#Right AST#ERROR#Left AS...
private static extractCharacters(headerText: string): CharacterInfo { const result: CharacterInfo = { protagonists: [], supporting: [], others: [] }; // 提取主角 const protagonistMatch = headerText.match(/主角[::]\s*([^┃|│\n]+)/); if (protagonistMatch && protagonistMatch[1]) { c...
https://github.com/DaLongZhuaZi/manxia
f951826b11e1cef0f158396b2fedbe1de6686670
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/utils/AsrDisplayManager.ets
arkts
collapse
Collapse (hide) ASR bubble for a message in this session. With hidden-set semantics, this means adding to hidden set.
collapse(messageID: string | undefined): void { if (!messageID || messageID.length === 0) { return; } if (!this.hiddenMessageIDs.has(messageID)) { this.hiddenMessageIDs.add(messageID); this.version++; // Trigger UI update console.log(`[AsrDisplayManager] 🙈 Hide ASR bubble for mess...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left collapse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left messageID AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#R...
collapse(messageID: string | undefined): void { if (!messageID || messageID.length === 0) { return; } if (!this.hiddenMessageIDs.has(messageID)) { this.hiddenMessageIDs.add(messageID); this.version++; // Trigger UI update console.log(`[AsrDisplayManager] 🙈 Hide ASR bubble for mess...
https://github.com/Tencent-RTC/TUIKit_Harmony
9df76a3546d6e420bac70585294a36596fd449dd
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int8Array from Array<int> @param { Array<int> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: Array<int>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, numbers[i].toByte()) } }
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#instantiation_expression#Left AST#identifier#Left numbers AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST...
public constructor(numbers: Array<int>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, numbers[i].toByte()) } }
https://gitcode.com/iop123123/arkts-static-skills
eab4f7ab133da83ee59d17f5f487906f2a0743c8
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/microphone/MicrophoneStream.ets
arkts
resume
恢复麦克风流
async resume(): Promise<void> { if (!this.running || !this.paused) { return; } this.moonBridge.nativeMicResume(); this.paused = false; this.notifyStateChanged(MicrophoneState.CAPTURING); console.info(TAG, '麦克风流已恢复'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resume AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Le...
async resume(): Promise<void> { if (!this.running || !this.paused) { return; } this.moonBridge.nativeMicResume(); this.paused = false; this.notifyStateChanged(MicrophoneState.CAPTURING); console.info(TAG, '麦克风流已恢复'); }
https://github.com/AlkaidLab/moonlight-harmony
a69eecba61db0942127ac07b0a103b2d77575295
github
LYM15/FireflyCompanion
entry/src/main/ets/components/OrderProgress.ets
arkts
getStatusIndex
获取状态索引 特殊规则:204 和 205 归为同一个索引 (最后一步)
getStatusIndex(code: number): number { switch (code) { case 201: return 0; // 待支付 case 202: return 1; // 服务中 case 203: return 2; // 待评价 case 204: return 3; // 已完成 case 205: return 3; // 已取消(归并) default: return 0; // 未知状态,默认第0步 } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatusIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
getStatusIndex(code: number): number { switch (code) { case 201: return 0; // 待支付 case 202: return 1; // 服务中 case 203: return 2; // 待评价 case 204: return 3; // 已完成 case 205: return 3; // 已取消(归并) default: return 0; // 未知状态,默认第0步 } }
https://github.com/LYM15/FireflyCompanion
17442157725bfd465800e7725828f7d31cf9929a
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
findSuitableScale
Find suitable scale. @param points @param rect @param origin @returns scale.
static findSuitableScale(points: Array<Point>, rect: RectF, origin: Point): number { let scale = 1; let temp = 1; for (let point of points) { if (point.x < rect.left) { temp = (origin.x - point.x) / (origin.x - rect.left); scale = Math.max(scale, temp); } if (point.x > re...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left findSuitableScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left points AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio...
static findSuitableScale(points: Array<Point>, rect: RectF, origin: Point): number { let scale = 1; let temp = 1; for (let point of points) { if (point.x < rect.left) { temp = (origin.x - point.x) / (origin.x - rect.left); scale = Math.max(scale, temp); } if (point.x > re...
https://gitee.com/openharmony/codelabs.git
3c561b25f05c7ce8e96b85308d6dd40badf6df79
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
getXEntrySpace
returns the space between the legend entries on a horizontal axis in pixels @return
public getXEntrySpace(): number { return this.mXEntrySpace; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getXEntrySpace 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 getXEntrySpace(): number { return this.mXEntrySpace; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a93dab540b5caa6b25d91dcf90d5b72f2932cf0c
gitee
openharmony-sig/knowledge_demo_entainment
FA/notebook/entry/src/main/ets/pages/Index.ets
arkts
build
笔记信息列表
build() { Column() { Column() { // 记事本标题 IndexTitle() // 笔记数量 Text((this.noteInfoList.length + '条笔记')) .fontSize(CommonConstants.FONT_SIZE_19) .width('100%') .fontColor($r('app.color.black_40')) // 搜索 Stack() { Image($...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { Column() { // 记事本标题 IndexTitle() // 笔记数量 Text((this.noteInfoList.length + '条笔记')) .fontSize(CommonConstants.FONT_SIZE_19) .width('100%') .fontColor($r('app.color.black_40')) // 搜索 Stack() { Image($...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
29ffc8a3ce110c585e6dd6412d8bbf89b4f31cf4
gitee
openharmony/applications_mms
entry/src/main/ets/service/SettingService.ets
arkts
judgeIsDeliveryReport
Determine whether a delivery report is required. @param {boolean} isMms MMS or not
judgeIsDeliveryReport(isMms) { let deliveryReportSwitch = MmsPreferences.getInstance().getValueOfDeliveryReportSwitch(); if (deliveryReportSwitch === common.DELIVERY_REPORTS.DISABLED) { return false; } // For MMS and SMS messages, true is returned. if (deliveryRep...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left judgeIsDeliveryReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isMms AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right ...
judgeIsDeliveryReport(isMms) { let deliveryReportSwitch = MmsPreferences.getInstance().getValueOfDeliveryReportSwitch(); if (deliveryReportSwitch === common.DELIVERY_REPORTS.DISABLED) { return false; } // For MMS and SMS messages, true is returned. if (deliveryRep...
https://gitee.com/openharmony/applications_mms.git
683fb588bffadeb39f4cb9460a1edab418e9ee58
gitee
OHPG/FinSdk
jellyfin/src/main/ets/api/ArtistsApi.ets
arkts
getAlbumArtists
@summary Gets all album artists from a given item, folder, or the entire library. @param {ArtistsApiGetAlbumArtistsRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof ArtistsApi
public getAlbumArtists(requestParameters: ArtistsApiGetAlbumArtistsRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: "/Artists/AlbumArtists", parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAlbumArtists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ass...
public getAlbumArtists(requestParameters: ArtistsApiGetAlbumArtistsRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: "/Artists/AlbumArtists", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
4266e93f6cfe6d06ad1a959199321ff78bc0b97a
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DashboardPage.ets
arkts
formatEventTime
格式化时间显示
formatEventTime(event: CalendarEvent): string { const startDate = new Date(event.startTime); const endDate = new Date(event.endTime); // 判断是否是今天、明天等 const today = new Date(); today.setHours(0, 0, 0, 0); const startDay = new Date(event.startTime); startDay.setHours(0, 0, 0, 0); const...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatEventTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CalendarEvent AST#identifier#Right AST#...
formatEventTime(event: CalendarEvent): string { const startDate = new Date(event.startTime); const endDate = new Date(event.endTime); // 判断是否是今天、明天等 const today = new Date(); today.setHours(0, 0, 0, 0); const startDay = new Date(event.startTime); startDay.setHours(0, 0, 0, 0); const...
https://gitcode.com/openharmony/codelabs
e4f556fd7c93e2c39c87edab12dc5cdfdf3f76bb
gitcode
terryma2024/happyword
harmonyos/entry/src/test/CocosBattleBridge.test.ets
arkts
runAll
Run and drain everything currently scheduled (not re-entrant safe; fine for tests).
runAll(): void { const pending: ScheduledCall[] = this.calls; this.calls = []; for (let i = 0; i < pending.length; i++) { pending[i].fn(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left runAll 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#Left ...
runAll(): void { const pending: ScheduledCall[] = this.calls; this.calls = []; for (let i = 0; i < pending.length; i++) { pending[i].fn(); } }
https://github.com/terryma2024/happyword
a39965a5320d76b936b529b75fdb3bec98673655
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Adapters/UnifiedContentAdapter.ets
arkts
getOriginalNovel
从统一内容获取原始小说数据
static getOriginalNovel(unifiedContent: UnifiedContent): LegadoBook | null { if (unifiedContent.originalType !== UnifiedContentType.NOVEL) { logger.warn(TAG, '尝试从非小说内容获取小说数据'); return null; } return unifiedContent.originalData as LegadoBook; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOriginalNovel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left unifiedContent AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
static getOriginalNovel(unifiedContent: UnifiedContent): LegadoBook | null { if (unifiedContent.originalType !== UnifiedContentType.NOVEL) { logger.warn(TAG, '尝试从非小说内容获取小说数据'); return null; } return unifiedContent.originalData as LegadoBook; }
https://github.com/DaLongZhuaZi/manxia
a5d26ab94165d795b116ac59ae81ef0c639d111d
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
setGlobalInterceptor
设置全局拦截器,每个路由栈只能设置一次 @param interceptor @param stackName
public static setGlobalInterceptor(interceptor: IGlobalNavigateInterceptor, stackName: string = DEFAULT_STACK_NAME) { ZRouter.getRouterMgr().setGlobalInterceptor(interceptor, stackName) }
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 setGlobalInterceptor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interceptor AST#identifier#Right A...
public static setGlobalInterceptor(interceptor: IGlobalNavigateInterceptor, stackName: string = DEFAULT_STACK_NAME) { ZRouter.getRouterMgr().setGlobalInterceptor(interceptor, stackName) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L279-L281
fad8d6f67da7d16175d8a4506ba3f7b243b83a09
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
getBuildings
获取所有建筑信息
public getBuildings(): BuildingInfo[] | null { return this.buildingData?.buildings ?? null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBuildings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AS...
public getBuildings(): BuildingInfo[] | null { return this.buildingData?.buildings ?? null; }
https://github.com/LJ666-ui/harmony-health-care
36422d5c43d6a07d49af26fcd9218f69af06565b
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGCircle.ets
arkts
setCY
设置圆心y坐标 @param newCY 圆心y坐标值
public setCY(newCY: number): void{ this._cy = newCY; this._circleResultObj['cy'] = newCY; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setCY AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newCY AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public setCY(newCY: number): void{ this._cy = newCY; this._circleResultObj['cy'] = newCY; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
178de8d5b1239cfb5d22f8cd17c1e5c84ed75a5e
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/ImportExportService.ets
arkts
getSensitivePreferenceKeys
敏感偏好键(不含 API 密钥时需跳过)
function getSensitivePreferenceKeys(): string[] { registerAllSearchEngines() const keys = getSearchEngineRegistry().getSensitiveKeys() keys.push(PreferenceKeys.MCP_SERVER_CONFIGS_JSON) keys.push(PreferenceKeys.WEBDAV_SERVER_URL) keys.push(PreferenceKeys.WEBDAV_USERNAME) keys.push(PreferenceKeys.WEBDAV_PASSW...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getSensitivePreferenceKeys 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#...
function getSensitivePreferenceKeys(): string[] { registerAllSearchEngines() const keys = getSearchEngineRegistry().getSensitiveKeys() keys.push(PreferenceKeys.MCP_SERVER_CONFIGS_JSON) keys.push(PreferenceKeys.WEBDAV_SERVER_URL) keys.push(PreferenceKeys.WEBDAV_USERNAME) keys.push(PreferenceKeys.WEBDAV_PASSW...
https://github.com/LongLiveY96/chatcube
02e26da9ec289d06cf8636f8b02fd6da28cc86f7
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setGridColor
Sets the color of the grid lines for this axis (the horizontal lines coming from each label). @param color
public setGridColor(color: number): void { this.mGridColor = color; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setGridColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public setGridColor(color: number): void { this.mGridColor = color; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e7410f5c29cbbafaa38aad58f541809a98637d5d
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/BackgroundMusicManager.ets
arkts
applyVolume
应用当前音量设置到 AVPlayer 在用户设置值基础上乘以 0.5 衰减系数,使音量范围更精细、最大音量更柔和
private applyVolume(): void { if (!this.avPlayer) return; const volumePercent = this.settingsManager.getSync<number>('bgm_volume', 20); const vol = (volumePercent / 100.0) * 0.25; this.avPlayer.setVolume(vol); hilog.debug(DOMAIN, TAG, 'BGM volume set to: %{public}d%% (actual: %{public}f)', volumeP...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyVolume 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...
private applyVolume(): void { if (!this.avPlayer) return; const volumePercent = this.settingsManager.getSync<number>('bgm_volume', 20); const vol = (volumePercent / 100.0) * 0.25; this.avPlayer.setVolume(vol); hilog.debug(DOMAIN, TAG, 'BGM volume set to: %{public}d%% (actual: %{public}f)', volumeP...
https://github.com/richshaw2015/nds
e11e14c895a3d5e79ec29ca81121b1ce96c45d63
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
getTemplateName
==================== 辅助方法 ==================== 获取模板名称
getTemplateName(template: ITemplate): string { if (isPresetTemplate(template)) { return this.presetStrategy.getTemplateName(template); } return this.userStrategy.getTemplateName(template); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTemplateName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ITemplate AST#identifier#Right AST#)...
getTemplateName(template: ITemplate): string { if (isPresetTemplate(template)) { return this.presetStrategy.getTemplateName(template); } return this.userStrategy.getTemplateName(template); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L345-L350
20c5e11a5676d6981b04f40c4611c4685fde862e
github
IoTAccessControl/ArkTSAnalysis
TestApps/IntentsKit-codelab-Clientdemo-ArkTS/entry/src/main/ets/entryability/InsightIntentExecutorImpl.ets
arkts
playMusic
实现调用播放音乐功能 @param param 意图参数 @param pageLoader 窗口
private playMusic(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { return new Promise((resolve, reject) => { let para: Record<string, string> = { 'result': `intent execute success, entityId: ${param.entityId}` }; let localStorage: Loc...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left playMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
private playMusic(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { return new Promise((resolve, reject) => { let para: Record<string, string> = { 'result': `intent execute success, entityId: ${param.entityId}` }; let localStorage: Loc...
https://github.com/IoTAccessControl/ArkTSAnalysis
ad06695f2ac73577c7b448b2b58dc6b072a46da0
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
refreshBackgroundImage
刷新背景图(生成新的时间戳以获取新图片)
async refreshBackgroundImage(): Promise<string> { this.refreshTimestamp = Date.now(); this.isLoaded = false; return await this.getBackgroundImageUrl(); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left refreshBackgroundImage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_p...
async refreshBackgroundImage(): Promise<string> { this.refreshTimestamp = Date.now(); this.isLoaded = false; return await this.getBackgroundImageUrl(); }
https://github.com/AlkaidLab/moonlight-harmony
7b44d6bd053fe2c1cf8160c1d65893e005e48319
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/ApiClient.ets
arkts
createInviteLink
创建邀请链接
async createInviteLink( maxRedemptions: number, expiresAt: Date | null, description: string, email: string ): Promise<InviteLinkResponse> { const body: Record<string, Object> = {}; body['max_redemptions_allowed'] = maxRedemptions; if (expiresAt !== null) { body['expires_at'] = expi...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createInviteLink AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left maxRedemptions AST#identifier#Right AST#type_annotation#Left A...
async createInviteLink( maxRedemptions: number, expiresAt: Date | null, description: string, email: string ): Promise<InviteLinkResponse> { const body: Record<string, Object> = {}; body['max_redemptions_allowed'] = maxRedemptions; if (expiresAt !== null) { body['expires_at'] = expi...
https://github.com/Amaz1ny/HarmonyDO-public
6b65efc3021bd29d130c7f0b0da488d8a29ef692
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/pages/QuickLoginPage.ets
arkts
checkboxChange
The user changes the agreement acceptance status.
checkboxChange(value: boolean) { if (value) { // The user accepts the agreements. this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.ACCEPTED); } else { // The user does not accept the agreements. this.controller.setAgreementStatus(loginComponentManager.AgreementS...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkboxChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Ri...
checkboxChange(value: boolean) { if (value) { // The user accepts the agreements. this.controller.setAgreementStatus(loginComponentManager.AgreementStatus.ACCEPTED); } else { // The user does not accept the agreements. this.controller.setAgreementStatus(loginComponentManager.AgreementS...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
935a41fe2c0cf8734edbe43378e1c629fc5bb014
gitcode
Cool_foolisher1/ArkTSRepository
ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/component/preference/utils/PreferenceUtils.ets
arkts
get
获取首选项 @param key 键 @returns preferences.ValueType | null
get(key: string): preferences.ValueType | null { if (!this.preferences) { hilog.error(this.domain, this.tag, `加载Preference失败, Preference尚未初始化!`) return null } try { let value = this.preferences.getSync(key, '') if (value == '') { hilog.error(this.domain, this.tag, `未查询到key!...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
get(key: string): preferences.ValueType | null { if (!this.preferences) { hilog.error(this.domain, this.tag, `加载Preference失败, Preference尚未初始化!`) return null } try { let value = this.preferences.getSync(key, '') if (value == '') { hilog.error(this.domain, this.tag, `未查询到key!...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
a779109ea14116edca54076528b899c9b50414e7
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
getSession
获取单个会话
async getSession(sessionId: string): Promise<ChatSession | null> { await this.waitForInitialization() if (this.rdbStore === null) { return null } const predicates = new relationalStore.RdbPredicates(TableNames.SESSIONS) predicates.equalTo('id', sessionId) try { const resultSet = aw...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSession AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async getSession(sessionId: string): Promise<ChatSession | null> { await this.waitForInitialization() if (this.rdbStore === null) { return null } const predicates = new relationalStore.RdbPredicates(TableNames.SESSIONS) predicates.equalTo('id', sessionId) try { const resultSet = aw...
https://github.com/LongLiveY96/chatcube
03307c80ad5fbcad43b1d61f153472632b73e341
github
arkui-x/samples
CodeLab/Cases/feature/clockin/src/main/ets/components/ClockInComponent.ets
arkts
setMarkerInfo
设置标记信息。
setMarkerInfo() { // TODO:知识点:逆地址解析,将坐标转换为地理描述,并展示在标记的信息窗口中 if (this.myPositionWGS84) { let reverseGeocodeRequest: geoLocationManager.ReverseGeoCodeRequest = { latitude: this.myPositionWGS84.latitude, longitude: this.myPositionWGS84.longitude, maxItems: 1 // 获取最近的一个地址 }; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setMarkerInfo 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...
setMarkerInfo() { // TODO:知识点:逆地址解析,将坐标转换为地理描述,并展示在标记的信息窗口中 if (this.myPositionWGS84) { let reverseGeocodeRequest: geoLocationManager.ReverseGeoCodeRequest = { latitude: this.myPositionWGS84.latitude, longitude: this.myPositionWGS84.longitude, maxItems: 1 // 获取最近的一个地址 }; ...
https://gitcode.com/arkui-x/samples
55057e9f20690070ab9152e31e5fac8cbb0dcbec
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
doWritev
The implementation logic of flushing chunks in the buffer in batches should not be actively called. The call is controlled by Writable.write. @param { string[] | Uint8Array[] } [chunks] - Data to be written. @param { Function } [callback] - Callback after writing. @throws { BusinessError } 401 - Parameter error. Possib...
doWritev(chunks: string[] | Uint8Array[], callback: Function): void {}
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doWritev AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#subscript_expression#Left AST#iden...
doWritev(chunks: string[] | Uint8Array[], callback: Function): void {}
https://gitcode.com/iop123123/arkts-static-skills
f4af8d8eee482ac397783c1153892f899cffffb9
gitcode
pangpang20/antennaPodHM
entry/src/main/ets/service/DownloadService.ets
arkts
deleteDownloadedFile
删除已下载文件
async deleteDownloadedFile(episode: Episode): Promise<void> { if (episode.localPath) { try { // 删除文件 await fs.unlink(episode.localPath); // 更新数据库 episode.downloadStatus = DownloadStatus.NOT_DOWNLOADED; episode.localPath = ''; await this.dbService.upda...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteDownloadedFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left episode AST#identifier#R...
async deleteDownloadedFile(episode: Episode): Promise<void> { if (episode.localPath) { try { // 删除文件 await fs.unlink(episode.localPath); // 更新数据库 episode.downloadStatus = DownloadStatus.NOT_DOWNLOADED; episode.localPath = ''; await this.dbService.upda...
https://github.com/pangpang20/antennaPodHM
3f94fa0a8a4c9bd9e5a2577205736aa762d9ad85
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
syncSetting
同步设置到远端 同步开关本身不同步,避免跨设备关闭同步
public static async syncSetting(key: string, value: preferences.ValueType): Promise<void> { if (!(SyncSettingsService.isSyncEnabled())) { return; } // 跳过同步开关本身,避免跨设备关闭同步 if (key === SettingsService.KEY_APP_SYNC_SETTING_ENABLE) { return; } try { const localVersion = SyncSetti...
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 syncSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AS...
public static async syncSetting(key: string, value: preferences.ValueType): Promise<void> { if (!(SyncSettingsService.isSyncEnabled())) { return; } // 跳过同步开关本身,避免跨设备关闭同步 if (key === SettingsService.KEY_APP_SYNC_SETTING_ENABLE) { return; } try { const localVersion = SyncSetti...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L221-L248
d3fddfbc4543cf499d8c678700f80c6e8afd4943
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/common/database/Rdb.ets
arkts
query
查询数据 @param predicates 查询条件 @param callback 回调函数,当数据查询完成时被调用,参数为查询结果集
query(predicates: relationalStore.RdbPredicates, callback: Function = () => { }) { // 检查回调函数是否有效 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'query() has no callback!'); return; } // 如果rdbStore实例存在,则调用query方法查询数据 ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left re...
query(predicates: relationalStore.RdbPredicates, callback: Function = () => { }) { // 检查回调函数是否有效 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'query() has no callback!'); return; } // 如果rdbStore实例存在,则调用query方法查询数据 ...
https://github.com/yang-kun-long/HarmonyAccounting
ae2fd16b6718db16e920d10b1f378186bbfccc81
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
redo
重做:恢复到 redo 栈顶的快照
redo(): boolean { if (this.redoStack.length === 0) return false; // 保存当前状态到 undo 栈 const current: EditSnapshot = { textA: this.textA, textB: this.textB, description: '重做前状态' }; this.undoStack.push(current); // 恢复 redo 快照 const snapshot = this.redoStack.pop()!; this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_bloc...
redo(): boolean { if (this.redoStack.length === 0) return false; // 保存当前状态到 undo 栈 const current: EditSnapshot = { textA: this.textA, textB: this.textB, description: '重做前状态' }; this.undoStack.push(current); // 恢复 redo 快照 const snapshot = this.redoStack.pop()!; this....
https://github.com/XJTUWYD/ArkDiff
821fd50f42e3c6353161c462013a98ddd075d9c5
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/AccountKitService.ets
arkts
clearCredential
清除凭据 (退出登录)
clearCredential(): void { this.credential = null; this.saveToDisk().catch((_: Error) => { /* ignore */ }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearCredential 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_bl...
clearCredential(): void { this.credential = null; this.saveToDisk().catch((_: Error) => { /* ignore */ }); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
c8f11b4a0dd59da92cbfdd5d59f188c3c6bfa3b5
github
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
sftpChmod
Change permissions of a remote file or directory. @param path Remote path @param mode Permission bits (e.g. 0o755, 0o644)
async sftpChmod(path: string, mode: number): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { await ssh.sftpChmod(this.handle, path, mode); } catch (err) { const msg = (err as Error).message ?? 'SFTP chmod failed'; const error = new...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpChmod AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left...
async sftpChmod(path: string, mode: number): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { await ssh.sftpChmod(this.handle, path, mode); } catch (err) { const msg = (err as Error).message ?? 'SFTP chmod failed'; const error = new...
https://github.com/UnbalancedCat/ohos-ssh-core
ca6eef7a1886d51cceab717fe50847eef79878d3
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
constructor
`Date` constructor. @param year @param month @param day @param hours @param minutes @param seconds @param ms @see ECMA-262, 21.4.2.1
constructor(year: double, month: double, day: double, hours: double, minutes: double, seconds: double, ms: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, ms)) this.TZOffset = Date.getLocalTimezoneOffset() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right A...
constructor(year: double, month: double, day: double, hours: double, minutes: double, seconds: double, ms: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, ms)) this.TZOffset = Date.getLocalTimezoneOffset() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
80b1b0a48768147453d1219cfce781e3ac66132f
gitee
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets
arkts
onMove
需要覆写的平移事件 @param event
public onMove(event: TouchEvent) {}
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEve...
public onMove(event: TouchEvent) {}
https://gitee.com/openharmony/developtools_profiler.git
16010e3d877717dfcdf7f74b6e3a30debe5a0236
gitee
arkui-x/samples
CodeLab/Cases/feature/imageviewer/src/main/ets/view/ImageItemView.ets
arkts
calcFitScaleRatio
TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率 @param imageSize:图片当前大小 @param windowSize:窗口大小 @returns:缩放倍率
calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { let ratio: number = 1.0; if (windowSize.width > imageSize.width) { ratio = windowSize.width / imageSize.width; } else { ratio = windowSize.height / imageSize.height; } return ratio; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calcFitScaleRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left imageSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left image AST#identifier#R...
calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { let ratio: number = 1.0; if (windowSize.width > imageSize.width) { ratio = windowSize.width / imageSize.width; } else { ratio = windowSize.height / imageSize.height; } return ratio; }
https://gitcode.com/arkui-x/samples
71456c77dd60f0c50a57dbbffd6173a979a1f1ef
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
getMaxConcurrent
获取最大并发数
getMaxConcurrent(isOnline: boolean): number { return isOnline ? this.config.maxConcurrentOnline : this.config.maxConcurrentLocal; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMaxConcurrent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isOnline AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left )...
getMaxConcurrent(isOnline: boolean): number { return isOnline ? this.config.maxConcurrentOnline : this.config.maxConcurrentLocal; }
https://github.com/DaLongZhuaZi/manxia
c5bbdb4c97512dc63420cea85705b50bb423dc64
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/pages/PlanDetailPage.ets
arkts
updateTaskDistanceTarget
更新任务目标值(多类型)
updateTaskDistanceTarget(index: number, value: number): void { const newTasks = [...this.editTasks]; const oldTask = newTasks[index]; const task = new DailyTask(); task.distanceTarget = value; task.durationTarget = oldTask.durationTarget; task.caloriesTarget = oldTask.caloriesTarget; task....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateTaskDistanceTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS...
updateTaskDistanceTarget(index: number, value: number): void { const newTasks = [...this.editTasks]; const oldTask = newTasks[index]; const task = new DailyTask(); task.distanceTarget = value; task.durationTarget = oldTask.durationTarget; task.caloriesTarget = oldTask.caloriesTarget; task....
https://gitcode.com/openharmony/codelabs
efd582ae87fb9b40eb7452c87ee4da9bd411f82e
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setDrawSliceText
Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). Deprecated -> use setDrawEntryLabels(...) instead. @param enabled @Deprecated
public setDrawSliceText(enabled: boolean): void { this.mDrawEntryLabels = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawSliceText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setDrawSliceText(enabled: boolean): void { this.mDrawEntryLabels = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
fee6cdb2e2f7f4397c696ce681e6d68c2de3329a
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
getImageDailyTrend
最近 dayCount 天每日生图张数趋势(本地时区分桶,缺失天补 0)
async getImageDailyTrend(dayCount: number = 30): Promise<DailyUsagePoint[]> { await this.waitForInitialization() if (this.rdbStore === null) { return [] } const safeDayCount = dayCount > 0 ? dayCount : 30 const sinceMs = Date.now() - safeDayCount * 24 * 60 * 60 * 1000 const valueByDay = ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getImageDailyTrend AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dayCount AST#identifier#Right AST#type_annotation#Left AST#:...
async getImageDailyTrend(dayCount: number = 30): Promise<DailyUsagePoint[]> { await this.waitForInitialization() if (this.rdbStore === null) { return [] } const safeDayCount = dayCount > 0 ? dayCount : 30 const sinceMs = Date.now() - safeDayCount * 24 * 60 * 60 * 1000 const valueByDay = ...
https://github.com/LongLiveY96/chatcube
3436a60876d3891184ce455b008a5293a589f077
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets
arkts
parseJsonListing
解析JSON目录列表
private parseJsonListing(json: Object[], basePath: string): WebDAVFile[] { const files: WebDAVFile[] = []; for (const item of json) { const obj = item as Record<string, Object>; const name = String(obj.name || obj.filename || ''); if (!name) continue; const isDirectory = Bo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseJsonListing 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#subscript_ex...
private parseJsonListing(json: Object[], basePath: string): WebDAVFile[] { const files: WebDAVFile[] = []; for (const item of json) { const obj = item as Record<string, Object>; const name = String(obj.name || obj.filename || ''); if (!name) continue; const isDirectory = Bo...
https://github.com/DaLongZhuaZi/manxia
5419749e8449298cf47b80c566fbee7586462dcd
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a Float32Array with the same underlying ArrayBuffer @param begin start index, inclusive @param end last index, exclusive @returns new Float32Array with the same underlying ArrayBuffer
public subarray(begin: number, end: number): Float32Array { return this.subarray(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number, end: number): Float32Array { return this.subarray(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9f51549d3fe54612ab8a2c1c6dab9fb854613fef
gitee
yongoe1024/RdbPlus
entry/src/main/ets/rdb/MapperMultiple.ets
arkts
getInstance1DB
单例模式 db1
static getInstance1DB() { if (!MapperMultiple.mapper1) { MapperMultiple.mapper1 = BaseMapper.build<Employee>({ class: Employee, config: { name: 'RdbTest1.db', // 数据库文件名 securityLevel: relationalStore.SecurityLevel.S3, // 数据库安全级别 } }) } return MapperM...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance1DB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
static getInstance1DB() { if (!MapperMultiple.mapper1) { MapperMultiple.mapper1 = BaseMapper.build<Employee>({ class: Employee, config: { name: 'RdbTest1.db', // 数据库文件名 securityLevel: relationalStore.SecurityLevel.S3, // 数据库安全级别 } }) } return MapperM...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/entry/src/main/ets/rdb/MapperMultiple.ets#L13-L24
f54bcb9271dd3b9168126ea626b2e6e0ef4ca3dd
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
send_current_time
7x3 播放时间广播 //
private send_current_time(time: number) { // 更新本地数据 // this.current_time = time // 广播 // emitter.emit({ eventId: 713 }, { data: { current_time: time, current_time_format: ms_to_times(time) } }) emitter.emit({ eventId: 723 }, { data: { current_time: time, current_time_format: ms_to_times(time) } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_current_time AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private send_current_time(time: number) { // 更新本地数据 // this.current_time = time // 广播 // emitter.emit({ eventId: 713 }, { data: { current_time: time, current_time_format: ms_to_times(time) } }) emitter.emit({ eventId: 723 }, { data: { current_time: time, current_time_format: ms_to_times(time) } ...
https://github.com/Nekofox-POT/LinMusic
d7eacd7881e76d4c2b4161037fc4428ba4958820
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
getCalculationArraySize
根据屏幕信息调整计算数组大小
static getCalculationArraySize(baseSize: number): number { const totalPixels = DeviceUtils.getScreenWidth() * DeviceUtils.getScreenHeight() const basePixels = 360 * 780 // 基准屏幕像素数 const scale = Math.sqrt(totalPixels / basePixels) // 使用平方根缩放避免过度放大 return Math.round(baseSize * scale * DeviceUtils.getEmp...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCalculationArraySize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
static getCalculationArraySize(baseSize: number): number { const totalPixels = DeviceUtils.getScreenWidth() * DeviceUtils.getScreenHeight() const basePixels = 360 * 780 // 基准屏幕像素数 const scale = Math.sqrt(totalPixels / basePixels) // 使用平方根缩放避免过度放大 return Math.round(baseSize * scale * DeviceUtils.getEmp...
https://github.com/SMAT-Lab/PhantomRendering
4b06781fdd9ec069e8f4a3fe06a7bda4ddcaa833
github
the-wwyang/kids-learning-app
src/main/ets/storage/WrongQuestionStorageService.ets
arkts
loadWrongQuestions
加载错题记录列表 @returns 错题记录列表
static async loadWrongQuestions(): Promise<WrongQuestionRecord[]> { try { const hasData = await dataStorage.has( WrongQuestionStorageService.STORE_NAME, WrongQuestionStorageService.KEY_RECORDS ); if (!hasData) { console.log('[WrongQuestionStorage] No saved data, returnin...
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 loadWrongQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
static async loadWrongQuestions(): Promise<WrongQuestionRecord[]> { try { const hasData = await dataStorage.has( WrongQuestionStorageService.STORE_NAME, WrongQuestionStorageService.KEY_RECORDS ); if (!hasData) { console.log('[WrongQuestionStorage] No saved data, returnin...
https://github.com/the-wwyang/kids-learning-app
53233ee0057dc510647f7d005f552cf0c9c492bd
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
searchDestinations
==================== POI搜索和推荐功能 ==================== 搜索POI(支持模糊匹配) @param keyword 搜索关键词 @param limit 返回数量限制
public searchDestinations(keyword: string, limit: number = 10): SearchResultItem[] { if (!this.buildingData || !keyword.trim()) return []; const results: SearchResultItem[] = []; const lowerKeyword = keyword.toLowerCase().trim(); for (const poi of this.buildingData.pois) { let relevanceScore =...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left searchDestinations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
public searchDestinations(keyword: string, limit: number = 10): SearchResultItem[] { if (!this.buildingData || !keyword.trim()) return []; const results: SearchResultItem[] = []; const lowerKeyword = keyword.toLowerCase().trim(); for (const poi of this.buildingData.pois) { let relevanceScore =...
https://github.com/LJ666-ui/harmony-health-care
8c8311f53b93716efed454453a6818be1ad70073
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/arkts/class/Function.ets
arkts
f3
返回值的类型也可以推导出来
function f3(x:number, y:number) { return x * y }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left f3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predef...
function f3(x:number, y:number) { return x * y }
https://github.com/webabcd/HarmonyDemo
09cc8439ae314bcb208ae6515e9b3bb7d5169d4b
github
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets
arkts
aesEncrypt
Encrypts the password using a character string. After the password is encrypted, the encrypted password is stored.
aesEncrypt() { AesUtil.encrypt(this.password).then((data: User) => { this.insertUser(data.password, data.authTag); }).catch((err: Error) => { Logger.error(`AesEecrypt err cause ${err}`); PromptUtil.promptMessage($r('app.string.message_sys_err'), CommonConstants.PROMPT_TIME) }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aesEncrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
aesEncrypt() { AesUtil.encrypt(this.password).then((data: User) => { this.insertUser(data.password, data.authTag); }).catch((err: Error) => { Logger.error(`AesEecrypt err cause ${err}`); PromptUtil.promptMessage($r('app.string.message_sys_err'), CommonConstants.PROMPT_TIME) }); }
https://gitee.com/openharmony/codelabs.git
2eae262ef0cf1dd6fc343235b5e36a8c0f091ed9
gitee