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/Novel/LegadoRuleAnalyzer.ets | arkts | getStringByCSS | ==================== CSS选择器解析 ====================
通过CSS选择器获取字符串
增强实现,支持Legado特有语法 | private getStringByCSS(selector: string): string {
// 检查是否是Legado链式规则 (class.xxx@tag.a.0@text)
if (selector.includes('@') && (selector.startsWith('class.') || selector.startsWith('id.') ||
selector.startsWith('tag.') || selector.match(/^[a-z]+\./))) {
return this.getStringByLegadoRule(selector)... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringByCSS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | private getStringByCSS(selector: string): string {
// 检查是否是Legado链式规则 (class.xxx@tag.a.0@text)
if (selector.includes('@') && (selector.startsWith('class.') || selector.startsWith('id.') ||
selector.startsWith('tag.') || selector.match(/^[a-z]+\./))) {
return this.getStringByLegadoRule(selector)... | https://github.com/DaLongZhuaZi/manxia | 05eaa9d115a5e7397a97c2a77fca9a1aea44778d | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | recordAnswer | 记录答题结果(用于智能难度调节)
@param isCorrect 是否答对
@param difficulty 题目难度 | recordAnswer(isCorrect: boolean, difficulty: Difficulty): void {
const record: AnswerHistory = {
isCorrect,
difficulty,
timestamp: Date.now()
};
this.answerHistory.push(record);
// 限制历史记录大小
if (this.answerHistory.length > this.difficultyConfig.windowSize * 2) {
this.answe... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isCorrect AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#,#Left , AS... | recordAnswer(isCorrect: boolean, difficulty: Difficulty): void {
const record: AnswerHistory = {
isCorrect,
difficulty,
timestamp: Date.now()
};
this.answerHistory.push(record);
// 限制历史记录大小
if (this.answerHistory.length > this.difficultyConfig.windowSize * 2) {
this.answe... | https://github.com/the-wwyang/kids-learning-app | 5a1fa12471672f5bd03da49723e8116280b6e3ce | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ProviderShareGenerator.ets | arkts | generateQrPixelMap | 生成 QR PixelMap。调用方负责在不再展示时 release()。 | async generateQrPixelMap(text: string): Promise<image.PixelMap> {
if (text.length < MIN_QR_CONTENT_LEN) {
throw new Error('QR content is empty')
}
try {
const options: generateBarcode.CreateOptions = {
scanType: scanCore.ScanType.QR_CODE,
height: DEFAULT_QR_SIZE,
width:... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left generateQrPixelMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right ... | async generateQrPixelMap(text: string): Promise<image.PixelMap> {
if (text.length < MIN_QR_CONTENT_LEN) {
throw new Error('QR content is empty')
}
try {
const options: generateBarcode.CreateOptions = {
scanType: scanCore.ScanType.QR_CODE,
height: DEFAULT_QR_SIZE,
width:... | https://github.com/LongLiveY96/chatcube | db4f4401d0e10f3cc97345c6e9184e7980a0e53e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/BookTransitionOverlay.ets | arkts | setPendingNavigationTimer | 设置待执行的导航定时器(用于取消) | public setPendingNavigationTimer(timer: number): void {
this.pendingNavigationTimer = timer;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPendingNavigationTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | public setPendingNavigationTimer(timer: number): void {
this.pendingNavigationTimer = timer;
} | https://github.com/DaLongZhuaZi/manxia | c5724bdd066e89f2f742c017266da6792d2e67a5 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/AppDataViewModel.ets | arkts | saveFile | 保存数据到文件 | private async saveFile<T>(data: T, defaultFileName: string) {
let file: fs.File | null = null;
try {
const documentSaveOptions = new picker.DocumentSaveOptions();
documentSaveOptions.newFileNames = [defaultFileName];
const documentViewPicker = new picker.DocumentViewPicker(this.context);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left saveFile AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T A... | private async saveFile<T>(data: T, defaultFileName: string) {
let file: fs.File | null = null;
try {
const documentSaveOptions = new picker.DocumentSaveOptions();
documentSaveOptions.newFileNames = [defaultFileName];
const documentViewPicker = new picker.DocumentViewPicker(this.context);
... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/AppDataViewModel.ets#L73-L101 | 4c6f076ac1565ad9dcf5b75e4e7b12112ce4d51e | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/pages/MainWorkspace.ets | arkts | selectChapter | ========== 选中章节 ========== | selectChapter(chapterId: string, chapterName: string, volumeId: string) {
// 如果有未保存的变更,先上报并保存
if (this.hasUnsavedChanges && this.selectedChapterId) {
const deviceId = this.settings.statsDeviceId || 'unknown'
const durationSeconds = Math.round((Date.now() - this.sessionStartTime) / 1000)
this... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS... | selectChapter(chapterId: string, chapterName: string, volumeId: string) {
// 如果有未保存的变更,先上报并保存
if (this.hasUnsavedChanges && this.selectedChapterId) {
const deviceId = this.settings.statsDeviceId || 'unknown'
const durationSeconds = Math.round((Date.now() - this.sessionStartTime) / 1000)
this... | https://github.com/Xiwei753/xiezuoruanjian | 9c6cb369f1425642e4577199246e1cd069c23f16 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | set | Copies elements from an ArrayLike object to the Uint16Array.
@param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy.
@param { int } [offset] - Optional. The offset into the target array at which to begin
writing values from the source array. The default value is 0.
@throws { RangeError... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | https://gitcode.com/iop123123/arkts-static-skills | ddad22750f541e739206e8cdfe9e94f83c80c990 | gitcode |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/components/AlarmCard/index.ets | arkts | formatTimeText | Font in the first line of the card
Time and period labels (morning, afternoon, etc.)
Rendering in two styles
@param isTag Indicates whether the label is a time segment. | @Extend(Text)
function formatTimeText(isTag: boolean) {
.fontSize(isTag ? $r('sys.float.Body_L') : $r('sys.float.Title_M'))
.fontWeight(FontWeight.Medium)
.fontColor($r('sys.color.font_primary'))
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function formatTimeText(isTag: boolean) {
.fontSize(isTag ? $r('sys.float.Body_L') : $r('sys.float.Title_M'))
.fontWeight(FontWeight.Medium)
.fontColor($r('sys.color.font_primary'))
} | https://gitee.com/openharmony-sig/applications_clock.git | 8cd26d5f22c941d3c50ddfc6e171aa4ec4b58fc5 | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/ui/web_ui.ets | arkts | set_window_color | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
扩展函数 //
//////////
设置沉浸颜色 // | set_window_color(value: string) {
window.getLastWindow(getContext(this)).then((win) => {
win.setWindowSystemBarProperties({ statusBarContentColor: value })
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left set_window_color 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#R... | set_window_color(value: string) {
window.getLastWindow(getContext(this)).then((win) => {
win.setWindowSystemBarProperties({ statusBarContentColor: value })
})
} | https://github.com/Nekofox-POT/LinMusic | c3373fb0f65afdd6eddceac8057b0679500d5b5b | github |
openharmony/applications_photos | common/src/main/ets/default/model/common/WorkerThreadPool.ets | arkts | createWorker | 创建worker
@param relativePath worker.ts文件所在的相对路径
@param deviceType 设备类型,对应不同entryName (phone, pc) | public static createWorker(relativePath: string, deviceType: string): worker.ThreadWorker {
Log.info(TAG, 'create worker, relativePath: ' + relativePath);
let entryName = deviceType == Constants.DEFAULT_DEVICE_TYPE ? PHONE_ENTRY_NAME : PC_ENTRY_NAME;
let workerInstance: worker.ThreadWorker;
try {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left createWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left relativePath AST#identifier#Right AST#ERROR#Left AST#:#Le... | public static createWorker(relativePath: string, deviceType: string): worker.ThreadWorker {
Log.info(TAG, 'create worker, relativePath: ' + relativePath);
let entryName = deviceType == Constants.DEFAULT_DEVICE_TYPE ? PHONE_ENTRY_NAME : PC_ENTRY_NAME;
let workerInstance: worker.ThreadWorker;
try {
... | https://gitee.com/openharmony/applications_photos.git | 6176c58849a5acccba04a0a4009c98bcc67bf8ba | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginationParams.ets | arkts | create | 创建 PaginationParams 实例的便捷方法
@param page 页码
@param pageSize 每页数量
@returns PaginationParams 实例 | static create(page: number, pageSize: number): PaginationParams {
return new PaginationParams(page, pageSize)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AS... | static create(page: number, pageSize: number): PaginationParams {
return new PaginationParams(page, pageSize)
} | https://github.com/offlinecat-dev/OCNetORM | 60db6aa82015edffc3bad5db28e87bd8539bd114 | github |
OHPG/FinVideo | entry/src/main/ets/player/VersionSelectStrategy.ets | arkts | select | 根据 mode 从 sources 中选出最合适的版本。
@param sources 版本列表(至少1条)
@param mode 选择模式
@returns 选中的版本,保证非空 | public static select(sources: FinItemSource[], mode: VersionSelectMode): FinItemSource {
if (sources.length === 1) {
return sources[0]
}
let selected: FinItemSource
switch (mode) {
case VersionSelectMode.Highest:
selected = VersionSelectStrategy.selectByScore(sources, false)
... | 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 select AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Left : AST#:#... | public static select(sources: FinItemSource[], mode: VersionSelectMode): FinItemSource {
if (sources.length === 1) {
return sources[0]
}
let selected: FinItemSource
switch (mode) {
case VersionSelectMode.Highest:
selected = VersionSelectStrategy.selectByScore(sources, false)
... | https://github.com/OHPG/FinVideo | 00b7553fd85183ba149118391c937d23f91e3360 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets | arkts | onScale | 需要覆写的平移事件 的缩放事件
@param event | public onScale(event: TouchEvent) {} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onScale 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 TouchEv... | public onScale(event: TouchEvent) {} | https://gitee.com/openharmony/developtools_profiler.git | a9dc081175acc467f225f516644764e27e7deb90 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | toTimestamp | 将各种时间格式转换为时间戳
@param input - 输入的时间值(Date对象、ISO字符串或时间戳)
@returns 时间戳(毫秒) | static toTimestamp(input: Date | string | number | undefined): number {
if (input === undefined || input === null) {
return Date.now();
}
if (typeof input === 'number') {
// 如果是秒级时间戳,转换为毫秒
return input < 10000000000 ? input * 1000 : input;
}
if (typeof input === 'string') {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L... | static toTimestamp(input: Date | string | number | undefined): number {
if (input === undefined || input === null) {
return Date.now();
}
if (typeof input === 'number') {
// 如果是秒级时间戳,转换为毫秒
return input < 10000000000 ? input * 1000 : input;
}
if (typeof input === 'string') {
... | https://github.com/DaLongZhuaZi/manxia | 3d1b2c0a97683d226b67d4d9a912339971ed7367 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoSourceParser.ets | arkts | parseContentRule | 解析正文规则 | private parseContentRule(obj: ESObject): LegadoContentRule | undefined {
if (!obj) {
return undefined;
}
return {
content: obj.content ? String(obj.content) : undefined,
title: obj.title ? String(obj.title) : undefined,
nextContentUrl: obj.nextContentUrl ? String(obj.nextContentUr... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseContentRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private parseContentRule(obj: ESObject): LegadoContentRule | undefined {
if (!obj) {
return undefined;
}
return {
content: obj.content ? String(obj.content) : undefined,
title: obj.title ? String(obj.title) : undefined,
nextContentUrl: obj.nextContentUrl ? String(obj.nextContentUr... | https://github.com/DaLongZhuaZi/manxia | 8f7c53d3aa9ffd4df44dff4685cc43dcb669488f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/25.bitwise_and_logical_expressions/02.boolean_logical_operators/logical_bitwise_bool.ets | arkts | main | ---
desc: Bitwise logical operations (bool)
params: {{i.xorigin}} {{i.op}} {{i.yorigin}} == {{i.dest}}
--- | function main(): void {
let x: boolean = {{i.xorigin}};
let y: boolean = {{i.yorigin}};
let dest: boolean = {{i.dest}};
assert((x {{i.op}} y) == dest); | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let x: boolean = {{i.xorigin}};
let y: boolean = {{i.yorigin}};
let dest: boolean = {{i.dest}};
assert((x {{i.op}} y) == dest); | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c93474df85828d6ece8493dfbbba860f5a04edef | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | filter | Creates a new Float32Array from current Float32Array based on a condition fn.
@param { function } fn - the condition to apply for each element
@returns { Float32Array } - a new Float32Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public filter(fn: (val: number, index: int, array: Float32Array) => boolean): Float32Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; ++i) {
markers[i] = fn((this.getUnsafe(i)).toDouble(), i, th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter 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 : AST#:#R... | public filter(fn: (val: number, index: int, array: Float32Array) => boolean): Float32Array {
let markers : ValueArray<boolean> = new ValueArray<boolean>(this.lengthInt)
let resLen = 0
for (let i = 0; i < this.lengthInt; ++i) {
markers[i] = fn((this.getUnsafe(i)).toDouble(), i, th... | https://gitcode.com/iop123123/arkts-static-skills | 2c6280eac6e32fb523031b204ccdc3ec43326217 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | sort | Sorts in-place according to the numeric ordering
@returns sorted BigUint64Array | public sort(): BigUint64Array {
let newF: (a: BigInt, b: BigInt) => number = (a: BigInt, b: BigInt): number => { throw new Error("not implemented") }
return this.sort(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public sort(): BigUint64Array {
let newF: (a: BigInt, b: BigInt) => number = (a: BigInt, b: BigInt): number => { throw new Error("not implemented") }
return this.sort(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c382adddf8b98eaec90b0c2adc910f2df418acdc | gitee |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/batchselectcontacts/BatchSelectContactsPresenter.ets | arkts | updateContact | Edit Contact | updateContact(contactId: string) {
let upDataShow = false;
if (contactId != undefined) {
upDataShow = true
}
router.replaceUrl({
url: 'pages/contacts/accountants/Accountants',
params: {
updataShow: upDataShow,
contactId: contactId,
callId: this.callId,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contactId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS... | updateContact(contactId: string) {
let upDataShow = false;
if (contactId != undefined) {
upDataShow = true
}
router.replaceUrl({
url: 'pages/contacts/accountants/Accountants',
params: {
updataShow: upDataShow,
contactId: contactId,
callId: this.callId,
... | https://gitee.com/openharmony/applications_contacts.git | 132d4c7592e19825f92d99180587cec9832c9e8a | gitee |
honjow/Next2V | shared/src/main/ets/settings/LanguageSettings.ets | arkts | reapplyForFollowSystem | Called by ApplicationContext EnvironmentCallback (application-level async event,
outside the Configuration rebuild call chain, so setAppPreferredLanguage is safe). | static reapplyForFollowSystem(): void {
const mode = (connectLanguageState().mode || LanguageSettings.MODE_SYSTEM) as string
if (LanguageSettings.normalizeMode(mode) !== LanguageSettings.MODE_SYSTEM) {
return
}
let sys = ''
try { sys = i18n.System.getSystemLanguage() } catch (_e) {}
if (... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left reapplyForFollowSystem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | static reapplyForFollowSystem(): void {
const mode = (connectLanguageState().mode || LanguageSettings.MODE_SYSTEM) as string
if (LanguageSettings.normalizeMode(mode) !== LanguageSettings.MODE_SYSTEM) {
return
}
let sys = ''
try { sys = i18n.System.getSystemLanguage() } catch (_e) {}
if (... | https://github.com/honjow/Next2V | 330b84138678f89aea6b6ad943cdff63b5aeba51 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnFormViewModel.ets | arkts | setFemaleInfo | 设置女生信息
@param value 信息值 | setFemaleInfo(value: string): void {
this.dynamicForm.femaleInfo = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFemaleInfo 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 ) ... | setFemaleInfo(value: string): void {
this.dynamicForm.femaleInfo = value;
} | https://github.com/codelably/tuniao-ui | acaf01c00b1ad4764ad1ba748ab8636319648a29 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getInstance | Gets ArrayType instance from type descriptor
@param {RuntimeTypeDescriptor} td Type descriptor
@param {RuntimeLinker} contextLinker Runtime linker context
@returns {ArrayType} ArrayType instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static getInstance(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker): ArrayType {
const arrayClass = TypeAPI.getClass(td, contextLinker)!
return ArrayType.getInstance(arrayClass)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left td AST#identifier#Right AST#:#Left : AST#:#... | public static getInstance(td: RuntimeTypeDescriptor, contextLinker: RuntimeLinker): ArrayType {
const arrayClass = TypeAPI.getClass(td, contextLinker)!
return ArrayType.getInstance(arrayClass)
} | https://gitcode.com/iop123123/arkts-static-skills | 796968a28b99c0a9f05670e4329437271458b0f3 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/division/division_float.ets | arkts | main | ---
desc: check division of two floats
--- | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
const v: float = {{v.result}} as float
const r: float = a / b
if (Float.isNaN(v)) {
assert(Float.isNaN(r))
} else {
assert r == v
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
const v: float = {{v.result}} as float
const r: float = a / b
if (Float.isNaN(v)) {
assert(Float.isNaN(r))
} else {
assert r == v
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9da0f5db563a14c442cafa6c5d1506aa511d6a9f | gitee |
LZZLHY/hlib | entry/src/main/ets/utils/PublicDownloadDir.ets | arkts | openFolder | 跳转系统文件管理器,打开公共下载目录(优先深链,失败回退 startAbility)。 | static openFolder(ctx: common.UIAbilityContext): void {
let uriParam: string = '';
if (!PublicDownloadDir.isTabletSilent()) {
uriParam = AppStorage.get<string>(AppStorageKeys.PUBLIC_DOWNLOAD_URI) ?? '';
}
if (uriParam.length === 0) {
const dir: string = PublicDownloadDir.resolveDir();
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left openFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left... | static openFolder(ctx: common.UIAbilityContext): void {
let uriParam: string = '';
if (!PublicDownloadDir.isTabletSilent()) {
uriParam = AppStorage.get<string>(AppStorageKeys.PUBLIC_DOWNLOAD_URI) ?? '';
}
if (uriParam.length === 0) {
const dir: string = PublicDownloadDir.resolveDir();
... | https://github.com/LZZLHY/hlib | 8adce630343a2f540a5585c91c55e94491f7b666 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets | arkts | play_data_load | 播放数据注入 // | async play_data_load() {
log('加载播放数据')
// 打开配置文件
let tmp = load_json_to_array(audio_player_path + '/playing_data_other.json')
// 打开检查播放列表
let tmp_list: string[] = []
for (const i of load_json_to_array(audio_player_path + '/playing_data_list.json')) {
try {
fs.openSync(i)
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left play_data_load AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expre... | async play_data_load() {
log('加载播放数据')
// 打开配置文件
let tmp = load_json_to_array(audio_player_path + '/playing_data_other.json')
// 打开检查播放列表
let tmp_list: string[] = []
for (const i of load_json_to_array(audio_player_path + '/playing_data_list.json')) {
try {
fs.openSync(i)
... | https://github.com/Nekofox-POT/LinMusic | 58a5ff819f8fc5919056f2f88937e1211251d84d | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets | arkts | getLower | Obtains the lower bound of the current range.
@returns { ScopeType } Returns the lower bound of the current range. | getLower(): T {
return this._lowerLimit
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLower AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#statement_... | getLower(): T {
return this._lowerLimit
} | https://gitcode.com/iop123123/arkts-static-skills | 6069e2527d8ac047022a8b5b2ecb6ccc2565f4fe | gitcode |
arkui-x/samples | CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | subscribeCallback | 订阅eventId为1234565的事件 | subscribeCallback(): void {
emitter.on(this.callbackEvent, () => {
this.hideSubWindow();
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left subscribeCallback 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_... | subscribeCallback(): void {
emitter.on(this.callbackEvent, () => {
this.hideSubWindow();
})
} | https://gitcode.com/arkui-x/samples | c33d6b4b091e4e837c59ddab4655d8a76d62680e | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | from | Creates an Int8Array from array-like argument
@param o array-like object to initialize Int8Array
@param mapFn function to apply for each
@returns new Int8Array | public from(o: Object, mapFn: (e: Object) => byte): Int8Array {
let newF: (e: Object, index: int) => byte =
(e: Object, index: int): byte => { return mapFn(e) }
return this.from(o, newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public from(o: Object, mapFn: (e: Object) => byte): Int8Array {
let newF: (e: Object, index: int) => byte =
(e: Object, index: int): byte => { return mapFn(e) }
return this.from(o, newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 05c858d42cca81da2cab15f22862ba3a2e4407ed | gitee |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/navigation/UserGraph.ets | arkts | register | 注册用户模块导航路由 | register(): void {
RouteBuild.register(UserRoutes.Profile, wrapBuilder(ProfileNav));
RouteBuild.register(UserRoutes.AddressList, wrapBuilder(AddressListNav));
RouteBuild.register(UserRoutes.AddressDetail, wrapBuilder(AddressDetailNav));
RouteBuild.register(UserRoutes.Footprint, wrapBuilder(FootprintNa... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register 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#Lef... | register(): void {
RouteBuild.register(UserRoutes.Profile, wrapBuilder(ProfileNav));
RouteBuild.register(UserRoutes.AddressList, wrapBuilder(AddressListNav));
RouteBuild.register(UserRoutes.AddressDetail, wrapBuilder(AddressDetailNav));
RouteBuild.register(UserRoutes.Footprint, wrapBuilder(FootprintNa... | https://github.com/Joker-x-dev/CoolMallArkTS | 1201801420b56e03ac4f571cf545fd4d640fc156 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/SettingsService.ets | arkts | setWifiOnlyDownload | 设置仅WiFi下载 | async setWifiOnlyDownload(enabled: boolean): Promise<void> {
this.settings.wifiOnlyDownload = enabled;
await this.saveSettings();
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setWifiOnlyDownload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_... | async setWifiOnlyDownload(enabled: boolean): Promise<void> {
this.settings.wifiOnlyDownload = enabled;
await this.saveSettings();
} | https://github.com/pangpang20/antennaPodHM | 8f384b6ba1a0547c02bbe9831a1023bbc44d6d2a | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/popup/index.ets | arkts | handleVisible | 处理弹出层的显示与隐藏 | handleVisible() {
if (this.visible) {
this.dialogController?.open()
this.onOpen()
} else {
this.handleClose()
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleVisible 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... | handleVisible() {
if (this.visible) {
this.dialogController?.open()
this.onOpen()
} else {
this.handleClose()
}
} | https://github.com/itrainhub/wu-ui | 024a34b13b71ce86f2d89a7ee7965b56e43a7d3c | github |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | request | 发送 HTTP 请求 | async request(config: HttpRequestConfig): Promise<HttpResponse> {
return await this.requestWithController(config)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async request(config: HttpRequestConfig): Promise<HttpResponse> {
return await this.requestWithController(config)
} | https://github.com/LongLiveY96/chatcube | 2d7c7e00d9ba396aa5477416658a7d5651cabcfe | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/EBookDataManager.ets | arkts | getNonPrivateEBooks | [新增] 获取非隐私电子书列表
@returns Promise<EBook[]> 非隐私电子书列表 | public async getNonPrivateEBooks(): Promise<EBook[]> {
try {
const sql = `SELECT * FROM ebook_info WHERE (isPrivate = 0 OR isPrivate IS NULL) ORDER BY lastUpdateTime DESC`;
const records = await this.dbManager.querySql(sql, []);
const ebooks: EBook[] = [];
for (const record of recor... | 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 getNonPrivateEBooks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public async getNonPrivateEBooks(): Promise<EBook[]> {
try {
const sql = `SELECT * FROM ebook_info WHERE (isPrivate = 0 OR isPrivate IS NULL) ORDER BY lastUpdateTime DESC`;
const records = await this.dbManager.querySql(sql, []);
const ebooks: EBook[] = [];
for (const record of recor... | https://github.com/DaLongZhuaZi/manxia | 9c98705e811d5a584af1743a41d527df80bb552b | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Game24Logic.ets | arkts | findSolutionsRecursive | 递归查找所有解法
@param numbers 当前数字数组
@param solutions 存储解法的数组
@param expressions 当前表达式栈 | private static findSolutionsRecursive(numbers: number[], solutions: string[], expressions: string[]): void {
// 基本情况:只有一个数字时,检查是否等于24
if (numbers.length === 1) {
if (Math.abs(numbers[0] - 24) < 1e-6) {
solutions.push(expressions[0]);
}
return;
}
// 递归情况:选择两个数字进行运算
fo... | 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 findSolutionsRecursive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right ... | private static findSolutionsRecursive(numbers: number[], solutions: string[], expressions: string[]): void {
// 基本情况:只有一个数字时,检查是否等于24
if (numbers.length === 1) {
if (Math.abs(numbers[0] - 24) < 1e-6) {
solutions.push(expressions[0]);
}
return;
}
// 递归情况:选择两个数字进行运算
fo... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 2a16886cd488cafbc777241e81d4d7a1236f795f | github |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/utiles/EmitterUtil.ets | arkts | on | 订阅事件,支持取消指定事件回调
@param eventId 事件ID,string类型的eventId不支持空字符串。
@param callback 接收到该事件时需要执行的回调处理函数。 | static on<T>(eventId: string | number, callback: Callback<emitter.GenericEventData<T>>) {
emitter.on(eventId.toString(), callback);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left on AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right ... | static on<T>(eventId: string | number, callback: Callback<emitter.GenericEventData<T>>) {
emitter.on(eventId.toString(), callback);
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | c712cc558de1eafc3541306de308afb70a6b848d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | updateSourceBaseUrl | 更新图源的baseUrl(用于换源功能) | async updateSourceBaseUrl(sourceId: number, newBaseUrl: string): Promise<void> {
try {
const normalizedBaseUrl: string = newBaseUrl.trim();
if (normalizedBaseUrl.length <= 0) {
throw new Error('图源baseUrl不能为空');
}
const sourceRecord: ComicSourceDatabaseRecord | null = await this.ge... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateSourceBaseUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#... | async updateSourceBaseUrl(sourceId: number, newBaseUrl: string): Promise<void> {
try {
const normalizedBaseUrl: string = newBaseUrl.trim();
if (normalizedBaseUrl.length <= 0) {
throw new Error('图源baseUrl不能为空');
}
const sourceRecord: ComicSourceDatabaseRecord | null = await this.ge... | https://github.com/DaLongZhuaZi/manxia | 923c39eef85cefd6dff395a2fae907cf257bc651 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | testSortComparator | --- Array.sort with comparator --- | function testSortComparator(): string {
let strs: string[] = ['banana', 'apple', 'cherry'];
let sorted: string[] = strs.sort();
return sorted[0] + ',' + sorted[1] + ',' + sorted[2];
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSortComparator 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#predefin... | function testSortComparator(): string {
let strs: string[] = ['banana', 'apple', 'cherry'];
let sorted: string[] = strs.sort();
return sorted[0] + ',' + sorted[1] + ',' + sorted[2];
} | https://github.com/miaochiahao/ark-ghidra | 0bea1058e59d5aa8e90fd2e81aef0d626b05b76d | github |
arkui-x/samples | CodeLab/Cases/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets | arkts | getTitleScaleOptions | 获取主标题缩放的Scale参数
@returns {ScaleOptions} 主标题缩放系数 | getTitleScaleOptions(): ScaleOptions {
let scaleRatio = 1 + (this.animationAttribute.titleScale - 1) *
Math.min((this.heightValue - this.animationAttribute.normalTitleHeight + Math.max(-this.curOffset, 0)) / this.animationAttribute.continuePullThreshold, 1);
return {
x: scaleRatio,
y: scaleR... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTitleScaleOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ScaleOptions AST#identifier#Right AST#ERR... | getTitleScaleOptions(): ScaleOptions {
let scaleRatio = 1 + (this.animationAttribute.titleScale - 1) *
Math.min((this.heightValue - this.animationAttribute.normalTitleHeight + Math.max(-this.curOffset, 0)) / this.animationAttribute.continuePullThreshold, 1);
return {
x: scaleRatio,
y: scaleR... | https://gitcode.com/arkui-x/samples | d3734d6feafee2cf15670c3d1ad41dbb2e706546 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | mul | Performs floating point multiplication of this instance with provided one, returns the result as new instance
@param { Double } other Right hand side of the multiplication
@returns { Double } Result of the multiplication
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public mul(other: Double): Double {
return new Double((this.value * other.toDouble()) as double)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public mul(other: Double): Double {
return new Double((this.value * other.toDouble()) as double)
} | https://gitcode.com/iop123123/arkts-static-skills | 7db29aa902bb90babb545eb854de38a84de9dd54 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/SafeUtils.ets | arkts | parseStr | 安全解析JSON字符串为字符串。解析失败返回空字符串 ""。 | static parseStr(jsonStr: string | undefined | null): string {
if (!jsonStr || jsonStr.trim() === '') {
return '';
}
try {
return JSON.parse(jsonStr) as string;
} catch (error) {
logger.error(TAG, `JSON parse error (Str): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsonStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Le... | static parseStr(jsonStr: string | undefined | null): string {
if (!jsonStr || jsonStr.trim() === '') {
return '';
}
try {
return JSON.parse(jsonStr) as string;
} catch (error) {
logger.error(TAG, `JSON parse error (Str): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`);
... | https://github.com/DaLongZhuaZi/manxia | b256f839dbd71eb3a43df6a94ec34516acf7694b | github |
openharmony/update_update_app | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | upgrade | 升级
@param order 安装指令 | async upgrade(order: update.Order = update.Order.INSTALL_AND_APPLY): Promise<void> {
let versionDigest: string = await VersionUtils.getNewVersionDigest();
return new Promise((resolve, reject) => {
this.updateManager.upgrade(versionDigest, order).then(()=> {
resolve();
}).catch(err => {
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left upgrade AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left order AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async upgrade(order: update.Order = update.Order.INSTALL_AND_APPLY): Promise<void> {
let versionDigest: string = await VersionUtils.getNewVersionDigest();
return new Promise((resolve, reject) => {
this.updateManager.upgrade(versionDigest, order).then(()=> {
resolve();
}).catch(err => {
... | https://gitee.com/openharmony/update_update_app.git | 61cedc263bb3178058b230f4d33ae675acd44df2 | gitee |
erosTeam/NextE | shared/src/main/ets/services/CoverColorService.ets | arkts | extractCoverColor | Decode the thumbnail to a tiny bitmap purely for color sampling — far cheaper than decoding the full
cover, and plenty for a dominant-color read (effectKit scales to ~1px internally anyway).
Off-UI-thread cover dominant-color extraction. Fetches the public-CDN thumbnail bytes, decodes a small
downsampled bitmap, and re... | @Concurrent
async function extractCoverColor(url: string): Promise<number> {
const decodeSize: number = 32
const timeoutMs: number = 15000
const session: http.HttpRequest = http.createHttp()
let source: image.ImageSource | undefined = undefined
let pixelMap: image.PixelMap | undefined = undefined
try {
... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left extractCoverColor AST#identifier#Right AST#formal_para... | @Concurrent
async function extractCoverColor(url: string): Promise<number> {
const decodeSize: number = 32
const timeoutMs: number = 15000
const session: http.HttpRequest = http.createHttp()
let source: image.ImageSource | undefined = undefined
let pixelMap: image.PixelMap | undefined = undefined
try {
... | https://github.com/erosTeam/NextE | 00d69d50762db3764a3b15cd4131ad242a0297ea | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ImagePreprocessor.ets | arkts | getMetadata | 获取图像元数据
@param imageUri 图像URI
@returns 图像元数据 | async getMetadata(imageUri: string): Promise<ImageMetadata> {
return {
width: 1200,
height: 1600,
format: 'PNG',
fileSize: 0,
dpi: 300,
colorSpace: 'sRGB'
};
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMetadata AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageUri AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async getMetadata(imageUri: string): Promise<ImageMetadata> {
return {
width: 1200,
height: 1600,
format: 'PNG',
fileSize: 0,
dpi: 300,
colorSpace: 'sRGB'
};
} | https://github.com/LJ666-ui/harmony-health-care | cf78c637cf0dafc56212c4deadb8bff031798a8f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets | arkts | getGlobalStats | 获取全局统计信息 | getGlobalStats(): GlobalStats {
return {
totalPages: this.stats.totalPages,
totalTimers: this.stats.totalTimers,
totalPromises: this.stats.totalPromises,
totalResources: this.stats.totalResources,
totalListeners: this.stats.totalListeners,
memoryUsage: this.stats.memoryUsage
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGlobalStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left GlobalStats AST#identifier#Right AST#ERROR#Righ... | getGlobalStats(): GlobalStats {
return {
totalPages: this.stats.totalPages,
totalTimers: this.stats.totalTimers,
totalPromises: this.stats.totalPromises,
totalResources: this.stats.totalResources,
totalListeners: this.stats.totalListeners,
memoryUsage: this.stats.memoryUsage
... | https://github.com/DaLongZhuaZi/manxia | 3131293a8132e70d9d80dc4ddb0f32cbb72eb173 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | handleRotationChange | 处理屏幕方向变化
当设备屏幕旋转时调用此方法,通知服务器同步修改分辨率
@param isLandscape 是否为横屏 | handleRotationChange(isLandscape: boolean): void {
// 检查是否启用了屏幕旋转同步
if (!this.displaySettings?.rotableScreen) {
console.info('StreamViewModel: 屏幕旋转同步未启用');
return;
}
// 检查是否是服务器触发的旋转,避免循环通知
if (this.isServerInitiatedRotation) {
console.info('StreamViewModel: 跳过服务器触发的旋转');
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRotationChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isLandscape AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)... | handleRotationChange(isLandscape: boolean): void {
// 检查是否启用了屏幕旋转同步
if (!this.displaySettings?.rotableScreen) {
console.info('StreamViewModel: 屏幕旋转同步未启用');
return;
}
// 检查是否是服务器触发的旋转,避免循环通知
if (this.isServerInitiatedRotation) {
console.info('StreamViewModel: 跳过服务器触发的旋转');
... | https://github.com/AlkaidLab/moonlight-harmony | 2646696e66c8730b1153c01225a89a1e7aaf7a6e | github |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/auth/AuthNavigator.ets | arkts | toAccountLogin | 跳转到账号密码登录
@returns {void} 无返回值 | static toAccountLogin(): void {
navigateTo(AuthRoutes.AccountLogin);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toAccountLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express... | static toAccountLogin(): void {
navigateTo(AuthRoutes.AccountLogin);
} | https://github.com/Joker-x-dev/CoolMallArkTS | d233cc6aefebaca26eea6534e860ccd12f2d7ab8 | github |
webabcd/HarmonyUtils | harmony_utils/src/main/ets/UrlHelper.ets | arkts | encode | url 编码 | static encode(url: string): string {
let encodedURL = encodeURIComponent(url);
return encodedURL
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | static encode(url: string): string {
let encodedURL = encodeURIComponent(url);
return encodedURL
} | https://github.com/webabcd/HarmonyUtils | ac09c580dce3e142f50de0aad06dc4faee02b0ed | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamWindowManager.ets | arkts | isFullscreen | 查询当前是否全屏 | get isFullscreen(): boolean {
return this._isFullscreen;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isFullscreen 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#R... | get isFullscreen(): boolean {
return this._isFullscreen;
} | https://github.com/AlkaidLab/moonlight-harmony | e079a9f3511cbe8ee65fda682aee72dc16c090cf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets | arkts | race | Create a promise that will be completed after at least one promise is completed
@param promises array of promise-like objects
@returns { Promise } promise that will completed with the same value as one of the promises in the argument | static race<U>(promises: FixedArray<PromiseLike<U>|U|undefined>): Promise<Awaited<U>> {
return new Promise<Awaited<U>>((resolve: (value: Awaited<U>) => void, reject: (error: Error) => void): void => {
let settled = false;
for (let i = 0; i < promises.length; ++i) {
co... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left race AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Righ... | static race<U>(promises: FixedArray<PromiseLike<U>|U|undefined>): Promise<Awaited<U>> {
return new Promise<Awaited<U>>((resolve: (value: Awaited<U>) => void, reject: (error: Error) => void): void => {
let settled = false;
for (let i = 0; i < promises.length; ++i) {
co... | https://gitcode.com/iop123123/arkts-static-skills | 219d8292458aac0d2786254ebd7512fcfd8f1ec4 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | hasName | Checks whether type has name
@returns {boolean} true if type has name
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override hasName(): boolean {
return true
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left hasName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public override hasName(): boolean {
return true
} | https://gitcode.com/iop123123/arkts-static-skills | 5af7d8393f1672f9f0699e1ba1418f9fdb6a974c | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | getOscOpacity | 获取屏幕控制器透明度 | async getOscOpacity(): Promise<number> {
return await this.getNumber(SettingsKeys.OSC_OPACITY, 90);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOscOpacity AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi... | async getOscOpacity(): Promise<number> {
return await this.getNumber(SettingsKeys.OSC_OPACITY, 90);
} | https://github.com/AlkaidLab/moonlight-harmony | aca16ef2b4118d20a1bb791ebaabc2d37cf075a8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SessionManager.ets | arkts | cleanup | 清理过期状态 | cleanup(): void {
const now = Date.now();
const expiredSources: number[] = [];
this.sessionStates.forEach((state, sourceId) => {
// 清理超过24小时未刷新的非活跃会话
if (!state.isActive && (now - state.lastRefreshTime) > 24 * 60 * 60 * 1000) {
expiredSources.push(sourceId);
}
});
expir... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanup 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... | cleanup(): void {
const now = Date.now();
const expiredSources: number[] = [];
this.sessionStates.forEach((state, sourceId) => {
// 清理超过24小时未刷新的非活跃会话
if (!state.isActive && (now - state.lastRefreshTime) > 24 * 60 * 60 * 1000) {
expiredSources.push(sourceId);
}
});
expir... | https://github.com/DaLongZhuaZi/manxia | e54da0683aadc64db2a1a1d5818693b7af4761ff | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/LimitLine.ets | arkts | setTextStyle | Sets the color of the value-text that is drawn next to the LimitLine.
Default: Paint.Style.FILL_AND_STROKE
@param style | public setTextStyle(style: Style) {
this.mTextStyle = style;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left style AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left St... | public setTextStyle(style: Style) {
this.mTextStyle = style;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 621331f721d8527932edb550659f476794844302 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/WhereCondition.ets | arkts | lessThan | 创建小于条件
@param column 列名
@param value 值
@returns WhereCondition 实例 | static lessThan(column: string, value: ValueType): WhereCondition {
const condition = new WhereCondition()
condition.column = column
condition.operator = ConditionOperator.LESS
condition.value = value
return condition
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left lessThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | static lessThan(column: string, value: ValueType): WhereCondition {
const condition = new WhereCondition()
condition.column = column
condition.operator = ConditionOperator.LESS
condition.value = value
return condition
} | https://github.com/offlinecat-dev/OCNetORM | ab6a73795b10131d6f12546a42b7c7f2bd09c2bf | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | resetStats | 重置统计信息 | resetStats(): void {
this.stats = {
bandwidth: 0,
latency: 0,
packetLoss: 0,
frameRate: 0,
frameDrops: 0,
renderTime: 0,
compressionRatio: 0,
compressionTime: 0,
memoryUsage: 0,
cacheHitRate: 0
}
this.frameCount = 0
this.lastFrameTime = 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetStats 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#L... | resetStats(): void {
this.stats = {
bandwidth: 0,
latency: 0,
packetLoss: 0,
frameRate: 0,
frameDrops: 0,
renderTime: 0,
compressionRatio: 0,
compressionTime: 0,
memoryUsage: 0,
cacheHitRate: 0
}
this.frameCount = 0
this.lastFrameTime = 0
} | https://github.com/AetheriumSimulator/qemu-hmos | 897828473a91d55eb4b5c8f50eb0140e5d705d23 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | unregisterCallback | 取消任务回调 | public unregisterCallback(taskId: string): void {
this.callbacks.delete(taskId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public unregisterCallback(taskId: string): void {
this.callbacks.delete(taskId);
} | https://github.com/DaLongZhuaZi/manxia | c43654a533364711e3b4a855ed1b7f9e9857beee | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | outline | 快捷方法:获取边框色 | public static get outline(): string {
return AppColors.outline;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left outline AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#ca... | public static get outline(): string {
return AppColors.outline;
} | https://github.com/DaLongZhuaZi/manxia | 49c2a4bfb00b426d171f2300b8582e62e9a8cfff | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets | arkts | bounce | 回弹插值器
动画到达终点后会有回弹效果 | static bounce(): curves.ICurve {
return curves.springCurve(1, 0.55, 0.3, 1.7);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left bounce 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#member_expression#Left AST#iden... | static bounce(): curves.ICurve {
return curves.springCurve(1, 0.55, 0.3, 1.7);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 6231e54603735ad77af5907e3fbe1c7e0c783865 | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Auth/AuthPatternLockPage.ets | arkts | setErrorMessage | 设置错误信息 | setErrorMessage(message: string) {
// 设置错误提示语
this.errorMessage = message
// 标记为错误
this.patternLockController.setChallengeResult(PatternLockChallengeResult.WRONG)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setErrorMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS... | setErrorMessage(message: string) {
// 设置错误提示语
this.errorMessage = message
// 标记为错误
this.patternLockController.setChallengeResult(PatternLockChallengeResult.WRONG)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 705ef53ec17f2a1a3d6d988e78c6d2df48b86690 | gitcode |
SMAT-Lab/PhantomRendering | example/entry/src/main/ets/common/DeviceUtils.ets | arkts | getAdaptiveFontSize | 获取适配后的字体大小 | static getAdaptiveFontSize(baseFontSize: number): number {
// 限制缩放比例,避免字体过大
const widthScale = DeviceUtils.getScreenWidth() / 360
const heightScale = DeviceUtils.getScreenHeight() / 780
const scale = Math.min(1.2, Math.max(0.8, Math.min(widthScale, heightScale))) // 限制缩放在0.8-1.2之间
const adaptedSiz... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAdaptiveFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseFontSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | static getAdaptiveFontSize(baseFontSize: number): number {
// 限制缩放比例,避免字体过大
const widthScale = DeviceUtils.getScreenWidth() / 360
const heightScale = DeviceUtils.getScreenHeight() / 780
const scale = Math.min(1.2, Math.max(0.8, Math.min(widthScale, heightScale))) // 限制缩放在0.8-1.2之间
const adaptedSiz... | https://github.com/SMAT-Lab/PhantomRendering | 6d1ca1e1b37ada0cb1adff248ea80923b5534abd | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/manager/AudioRouteManager.ets | arkts | isWiredHeadsetConnected | v1 stub. | static isWiredHeadsetConnected(): boolean {
return false;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isWiredHeadsetConnected 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 b... | static isWiredHeadsetConnected(): boolean {
return false;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 4096639baf823ebbef76ea4e8a800ecea27052cf | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/StringBuilder.ets | arkts | constructor | Construct a new builder instance with the provided array of chars
@param fromChars array that will be used to initialize the builder | constructor(fromChars: char[]) {
let capacity = StringBuilder.newCapacity(16, fromChars.length);
this.count = fromChars.length;
this.value = new char[capacity];
for (let i = 0; i < this.count; ++i) {
this.value[i] = fromChars[i];
}
} | 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#identifier#Left fromChars AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier#Right AST#[#Left [ A... | constructor(fromChars: char[]) {
let capacity = StringBuilder.newCapacity(16, fromChars.length);
this.count = fromChars.length;
this.value = new char[capacity];
for (let i = 0; i < this.count; ++i) {
this.value[i] = fromChars[i];
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 62877c4a88bdef115d40853392dcf38b9152057e | gitee |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicDownloadService.ets | arkts | generateFileName | 生成文件名 | private generateFileName(musicInfo: MusicInfo, quality: string): string {
const name = musicInfo.name || 'unknown';
const singer = musicInfo.singer || 'unknown';
const timestamp = Date.now();
// 清理文件名
const cleanName = this.cleanFileName(`${name}_${singer}`);
// 文件扩展名
let extension = '.m... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left musicInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private generateFileName(musicInfo: MusicInfo, quality: string): string {
const name = musicInfo.name || 'unknown';
const singer = musicInfo.singer || 'unknown';
const timestamp = Date.now();
// 清理文件名
const cleanName = this.cleanFileName(`${name}_${singer}`);
// 文件扩展名
let extension = '.m... | https://github.com/cpdd5201314/harmonyOS-music-app | ce028fe7b3ea16415176609a977e2a9c219baa35 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets | arkts | splice | Changes the contents of an array by removing existing elements in place from the start index to the end.
@param { int } start The index at which to start changing the array.
@returns { SparseArray<T> } An array containing the deleted elements.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public splice(start: int): SparseArray<T> {
return this.splice(start, this.maxLength)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left splice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left start AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right... | public splice(start: int): SparseArray<T> {
return this.splice(start, this.maxLength)
} | https://gitcode.com/iop123123/arkts-static-skills | 840864bd2c81c01bfdba76d4a5e647a926785f31 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getNetworkState | 获取网络状态
@param slotId 卡槽ID,如果不指定slotId,默认主卡。
@returns | static async getNetworkState(slotId?: number): Promise<radio.NetworkState> {
slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号
return radio.getNetworkState(slotId);
} | 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 getNetworkState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ?... | static async getNetworkState(slotId?: number): Promise<radio.NetworkState> {
slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号
return radio.getNetworkState(slotId);
} | https://github.com/tdcare/tdwebrtc | 61a6ae2a66b2eccacad33b0f2bd5be31db53f71a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getAddedExternalIdsBySource | 获取指定图源下所有已加入书库的漫画的 externalId 列表 | async getAddedExternalIdsBySource(sourceId: string | number, sourcePkg?: string, sourceName?: string): Promise<string[]> {
try {
const sourceIdText: string = String(sourceId);
const normalizedSourcePkg: string = sourcePkg ? sourcePkg.trim() : '';
const normalizedSourceName: string = sourceName ?... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAddedExternalIdsBySource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#L... | async getAddedExternalIdsBySource(sourceId: string | number, sourcePkg?: string, sourceName?: string): Promise<string[]> {
try {
const sourceIdText: string = String(sourceId);
const normalizedSourcePkg: string = sourcePkg ? sourcePkg.trim() : '';
const normalizedSourceName: string = sourceName ?... | https://github.com/DaLongZhuaZi/manxia | 9d6dbc04e6f6bc08258612419a6a585e54fe9f1a | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/network/WebSocketDemo.ets | arkts | sendToClient | 向所有客户端发送数据 | sendToClient() {
this.clientList.forEach(client => {
client.send({
data: constructWebSocketFrame(`timestamp: ${new Date().getTime()}`),
encoding: 'utf-8'
}).then(() => {
this.message += `向客户端发送数据,成功\n`
}).catch((err: BusinessError) => {
this.message += `向客户端发送数据,失... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendToClient 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 ... | sendToClient() {
this.clientList.forEach(client => {
client.send({
data: constructWebSocketFrame(`timestamp: ${new Date().getTime()}`),
encoding: 'utf-8'
}).then(() => {
this.message += `向客户端发送数据,成功\n`
}).catch((err: BusinessError) => {
this.message += `向客户端发送数据,失... | https://github.com/webabcd/HarmonyDemo | 905887e3c097193fc6cc3ea5ff790ec07499f2f1 | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/pages/Index.ets | arkts | filterHabits | 🔍 筛选逻辑 | filterHabits() {
if (this.currentCategoryId === 1) {
this.habits = this.allHabitsCache;
} else {
this.habits = this.allHabitsCache.filter(h => h.categoryId === this.currentCategoryId);
}
this.calculateProgress();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left filterHabits 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 ... | filterHabits() {
if (this.currentCategoryId === 1) {
this.habits = this.allHabitsCache;
} else {
this.habits = this.allHabitsCache.filter(h => h.categoryId === this.currentCategoryId);
}
this.calculateProgress();
} | https://gitcode.com/openharmony/codelabs | f0cc78ab7a5eeab56e8aa75b37647d249fd5dbaf | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/SuwayomiTracker.ets | arkts | refreshAccessToken | 刷新访问令牌(Suwayomi不使用OAuth) | public async refreshAccessToken(): Promise<boolean> {
return true;
} | 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 refreshAccessToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public async refreshAccessToken(): Promise<boolean> {
return true;
} | https://github.com/DaLongZhuaZi/manxia | cae7f7293dd91ca65095243c803a19224243473b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzeLibraryCovers | 分析章节文件 | private async analyzeLibraryCovers(): Promise<StorageItem> {
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
return this.createEmptyItem(StorageType.LIBRARY_COVERS, 'Library Covers');
}
const libraryCoverPath = `${context.filesDir}/library_covers`;
... | 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 analyzeLibraryCovers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | private async analyzeLibraryCovers(): Promise<StorageItem> {
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
return this.createEmptyItem(StorageType.LIBRARY_COVERS, 'Library Covers');
}
const libraryCoverPath = `${context.filesDir}/library_covers`;
... | https://github.com/DaLongZhuaZi/manxia | 9aa11d8ceedd28e561c626e80df1aa698832bc6f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | setLastHighlighted | Sets the last value that was highlighted via touch.
@param high | public setLastHighlighted(high?: Highlight) {
this.mLastHighlighted = high ? high : null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLastHighlighted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left high AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERRO... | public setLastHighlighted(high?: Highlight) {
this.mLastHighlighted = high ? high : null;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 03fdfc4a93fe3efbf21bcd1047097396e935f865 | gitee |
azhu0001/localsend-harmony | entry/src/main/ets/eventbus/EventBus.ets | arkts | post | 发送指定的事件 | post(name: number, data?: emitter.EventData) {
let event: emitter.InnerEvent = {
eventId: name, //事件ID
priority: emitter.EventPriority.IMMEDIATE //事件立即被投递
}
let eventData: emitter.EventData = {
data: data?.data
}
emitter.emit(event, eventData)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left post AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Le... | post(name: number, data?: emitter.EventData) {
let event: emitter.InnerEvent = {
eventId: name, //事件ID
priority: emitter.EventPriority.IMMEDIATE //事件立即被投递
}
let eventData: emitter.EventData = {
data: data?.data
}
emitter.emit(event, eventData)
} | https://gitcode.com/azhu0001/localsend-harmony | 511ca570f1082b90a25785e63cacbc9084b8bb1f | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/DataManagementPage.ets | arkts | buildChapterMergeDialogContent | 构建章节合并弹窗的自定义内容 | @Builder
function buildChapterMergeDialogContent(param: UniversalDialogCustomContentParam): void {
Column({ space: 12 }) {
Text('检测到重复章节')
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontFamily(asChapterMergeDialogBuilderParam(param).appFontFamily)
.fontColor(ThemeAwareHelper.getTestManage... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left buildChapterMergeDialogContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AS... | @Builder
function buildChapterMergeDialogContent(param: UniversalDialogCustomContentParam): void {
Column({ space: 12 }) {
Text('检测到重复章节')
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontFamily(asChapterMergeDialogBuilderParam(param).appFontFamily)
.fontColor(ThemeAwareHelper.getTestManage... | https://github.com/DaLongZhuaZi/manxia | c48df12aeb104b685c67d92a0d4c9fe0191a6f3d | github |
aimilin6688/KeePassHO | kdbxweb/src/ohosTest/ets/test/test-support/Asserts.ets | arkts | assertContain | 验证字符串是否包含指定字符串
@param actual
@param expected
@param message | public assertContain(expected: string, message?: string): void {
const actual = this.actual as string;
if (actual.indexOf(expected) === -1) {
throw new Error(message || `Expected ${actual} to contain ${expected}`);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left assertContain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left expected AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | public assertContain(expected: string, message?: string): void {
const actual = this.actual as string;
if (actual.indexOf(expected) === -1) {
throw new Error(message || `Expected ${actual} to contain ${expected}`);
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/kdbxweb/src/ohosTest/ets/test/test-support/Asserts.ets#L71-L76 | ab1be99413c40f7730e5de3c7e27e3ba39839534 | github |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue269.ets.audit.ets | arkts | tabStyle | HPAudit: Use lowerCamelCase for variable and function names : hp-specs-lcamelcase-vars-funcs-params : 1 : 9 : issue269.ets | @Extend(Image) function tabStyle(height: number, width: number) {
.draggable(false)
.height(height)
.width(width)
.saturate(2.0)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Image AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#... | @Extend(Image) function tabStyle(height: number, width: number) {
.draggable(false)
.height(height)
.width(width)
.saturate(2.0)
} | https://gitee.com/openharmony-sig/earth.git | 13bb131ef2eb7eb8952bd64091eaddb85486fbb4 | gitee |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/Index.ets | arkts | goToPrevious | 切换到上一个周期 | goToPrevious(): void {
switch (this.currentViewType) {
case CalendarViewType.DAY:
this.selectedDate = new Date(this.selectedDate.getTime() - 24 * 60 * 60 * 1000)
this.currentYear = this.selectedDate.getFullYear()
this.currentMonth = this.selectedDate.getMonth()
break
ca... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left goToPrevious AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le... | goToPrevious(): void {
switch (this.currentViewType) {
case CalendarViewType.DAY:
this.selectedDate = new Date(this.selectedDate.getTime() - 24 * 60 * 60 * 1000)
this.currentYear = this.selectedDate.getFullYear()
this.currentMonth = this.selectedDate.getMonth()
break
ca... | https://gitcode.com/openharmony/codelabs | f58091df03f4fd4f7dc0bdd94a5af4d153b62ec0 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setOnDrawListener | Sets the OnDrawListener
@param drawListener | public setOnDrawListener(drawListener: OnDrawListener): void {
this.mDrawListener = drawListener;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnDrawListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left drawListener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public setOnDrawListener(drawListener: OnDrawListener): void {
this.mDrawListener = drawListener;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | a962c521dc54a1a6a36c40fe93599bac1b76e9dd | gitee |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | onNetworkChanged | Re-read the underlying DNS and, if the captured resolver set changed, rebuild
the tun. Serialized via reconfiguring/netRecheckPending so overlapping bursts
don't run concurrent rebuilds but the final state is still applied. | private async onNetworkChanged(reason: string): Promise<void> {
if (this.reconfiguring) {
this.netRecheckPending = true;
return;
}
this.reconfiguring = true;
try {
for (;;) {
this.netRecheckPending = false;
if (this.tunFd < 0) {
break; // VPN not active; no... | 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 onNetworkChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Le... | private async onNetworkChanged(reason: string): Promise<void> {
if (this.reconfiguring) {
this.netRecheckPending = true;
return;
}
this.reconfiguring = true;
try {
for (;;) {
this.netRecheckPending = false;
if (this.tunFd < 0) {
break; // VPN not active; no... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L904-L937 | 6be6f27b7f2af4488e99d9b23ccd5f216401bb79 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/LoginStateManager.ets | arkts | init | 初始化登录状态管理器 | async init(context: Context): Promise<void> {
this.context = context;
await this.initDatabase();
await this.loadLoginState();
} | 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 init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context... | async init(context: Context): Promise<void> {
this.context = context;
await this.initDatabase();
await this.loadLoginState();
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | a56ecd6b61e479ea30b4409d490ae6372ac38de5 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getMemberPageSnapshot | Get topics, replies, and available actions from member page. Topic list respects user's web hide settings. | async getMemberPageSnapshot(
username: string,
cookie: string = '',
): Promise<V2exMemberPageSnapshot> {
const clean = (username || '').trim()
if (!clean) {
throw ApiErrors.invalidUsername()
}
const path = `/member/${encodeURIComponent(clean)}`
const html = cookie ? await this.getC... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMemberPageSnapshot AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AS... | async getMemberPageSnapshot(
username: string,
cookie: string = '',
): Promise<V2exMemberPageSnapshot> {
const clean = (username || '').trim()
if (!clean) {
throw ApiErrors.invalidUsername()
}
const path = `/member/${encodeURIComponent(clean)}`
const html = cookie ? await this.getC... | https://github.com/honjow/Next2V | e17a427bee32934c376be13568e059a97260c8c6 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/SearchHistoryManager.ets | arkts | getSearchHistorySync | 同步获取搜索历史(用于UI状态管理) | static getSearchHistorySync(): SearchRecord[] {
try {
if (!SearchHistoryManager.checkInitialized()) {
return []
}
const store = SearchHistoryManager.preferencesStore!
const historyStr = store.getSync(SearchHistoryManager.HISTORY_KEY, '[]') as string
if (historyStr && histor... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSearchHistorySync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left S... | static getSearchHistorySync(): SearchRecord[] {
try {
if (!SearchHistoryManager.checkInitialized()) {
return []
}
const store = SearchHistoryManager.preferencesStore!
const historyStr = store.getSync(SearchHistoryManager.HISTORY_KEY, '[]') as string
if (historyStr && histor... | https://github.com/cpdd5201314/harmonyOS-music-app | 47c3fc23f0917d148d84be6b72579a492e24a7b7 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/common/database/tables/ChatTable.ets | arkts | query | 删除数据
查询全部user | query(callback: Function) {
//初始化对象
let predicates = new relationalStore.RdbPredicates(CommonConstants.CHAT_TABLE.tableName)
//执行查询方法
this.chatTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
//创建变量,存储结果行数
let count: number = resultSet.rowCount
//如果结果为0,执行回调,传入null... | 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 callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right A... | query(callback: Function) {
//初始化对象
let predicates = new relationalStore.RdbPredicates(CommonConstants.CHAT_TABLE.tableName)
//执行查询方法
this.chatTable.query(predicates, (resultSet: relationalStore.ResultSet) => {
//创建变量,存储结果行数
let count: number = resultSet.rowCount
//如果结果为0,执行回调,传入null... | https://gitee.com/openharmony/vendor_unionman.git | 2e38d02f690d9d71d7448c0bc94740a11a3defa4 | gitee |
751496032/DSBridge-HarmonyOS | library/src/main/ets/core/WebViewControllerProxy.ets | arkts | javaScriptProxy | 获取JavaScript代理对象
@returns | get javaScriptProxy(): JavaScriptProxy {
return {
object: this.bridge.javaScriptProxy().object,
name: this.bridge.javaScriptProxy().name,
methodList: this.bridge.javaScriptProxy().methodList,
controller: this.controller
}
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left javaScriptProxy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left JavaScriptProxy... | get javaScriptProxy(): JavaScriptProxy {
return {
object: this.bridge.javaScriptProxy().object,
name: this.bridge.javaScriptProxy().name,
methodList: this.bridge.javaScriptProxy().methodList,
controller: this.controller
}
} | https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L193-L200 | d880b81c745fbb51e11862fab7a27d484be22f2c | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/SupportService.ets | arkts | showSupportDialog | 显示支持弹框 | public static showSupportDialog(context: UIContext): Promise<void> {
return new Promise((resolve, reject) => {
if (!SupportService.isShowSupport()) {
return resolve();
}
CommonUtils.showDialog(SupportService.getShowSupportDialog()).then(async result => {
SettingsService.put(Setti... | 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 showSupportDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le... | public static showSupportDialog(context: UIContext): Promise<void> {
return new Promise((resolve, reject) => {
if (!SupportService.isShowSupport()) {
return resolve();
}
CommonUtils.showDialog(SupportService.getShowSupportDialog()).then(async result => {
SettingsService.put(Setti... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SupportService.ets#L19-L31 | 4b87ec3c7a738f0602a847ff9643e6e1a22802a7 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test41_original_index.ets | arkts | testEntriesIteration | --- Array.entries iteration --- | function testEntriesIteration(): string {
let fruits: string[] = ['apple', 'banana', 'cherry'];
let result: string = '';
for (let i: number = 0; i < fruits.length; i++) {
let entry: string = String(i) + '=' + fruits[i];
if (result.length > 0) {
result = result + ';';
}
result = result + entr... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testEntriesIteration AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predef... | function testEntriesIteration(): string {
let fruits: string[] = ['apple', 'banana', 'cherry'];
let result: string = '';
for (let i: number = 0; i < fruits.length; i++) {
let entry: string = String(i) + '=' + fruits[i];
if (result.length > 0) {
result = result + ';';
}
result = result + entr... | https://github.com/miaochiahao/ark-ghidra | d85c58a98d93653135b25dcd154335f48617445a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | getRelativeTime | 获取相对时间描述
@param timestamp - 时间戳(毫秒)
@returns 相对时间字符串(如:刚刚、5分钟前、2小时前等) | static getRelativeTime(timestamp: number): string {
const now = Date.now();
const diff = now - timestamp;
if (diff < 0) {
return '未来时间';
}
const seconds = Math.floor(diff / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days =... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRelativeTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | static getRelativeTime(timestamp: number): string {
const now = Date.now();
const diff = now - timestamp;
if (diff < 0) {
return '未来时间';
}
const seconds = Math.floor(diff / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days =... | https://github.com/DaLongZhuaZi/manxia | c1c72c1bdc02386c20804c514cbe0e479d2eca48 | github |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/model/AirConditioner.ets | arkts | getTemperature | getTemperature方法:获取当前温度(外部只读,不能直接修改) | getTemperature(): number {
return this.temperature;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTemperature AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getTemperature(): number {
return this.temperature;
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | db876dfce497202cecf9631a0006f981b2c5512f | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudSyncService.ets | arkts | syncKeys | ==================== 密钥同步 ==================== | async syncKeys(keys: SshKey[]): Promise<void> {
if (!this.isReady()) { return; }
const body = { unionID: this.unionID, keys: keys.map((k: SshKey) => k.toJSON()) };
const result = await this.post('/keys', body);
if (result) {
hilog.info(DOMAIN, TAG, "同步 " + keys.length.toString() + " 个密钥到云端");
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left syncKeys AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keys AST#identifier#Right AST#type_a... | async syncKeys(keys: SshKey[]): Promise<void> {
if (!this.isReady()) { return; }
const body = { unionID: this.unionID, keys: keys.map((k: SshKey) => k.toJSON()) };
const result = await this.post('/keys', body);
if (result) {
hilog.info(DOMAIN, TAG, "同步 " + keys.length.toString() + " 个密钥到云端");
... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 6e340e97ea494825390ceb3aa5e2e3947ae858cd | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/SweetEditor.ets | arkts | insertTextAt | Inserts text at the specified document position. | insertTextAt(position: TextPosition, text: string): void {
this.replaceText({ start: position, end: position }, text);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertTextAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left position AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TextPosition AST#identifier#Right AST#,... | insertTextAt(position: TextPosition, text: string): void {
this.replaceText({ start: position, end: position }, text);
} | https://github.com/FinalScave/SweetEditor | c2ff8cf260a821e8b9bb7ef66219179024f7928f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TrackpadGestureHandler.ets | arkts | sendClick | ---- 输入发送 ---- | private sendClick(button: number): void {
this.sink.sendMouseButton(BUTTON_ACTION_PRESS, button);
setTimeout(() => this.sink.sendMouseButton(BUTTON_ACTION_RELEASE, button), this.clickReleaseDelay);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left button AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | private sendClick(button: number): void {
this.sink.sendMouseButton(BUTTON_ACTION_PRESS, button);
setTimeout(() => this.sink.sendMouseButton(BUTTON_ACTION_RELEASE, button), this.clickReleaseDelay);
} | https://github.com/AlkaidLab/moonlight-harmony | a1cca207c35a430db6a46d5983cdae65bb7eb2a7 | github |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/IWebDownloadFile.ets | arkts | extractFileName | 提取文件名 | private extractFileName(path: string): string {
const match = path.match(/[^\\/]+$/)
return match ? match[0] : `file_${Date.now()}`
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private extractFileName(path: string): string {
const match = path.match(/[^\\/]+$/)
return match ? match[0] : `file_${Date.now()}`
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | a0309b898ae6b73db67c86de1498fff833877383 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets | arkts | capacity | Returns the capacity of a ConcurrentQueue.
@returns { int } the capacity of the ConcurrentQueue.
@syscap SystemCapability.Utils.Lang | public override get capacity(): int {
return this.capacitySize;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left capacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST... | public override get capacity(): int {
return this.capacitySize;
} | https://gitcode.com/iop123123/arkts-static-skills | 5aa25ca08fc1777ee1f71972fef39bf475f82247 | gitcode |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/MyWrapper.ets | arkts | build | 静态工厂方法,生成一个MyWrapper对象 | static build(parent: Wrapper): MyWrapper {
let x = parent as MyWrapper
const myWrapper = new MyWrapper();
myWrapper.selectSql = x.selectSql
myWrapper.groupSql = x.groupSql
myWrapper.havingSql = x.havingSql
myWrapper.orderList = x.orderList
myWrapper.whereList = x.whereList
myWrapper.va... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left build AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left parent AST#identifier#Right AST#:#Left : AST#:#Right AST#E... | static build(parent: Wrapper): MyWrapper {
let x = parent as MyWrapper
const myWrapper = new MyWrapper();
myWrapper.selectSql = x.selectSql
myWrapper.groupSql = x.groupSql
myWrapper.havingSql = x.havingSql
myWrapper.orderList = x.orderList
myWrapper.whereList = x.whereList
myWrapper.va... | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/MyWrapper.ets#L9-L21 | 423c8fee767d8d8e3bf4f13900bcaa0094872eb9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets | arkts | shouldBackupNow | 检查是否需要立即备份 | private shouldBackupNow(settings: WebDAVSettings): boolean {
const lastBackupTime = settings.lastSyncTime || 0;
const now = Date.now();
const intervalType = settings.autoBackupInterval as 'daily' | 'weekly';
const interval = getBackupIntervalMs(intervalType);
const timeSinceLastBackup = ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldBackupNow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left settings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | private shouldBackupNow(settings: WebDAVSettings): boolean {
const lastBackupTime = settings.lastSyncTime || 0;
const now = Date.now();
const intervalType = settings.autoBackupInterval as 'daily' | 'weekly';
const interval = getBackupIntervalMs(intervalType);
const timeSinceLastBackup = ... | https://github.com/DaLongZhuaZi/manxia | 0e55d33e0f485ea5747d1d0fe1f7dbc9b6fad221 | github |
huaiminqin/TankWar-Master-with-Many-Tasks | game/src/main/ets/actors/actor/DecryptPoint.ets | arkts | generateRandomPosition | 随机生成位置 | generateRandomPosition(battleField: BattleField): void {
const xTiles = battleField.getXTiles();
const yTiles = battleField.getYTiles();
// 避开基地区域和边缘
let x = (1 + Math.floor(Math.random() * (xTiles - 2))) * Resources.TILE_WIDTH;
let y = (1 + Math.floor(Math.random() * (yTiles - 4))) * Resourc... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateRandomPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left battleField AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BattleField AST#identifier... | generateRandomPosition(battleField: BattleField): void {
const xTiles = battleField.getXTiles();
const yTiles = battleField.getYTiles();
// 避开基地区域和边缘
let x = (1 + Math.floor(Math.random() * (xTiles - 2))) * Resources.TILE_WIDTH;
let y = (1 + Math.floor(Math.random() * (yTiles - 4))) * Resourc... | https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks | 4632f76f8c2bb35d375b69b376f3d90dc0051a5c | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/database/DatabaseManager.ets | arkts | setCallbacks | 设置数据库回调函数
@param callbacks 回调函数配置 | setCallbacks(callbacks: DatabaseCallbacks): void {
this.callbacks = callbacks;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbacks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DatabaseCallbacks AST#identifier#Right... | setCallbacks(callbacks: DatabaseCallbacks): void {
this.callbacks = callbacks;
} | https://github.com/ZestBox-18/kitebook-frontend | 883e2f0815cc7527992d9b83764ce6d8d8b6397a | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setUTCFullYear | Sets the full year for a specified date according to universal time.
@param value new year | public setUTCFullYear(value: number): void {
this.setUTCFullYear(value as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCFullYear 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 ... | public setUTCFullYear(value: number): void {
this.setUTCFullYear(value as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e4f58db1b0e1a3e28d96aabf6ae8457d3dd92671 | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpSessionManager.ets | arkts | isScreenLockedAsync | Check if screen is currently locked (async version) | static async isScreenLockedAsync(): Promise<boolean> {
return new Promise<boolean>((resolve) => {
try {
screenLock.isScreenLocked((err: BusinessError, isLocked: boolean) => {
if (err) {
resolve(false);
} else {
sessionIsScreenLocked = isLocked;
... | 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 isScreenLockedAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | static async isScreenLockedAsync(): Promise<boolean> {
return new Promise<boolean>((resolve) => {
try {
screenLock.isScreenLocked((err: BusinessError, isLocked: boolean) => {
if (err) {
resolve(false);
} else {
sessionIsScreenLocked = isLocked;
... | https://github.com/tangwengang-del/freerdp-harmonyos | b7478743d73ca113018a13171984d57b629c0b38 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/allowError.ets | arkts | fn3 | Incorrect because WrapperWithOther.otherProp is not readonly and not in the allowlist | function fn3(arg: WrapperWithOther) {} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fn3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#typ... | function fn3(arg: WrapperWithOther) {} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 8c3f78b7d8f2541185c241b5a61b43e5fc8ff476 | github |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/network-request-template.ets | arkts | post | ==================== POST 请求 ==================== | async post<T>(path: string, body?: object): Promise<ApiResponse<T>> {
let url = this.buildUrl(path);
return this.request<T>(url, http.RequestMethod.POST, body);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left post AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > ... | async post<T>(path: string, body?: object): Promise<ApiResponse<T>> {
let url = this.buildUrl(path);
return this.request<T>(url, http.RequestMethod.POST, body);
} | https://github.com/Goway-Hui/harmonyos-next-dev | bce122bfcaac924ba7570d10dc6df07330f1d264 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.