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/Data/DataManager.ets | arkts | importSourceFromJSON | 从JSON导入图源 | async importSourceFromJSON(jsonContent: string): Promise<string> {
try {
const config: Record<string, Object> = SafeUtils.parseObj(jsonContent) as Record<string, Object>;
// 验证必需字段
const metadata: Record<string, Object> = config['metadata'] as Record<string, Object>;
if (!metadata |... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importSourceFromJSON AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left jsonContent AST#identifier#Right AST#type_annotation#Left ... | async importSourceFromJSON(jsonContent: string): Promise<string> {
try {
const config: Record<string, Object> = SafeUtils.parseObj(jsonContent) as Record<string, Object>;
// 验证必需字段
const metadata: Record<string, Object> = config['metadata'] as Record<string, Object>;
if (!metadata |... | https://github.com/DaLongZhuaZi/manxia | 17ffd88389238d59a0cf65ab8a12e2bf6775d468 | github |
LiMingKuan-UESTC/HarmonyOs-Clock-Demo | entry/src/main/ets/pages/ReminderSettings.ets | arkts | getHour | 两个小函数 | getHour(type: string): number {
if (type === 'morning') return this.morningHour
if (type === 'noon') return this.noonHour
if (type === 'evening') return this.eveningHour
return 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHour AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#R... | getHour(type: string): number {
if (type === 'morning') return this.morningHour
if (type === 'noon') return this.noonHour
if (type === 'evening') return this.eveningHour
return 0
} | https://github.com/LiMingKuan-UESTC/HarmonyOs-Clock-Demo | 1b635147952f8325fff5287e21df4ba35b6c92fa | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/WantProcessUtil.ets | arkts | linkToWeb | 跳转外部网页 | static linkToWeb(context: common.UIAbilityContext, link: string) {
let openLinkOptions: OpenLinkOptions = {
appLinkingOnly: false,
}
try {
context.openLink(link, openLinkOptions)
} catch (paramError) {
hilog.error(777, 'testFlag', 'paramError' + paramError)
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left linkToWeb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#L... | static linkToWeb(context: common.UIAbilityContext, link: string) {
let openLinkOptions: OpenLinkOptions = {
appLinkingOnly: false,
}
try {
context.openLink(link, openLinkOptions)
} catch (paramError) {
hilog.error(777, 'testFlag', 'paramError' + paramError)
}
} | https://github.com/Yebingiscn/SweetVideo | 75f658dc3315e54f92b33616c91f3446ff43a492 | github |
erosTeam/NextE | shared/src/main/ets/parser/EhMytagsParser.ets | arkts | selectedTagset | The tagset id marked `selected` in the change_tagset select; '' if none. | private static selectedTagset(html: string): string {
const sel: RegExpMatchArray | null = html.match(EhMytagsParser.RE_TAGSET_SELECT)
if (sel === null || sel[1] === undefined) {
return ''
}
const m: RegExpMatchArray | null = sel[1].match(/<option value="(\d+)"[^>]*selected/)
return m !== nu... | 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 selectedTagset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left ... | private static selectedTagset(html: string): string {
const sel: RegExpMatchArray | null = html.match(EhMytagsParser.RE_TAGSET_SELECT)
if (sel === null || sel[1] === undefined) {
return ''
}
const m: RegExpMatchArray | null = sel[1].match(/<option value="(\d+)"[^>]*selected/)
return m !== nu... | https://github.com/erosTeam/NextE | 7679b045a0ffe5d2215e9054b4b0990b435370f9 | github |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | getMinWidth | 获取兼容性的半径
@returns { number } | getMinWidth(): number {
return utilGetMinWidth(this.width, this.height, this.menuLength);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMinWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | getMinWidth(): number {
return utilGetMinWidth(this.width, this.height, this.menuLength);
} | https://gitcode.com/arkui-x/samples | fff19dbcfb69a0daa4b0eadd778afcc9364f2dd9 | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/QemuVMManager.ets | arkts | setConsoleCallback | 设置控制台回调 | async setConsoleCallback(callback: (data: string) => void): Promise<void> {
try {
if (!this.workerAvailable) {
const native = await this.ensureNative()
if (native.setConsoleCallback) {
native.setConsoleCallback(callback)
}
return
}
// TODO: Worker 模式
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setConsoleCallback AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callback AST#identifier#Right AST#type_annotation#Left AST#:... | async setConsoleCallback(callback: (data: string) => void): Promise<void> {
try {
if (!this.workerAvailable) {
const native = await this.ensureNative()
if (native.setConsoleCallback) {
native.setConsoleCallback(callback)
}
return
}
// TODO: Worker 模式
... | https://github.com/AetheriumSimulator/qemu-hmos | e5cb3a8fcd40b92e557dd3ba2425c4fdeb88dca6 | github |
openharmony/arkui_advanced_ui_component | customappbar/source/custom_app_bar.ets | arkts | halfScreenShowAnimation | 半屏拉起动效 | halfScreenShowAnimation(): void {
animateTo({
duration: 250,
curve: Curve.Sharp,
}, () => {
this.maskOpacity = 0.3;
this.maskBlurScale = 1;
});
animateTo({
duration: 250,
curve: curves.interpolatingSpring(0, 1, 328, 36),
}, () => {
this.containerHeight = '... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left halfScreenShowAnimation 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#{#Left { AST#{#Right... | halfScreenShowAnimation(): void {
animateTo({
duration: 250,
curve: Curve.Sharp,
}, () => {
this.maskOpacity = 0.3;
this.maskBlurScale = 1;
});
animateTo({
duration: 250,
curve: curves.interpolatingSpring(0, 1, 328, 36),
}, () => {
this.containerHeight = '... | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 32c318c41f7e5085793327fe4bda32aef2c874fb | gitee |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/WhiteNoisePlayer.ets | arkts | playWhiteNoise | 播放 rawfile/white_noise/ 目录下的白噪音
@param context UIAbilityContext
@param fileName 文件名 | public async playWhiteNoise(context: common.UIAbilityContext, fileName: string): Promise<void> {
if (!this.avPlayer) await this.initPlayer();
if (!this.avPlayer) return;
try {
if (this.state !== PlayerState.IDLE) {
await this.avPlayer.reset();
}
this.currentTrackName = fileNam... | 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 playWhiteNoise AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :... | public async playWhiteNoise(context: common.UIAbilityContext, fileName: string): Promise<void> {
if (!this.avPlayer) await this.initPlayer();
if (!this.avPlayer) return;
try {
if (this.state !== PlayerState.IDLE) {
await this.avPlayer.reset();
}
this.currentTrackName = fileNam... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/WhiteNoisePlayer.ets#L96-L114 | 0a27ebdf1f5286ea2d8333b9a03b6dcfb25023dd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | resetBottomBarScrollState | 重置底栏滚动状态(用于切换标签页时) | private resetBottomBarScrollState(): void {
this.clearBottomBarSettleTimer();
this.bottomBarScrollAccumulator = 0;
this.bottomBarLastScrollDirection = 0;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetBottomBarScrollState 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#Rig... | private resetBottomBarScrollState(): void {
this.clearBottomBarSettleTimer();
this.bottomBarScrollAccumulator = 0;
this.bottomBarLastScrollDirection = 0;
} | https://github.com/DaLongZhuaZi/manxia | a524cbc08b02da6d0cf6ccbfa2b88ff84b0aab14 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleEvents.ets | arkts | clearEventQueue | Drop all buffered events without flushing, used by ModuleRequestQueue's
`flushQueues()` to reset both queues at once. Started timed events are
intentionally preserved per dev guide §Queue Operations. | public clearEventQueue(): void { this.eventQueue = []; } | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearEventQueue 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#expres... | public clearEventQueue(): void { this.eventQueue = []; } | https://github.com/Countly/countly-sdk-hos | fd8f1e7dbd8a761d5a5fcf757115fd5981bc9c43 | github |
dingzhilin1990/zhilinclaw | src/events/EventBus.ets | arkts | clear | 清空所有订阅 | public clear(): void {
this.subscribers.clear();
this.subscriptionCounter = 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear 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#:#Rig... | public clear(): void {
this.subscribers.clear();
this.subscriptionCounter = 0;
} | https://github.com/dingzhilin1990/zhilinclaw | 44a851565dbfe80dcc78cf191962576e1ed7b8c5 | github |
751496032/DSBridge-HarmonyOS | library/src/main/ets/core/WebViewControllerProxy.ets | arkts | createController | 创建代理
@param obj 要注入的对象
@returns | static createController(obj?: object): WebViewControllerProxy {
return new WebViewControllerProxy(new webview.WebviewController(), obj)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createController 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#:#Left : AST#:#Right AST#ERROR#R... | static createController(obj?: object): WebViewControllerProxy {
return new WebViewControllerProxy(new webview.WebviewController(), obj)
} | https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L208-L210 | 3e041ff75f7dbd6666aa52077e803754a2bbce3d | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | createNewContact | New Contact | createNewContact(number) {
var actionData: LooseObject = {};
actionData.phoneNumber = number;
actionData.pageFlag = common.contactPage.PAGE_FLAG_SAVE_CONTACT;
this.jumpToContact(actionData);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createNewContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#... | createNewContact(number) {
var actionData: LooseObject = {};
actionData.phoneNumber = number;
actionData.pageFlag = common.contactPage.PAGE_FLAG_SAVE_CONTACT;
this.jumpToContact(actionData);
} | https://gitee.com/openharmony/applications_mms.git | 62dc340191cae2040aa8731fe9c72e27c0f99afc | gitee |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | getChamferXY | 获取俩边倒角中心位置 | getChamferXY(): void {
this.chamferXY = utilGetChamferXY(this.circleDiameter, this.chamferRadius)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getChamferXY 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... | getChamferXY(): void {
this.chamferXY = utilGetChamferXY(this.circleDiameter, this.chamferRadius)
} | https://gitcode.com/arkui-x/samples | 0fdecd2aae0aeef9ae8a84d4c2f66e4b0f1a6a2d | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/Network.ets | arkts | setCustomHeaders | Accept only well-formed headers. CR/LF bytes allow header-splitting
attacks; a denylist of transport-owned headers prevents integrators from
accidentally smuggling a different Host or corrupting Content-Length. | public setCustomHeaders(headers: Record<string, string>): void {
const safe: Record<string, string> = {};
// Denylist covers: transport framing (host/content-length/te/transfer-
// encoding/trailer/upgrade), SDK-owned headers (content-type/accept),
// and headers integrators commonly inject from other... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCustomHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio... | public setCustomHeaders(headers: Record<string, string>): void {
const safe: Record<string, string> = {};
// Denylist covers: transport framing (host/content-length/te/transfer-
// encoding/trailer/upgrade), SDK-owned headers (content-type/accept),
// and headers integrators commonly inject from other... | https://github.com/Countly/countly-sdk-hos | 04c91a175478f3b3f46c0d9f7669d08c72082b46 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrCodeGenerator.ets | arkts | placeFinderPatterns | Place finder patterns (3 corners) | placeFinderPatterns(): void {
const place = (row: number, col: number): void => {
for (let r = -1; r <= 7; r++) {
for (let c = -1; c <= 7; c++) {
const rr = row + r;
const cc = col + c;
if (rr < 0 || rr >= this.size || cc < 0 || cc >= this.size) continue;
cons... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left placeFinderPatterns 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#statemen... | placeFinderPatterns(): void {
const place = (row: number, col: number): void => {
for (let r = -1; r <= 7; r++) {
for (let c = -1; c <= 7; c++) {
const rr = row + r;
const cc = col + c;
if (rr < 0 || rr >= this.size || cc < 0 || cc >= this.size) continue;
cons... | https://github.com/AlkaidLab/moonlight-harmony | 6106b04c558981989a559ea6e6916c38494a97cc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | getBigInt | Gets an bigint value from an object by key and ensures it is an bigint.
@param {string} key - The key to look up
@returns {bigint} The bigint value
@throws {JsonTypeError} If the value is not an bigint or if this element is not an object
@throws {RangeError} If the key is not found | getBigInt(key: string): bigint {
return this.getElement(key).asBigInt()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBigInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#... | getBigInt(key: string): bigint {
return this.getElement(key).asBigInt()
} | https://gitcode.com/iop123123/arkts-static-skills | 3643891372396d6310bc2ccd223c2b29368d1537 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/NetHelper.ets | arkts | parseIPv4 | ─────────────────────── IPv4 工具 ───────────────────────
将点分十进制的 IPv4 地址字符串解析为 4 字节数组。
返回 null 表示格式无效。 | function parseIPv4(address: string): number[] | null {
const parts = address.split('.');
if (parts.length !== 4) {
return null;
}
const bytes: number[] = [];
for (const part of parts) {
const n = parseInt(part, 10);
if (isNaN(n) || n < 0 || n > 255 || part !== n.toString()) {
return null;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseIPv4 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left address AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function parseIPv4(address: string): number[] | null {
const parts = address.split('.');
if (parts.length !== 4) {
return null;
}
const bytes: number[] = [];
for (const part of parts) {
const n = parseInt(part, 10);
if (isNaN(n) || n < 0 || n > 255 || part !== n.toString()) {
return null;
... | https://github.com/AlkaidLab/moonlight-harmony | 32c5d75d4eed17d98ffbfffd8db078964168f477 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | constructor | `Date` constructor.
@param ms
@see ECMA-262, 21.4.2.1 | constructor(ms: double) {
this.ms = trunc(ms) as long;
this.TZOffset = Date.getLocalTimezoneOffset()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right AST... | constructor(ms: double) {
this.ms = trunc(ms) as long;
this.TZOffset = Date.getLocalTimezoneOffset()
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e75d351fdc454a08b2d4f62add54a7e414bcbe5a | gitee |
honjow/Next2V | shared/src/main/ets/network/ImageUploadClient.ets | arkts | postMultipart | `multipart/form-data` POST with a single binary file part (the image) — for hosts like sm.ms that do
not accept a base64 form field. The body is built as a binary ArrayBuffer (ASCII preamble/epilogue +
raw image bytes) so it survives the proxy stack unchanged (string-encoding would corrupt the bytes). | static async postMultipart(
url: string,
headers: Record<string, string>,
fileField: string,
fileName: string,
mimeType: string,
bytes: Uint8Array,
): Promise<ImageUploadHttpResult> {
const encoder = new util.TextEncoder()
const preamble = `--${MULTIPART_BOUNDARY}\r\nContent-Disposit... | 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 postMultipart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#... | static async postMultipart(
url: string,
headers: Record<string, string>,
fileField: string,
fileName: string,
mimeType: string,
bytes: Uint8Array,
): Promise<ImageUploadHttpResult> {
const encoder = new util.TextEncoder()
const preamble = `--${MULTIPART_BOUNDARY}\r\nContent-Disposit... | https://github.com/honjow/Next2V | 124dd2609df91e116058c740a2ccd695cb8994e3 | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AnimationUtils.ets | arkts | easeInQuad | 缓动函数 - 慢进快出
@param t 进度 (0-1)
@returns 缓动后的进度 | static easeInQuad(t: number): number {
return t * t;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left easeInQuad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | static easeInQuad(t: number): number {
return t * t;
} | https://github.com/the-wwyang/kids-learning-app | abf663e7aa3c408e9c368f7f5a0440eca1d39cbe | github |
openharmony-tpc/ImageKnife | library/src/main/ets/cache/FileCache.ets | arkts | putWithoutWriteFile | 添加缓存键值对,但不写文件(用于子线程已经写文件的场景) | putWithoutWriteFile(key: string, value: ArrayBuffer | number): void {
if (key == null || value == null) {
throw new Error('key or value is invalid ');
}
if (!this.isInited) {
return
}
// 如果size满了的话,需要按照LRU的方式删除第一个
if (this.lruCache.length == this.maxSize && !this.lruCache.contains... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left putWithoutWriteFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Lef... | putWithoutWriteFile(key: string, value: ArrayBuffer | number): void {
if (key == null || value == null) {
throw new Error('key or value is invalid ');
}
if (!this.isInited) {
return
}
// 如果size满了的话,需要按照LRU的方式删除第一个
if (this.lruCache.length == this.maxSize && !this.lruCache.contains... | https://gitee.com/openharmony-tpc/ImageKnife.git | d62f73ae94b247a25bfd794acd58edce5dfce691 | gitee |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/util/PlaylistDataUtil.ets | arkts | getSongIdAtPlaylistIndex | Resolves the backing song id at a playlist row index, if in range.
@param listIndex Zero-based index in the UI list.
@param playlistUis Current playlist UI rows.
@returns Song id when valid; otherwise undefined. | public static getSongIdAtPlaylistIndex(listIndex: number, playlistUis: PlaylistSongUi[]): number | undefined {
if (listIndex < 0 || listIndex >= playlistUis.length) {
return undefined;
}
return playlistUis[listIndex].id;
} | 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 getSongIdAtPlaylistIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left listIndex AST#identifier#Right AST#ERROR#Left... | public static getSongIdAtPlaylistIndex(listIndex: number, playlistUis: PlaylistSongUi[]): number | undefined {
if (listIndex < 0 || listIndex >= playlistUis.length) {
return undefined;
}
return playlistUis[listIndex].id;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | feb745d6f8142a784ecc0b2b734db3fb81fb87f1 | gitcode |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | getHighScore | 获取最高分 | async getHighScore(): Promise<number> {
return await getNumber('high_score', 0);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getHighScore AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async getHighScore(): Promise<number> {
return await getNumber('high_score', 0);
} | https://github.com/zcg741/chengyu-game | 23e414955504deebb166ae3e22922968fc4f8e18 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an array-like or iterable object.
@param { Iterable<BigInt> } arrayLike - An array-like or iterable object to convert to an array.
@param { function } [mapfn] - A mapping function to call on every element of the array.
@returns { BigInt64Array } - A new BigInt64Array
@static
@syscap SystemCapabili... | public static from(arrayLike: Iterable<BigInt>, mapfn?: (v: BigInt, k: number) => BigInt): BigInt64Array {
if (mapfn == undefined) {
mapfn = (v: BigInt, k: number): BigInt => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code section... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie... | public static from(arrayLike: Iterable<BigInt>, mapfn?: (v: BigInt, k: number) => BigInt): BigInt64Array {
if (mapfn == undefined) {
mapfn = (v: BigInt, k: number): BigInt => { return v }
}
let iter = arrayLike.$_iterator()
// NOTE (templin.konstantin): This code section... | https://gitcode.com/iop123123/arkts-static-skills | da78b69dcc142c7b815e41e2707a9b97a20eba89 | gitcode |
offlinecat-dev/OCNetORM | src/main/ets/query/SubQuery.ets | arkts | whereBetween | 添加 BETWEEN 条件
@param column 列名
@param min 最小值
@param max 最大值
@returns 当前实例(支持链式调用) | whereBetween(column: string, min: ValueType, max: ValueType): SubQuery {
const condition = WhereCondition.between(column, min, max)
condition.logicalOperator = LogicalOperator.AND
this.conditions.push(condition)
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereBetween 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 string AST#identifier#Right AST#,#Left , ... | whereBetween(column: string, min: ValueType, max: ValueType): SubQuery {
const condition = WhereCondition.between(column, min, max)
condition.logicalOperator = LogicalOperator.AND
this.conditions.push(condition)
return this
} | https://github.com/offlinecat-dev/OCNetORM | d49528e72b8ae5b87c2ec976590452ebcb9e5cae | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicApiClient.ets | arkts | getMusicUrl | 获取音乐URL | public static async getMusicUrl(
musicInfo: MusicInfo,
quality: string,
source = musicInfo.source
): Promise<string> {
try {
// 处理本地音源
if (source === 'local') {
return await MusicApiClient.getLocalMusicUrl(musicInfo);
}
const songId = musicInfo.id
if (!songId)... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getMusicUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left musicI... | public static async getMusicUrl(
musicInfo: MusicInfo,
quality: string,
source = musicInfo.source
): Promise<string> {
try {
// 处理本地音源
if (source === 'local') {
return await MusicApiClient.getLocalMusicUrl(musicInfo);
}
const songId = musicInfo.id
if (!songId)... | https://github.com/cpdd5201314/harmonyOS-music-app | 26a0c6ffe16d9fa1c9ac0612b9cdf3ece8ef896a | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/CreateRoomDialog.ets | arkts | build | 当前选择项的内容 | build() {
Column() {
Row() {
Text(this.title)
.fontSize(20)
.fontColor($r('app.color.COLOR_E6000000'))
.fontFamily($r('app.string.font_family'))
.textAlign(TextAlign.Center)
.margin({ top: 14, bottom: 24 })
}
.width('85%')
.justifyC... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
Text(this.title)
.fontSize(20)
.fontColor($r('app.color.COLOR_E6000000'))
.fontFamily($r('app.string.font_family'))
.textAlign(TextAlign.Center)
.margin({ top: 14, bottom: 24 })
}
.width('85%')
.justifyC... | https://github.com/openharmony/applications_app_samples | e59f6e7b4cd7e1f1571ca4f602b0741ef9ff3792 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | getAncestors | @summary Gets all parents of an item.
@param {LibraryApiGetAncestorsRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public async getAncestors(requestParameters: LibraryApiGetAncestorsRequest): Promise<Array<BaseItemDto>> {
this.assertParam(requestParameters.itemId)
this.assertParam(requestParameters.userId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/Ancestors`, parameters: requestParameters})
... | 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 getAncestors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#... | public async getAncestors(requestParameters: LibraryApiGetAncestorsRequest): Promise<Array<BaseItemDto>> {
this.assertParam(requestParameters.itemId)
this.assertParam(requestParameters.userId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/Ancestors`, parameters: requestParameters})
... | https://github.com/OHPG/FinSdk | 40f2a03bbef045e8c22433ba61d1528d55e8470e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | isPhonePortrait | 判断是否是手机竖屏 | public isPhonePortrait(): boolean {
const info = this.getDeviceInfo();
return info.deviceType === DeviceType.PHONE && info.orientation === ScreenOrientation.PORTRAIT;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPhonePortrait AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | public isPhonePortrait(): boolean {
const info = this.getDeviceInfo();
return info.deviceType === DeviceType.PHONE && info.orientation === ScreenOrientation.PORTRAIT;
} | https://github.com/DaLongZhuaZi/manxia | 88e31e2a5348828096bb200c674ef8a94291e45f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setUTCMinutes | Sets the minutes for a specified date according to universal time.
@param { int } value new minutes
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setUTCMinutes(value: int): long {
let min = ecmaMinFromTime(this.ms);
this.ms -= min * msPerMinute;
this.ms += value * msPerMinute;
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | public setUTCMinutes(value: int): long {
let min = ecmaMinFromTime(this.ms);
this.ms -= min * msPerMinute;
this.ms += value * msPerMinute;
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 13b1531be22ccf17063c02b1b7c6d5f9a4efd75e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets | arkts | saveRepositoryConfig | 保存仓库配置 | private async saveRepositoryConfig(route: RepositoryRouteResult, name: string, sourceCount: number): Promise<void> {
try {
const savedRepos = await this.getSavedRepositories();
// 生成仓库ID
const normalizedOriginalUrl = this.normalizeRepositoryUrl(route.originalUrl || route.effectiveUrl);
... | 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 saveRepositoryConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left route AST#identifier#Right AST#:... | private async saveRepositoryConfig(route: RepositoryRouteResult, name: string, sourceCount: number): Promise<void> {
try {
const savedRepos = await this.getSavedRepositories();
// 生成仓库ID
const normalizedOriginalUrl = this.normalizeRepositoryUrl(route.originalUrl || route.effectiveUrl);
... | https://github.com/DaLongZhuaZi/manxia | b035e6f63b974e4bd14ee4b6802ee3ac96581ae0 | github |
arkui-x/samples | CodeLab/Cases/feature/databaseupgrade/src/main/ets/service/DataService.ets | arkts | transform | V1新老版本字段转换逻辑
@param resultSet 查询结果集
@param targetVersion 目标版本
@returns 目标版本格式数据 | transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket {
switch (targetVersion) {
case Constants.V2:
return this.transformV1ToV2(resultSet);
case Constants.V3:
return this.transformV1ToV3(resultSet);
default: {
throw new Error('The database v... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left transform AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left relationalStor... | transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket {
switch (targetVersion) {
case Constants.V2:
return this.transformV1ToV2(resultSet);
case Constants.V3:
return this.transformV1ToV3(resultSet);
default: {
throw new Error('The database v... | https://gitcode.com/arkui-x/samples | e062e99d43764c4bdf9fc564d043d3217e7faf12 | gitcode |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/DateUtil.ets | arkts | getCurrentMonth | 获取当前月份 | static getCurrentMonth(): string {
return String(new Date().getMonth() + 1).padStart(2, '0');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST... | static getCurrentMonth(): string {
return String(new Date().getMonth() + 1).padStart(2, '0');
} | https://github.com/qiuhaotc/HarmonyOSPlayground | d974306a59985d3239c51ecb4b3c32215b1b9aaa | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets | arkts | sendData | 发送数据
@param data
@param address
@param port | async sendData(data: string, address: string, port: number): Promise<void> {
let options: socket.UDPSendOptions = {
address: {
address: address,
port: port,
family: 1,
},
data: data,
};
if (!this.udpSocket) {
return;
}
Logger.info(`${TAG} tls sendDa... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sendData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async sendData(data: string, address: string, port: number): Promise<void> {
let options: socket.UDPSendOptions = {
address: {
address: address,
port: port,
family: 1,
},
data: data,
};
if (!this.udpSocket) {
return;
}
Logger.info(`${TAG} tls sendDa... | https://github.com/openharmony/applications_app_samples | f902aadd58e6e7d47c3bc605f6f2018140b54e8e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | md5Encode16 | MD5编码16位 | md5Encode16(str: string): string {
const full = this.md5Encode(str);
return full.substring(8, 24);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left md5Encode16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#... | md5Encode16(str: string): string {
const full = this.md5Encode(str);
return full.substring(8, 24);
} | https://github.com/DaLongZhuaZi/manxia | c6ec40be5d87bfdb78cfa89f39d063d2f3297a28 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | setTheme | 设置主题
@param theme 主题名称 | async setTheme(theme: string): Promise<void> {
try {
await this.dao.put(AppConstants.PREF_KEY_THEME, theme);
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to set theme: ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setTheme AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left theme AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async setTheme(theme: string): Promise<void> {
try {
await this.dao.put(AppConstants.PREF_KEY_THEME, theme);
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to set theme: ${JSON.stringify(err)}`);
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | d38a770ca62012ebb464cd31a7843ba0e102feb3 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets | arkts | panEnd | End of panning gesture. | panEnd(): void {
this.panX = 0;
this.panY = 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left panEnd 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 ... | panEnd(): void {
this.panX = 0;
this.panY = 0;
} | https://gitee.com/harmonyos/codelabs.git | 7210d6071c4a71dd1a8b577d979d4c2a2cfafe32 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | getUTCMilliseconds | Returns the milliseconds portion of the time object's value according to universal time.
@returns { int }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUTCMilliseconds(): int {
let localTime = this.ms;
return ecmaMsFromTime(localTime);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCMilliseconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int... | public getUTCMilliseconds(): int {
let localTime = this.ms;
return ecmaMsFromTime(localTime);
} | https://gitcode.com/iop123123/arkts-static-skills | aaef3b9d3a44f1c5bb66805c15cafefcd77a7c3c | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/model/BreakpointModel.ets | arkts | shouldHideBackButton | Determines whether the back button should be hidden based on the current screen size.
The back button is hidden on non-small screens (e.g., tablets or larger devices)
and remains visible on small screens (e.g., mobile phones).
@returns {boolean} True if the back button should be hidden, false if it should be visible. | public shouldHideBackButton(): boolean {
if (this.isSmallScreen()) {
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left shouldHideBackButton 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 bool... | public shouldHideBackButton(): boolean {
if (this.isSmallScreen()) {
return false;
}
return true;
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 9f7d12b80a5b6bd3886b654905ca6d61c824d1d0 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test40_original_index.ets | arkts | testFlat | === Round 40: Array.flat/flatMap, Number constants, localeCompare,
nested Map, chained pipeline, higher-order function returns,
readonly class, word frequency counting ===
--- Array.flat and flatMap --- | function testFlat(): string {
let nested: number[][] = [[1, 2], [3, 4], [5]];
let flat: number[] = [];
for (let i: number = 0; i < nested.length; i++) {
let inner: number[] = nested[i];
for (let j: number = 0; j < inner.length; j++) {
flat.push(inner[j]);
}
}
return String(flat.length) + ','... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFlat 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#Le... | function testFlat(): string {
let nested: number[][] = [[1, 2], [3, 4], [5]];
let flat: number[] = [];
for (let i: number = 0; i < nested.length; i++) {
let inner: number[] = nested[i];
for (let j: number = 0; j < inner.length; j++) {
flat.push(inner[j]);
}
}
return String(flat.length) + ','... | https://github.com/miaochiahao/ark-ghidra | c51f1e3e65183fb0a2b0ebf320be839274211ea2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupDiagnostics.ets | arkts | reset | 重置监控状态 | public reset(): void {
this.isMonitoring = false;
this.phases.clear();
this.startupStartTime = 0;
logger.info('StartupDiagnostics', '🔄 启动诊断状态已重置');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset 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#:#Rig... | public reset(): void {
this.isMonitoring = false;
this.phases.clear();
this.startupStartTime = 0;
logger.info('StartupDiagnostics', '🔄 启动诊断状态已重置');
} | https://github.com/DaLongZhuaZi/manxia | 46f1551494982d4edfc478538b86aa8c7eb568d9 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateService.ets | arkts | deleteUserTemplate | 删除用户模板 | deleteUserTemplate(template: IUserTemplate, kdbx: Kdbx): boolean {
try {
const templateGroup = this.getTemplatesGroup(kdbx);
if (!templateGroup) {
return false;
}
// 查找模板条目
const entry = this.findEntryByUuid(templateGroup, template.uuid);
if (entry) {
// 从分组中移除... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteUserTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IUserTemplate AST#identifier#Righ... | deleteUserTemplate(template: IUserTemplate, kdbx: Kdbx): boolean {
try {
const templateGroup = this.getTemplatesGroup(kdbx);
if (!templateGroup) {
return false;
}
// 查找模板条目
const entry = this.findEntryByUuid(templateGroup, template.uuid);
if (entry) {
// 从分组中移除... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L215-L238 | 60f2a93fa8f3397f5ebaa6d566bbced8b7058cad | github |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/viewmodel/LoginViewModel.ets | arkts | onQQLoginClick | QQ 登录点击
@returns {void} 无返回值 | onQQLoginClick(): void {
// 第三方登录暂未接入,等待后续实现
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onQQLoginClick 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#... | onQQLoginClick(): void {
// 第三方登录暂未接入,等待后续实现
} | https://github.com/Joker-x-dev/CoolMallArkTS | 256d6d5ea1fd392a45fa82e00d9369d408737ec0 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnFormViewModel.ets | arkts | validateBasicName | 验证基础表单姓名字段 | validateBasicName(): void {
this.basicController.validateField("name").then((res): void => {
if (res.valid) {
this.validateResultMsg = "姓名验证通过";
} else {
this.validateResultMsg = `${res.field.label} 验证失败: ${res.field.message}`;
}
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validateBasicName 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_... | validateBasicName(): void {
this.basicController.validateField("name").then((res): void => {
if (res.valid) {
this.validateResultMsg = "姓名验证通过";
} else {
this.validateResultMsg = `${res.field.label} 验证失败: ${res.field.message}`;
}
});
} | https://github.com/codelably/tuniao-ui | 68000fcf90be63c6099a5beb99a7a7c995e62431 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/PackLibrary.ets | arkts | djb2Hash | Hash a string to a non-negative 32-bit int via djb2. Used to stably
pick a fallback palette index for family packs. | function djb2Hash(s: string): number {
let h: number = 5381;
for (let i: number = 0; i < s.length; i++) {
h = ((h << 5) - h) + s.charCodeAt(i);
h = h | 0;
}
return h < 0 ? -h : h;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left djb2Hash AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function djb2Hash(s: string): number {
let h: number = 5381;
for (let i: number = 0; i < s.length; i++) {
h = ((h << 5) - h) + s.charCodeAt(i);
h = h | 0;
}
return h < 0 ? -h : h;
} | https://github.com/terryma2024/happyword | 1af3d718db80de8663503707d9c3799c08b7f3ad | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets | arkts | cleanHeaderText | 清理头部文本(移除广告、网站信息等) | private static cleanHeaderText(text: string): string {
const lines = text.split('\n');
const cleanedLines: string[] = [];
for (const line of lines) {
const trimmed = line.trim();
if (!TxtMetadataExtractor.isSkipLine(trimmed)) {
cleanedLines.push(line);
}
}
retur... | 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 cleanHeaderText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left... | private static cleanHeaderText(text: string): string {
const lines = text.split('\n');
const cleanedLines: string[] = [];
for (const line of lines) {
const trimmed = line.trim();
if (!TxtMetadataExtractor.isSkipLine(trimmed)) {
cleanedLines.push(line);
}
}
retur... | https://github.com/DaLongZhuaZi/manxia | a448355dfb7a3097927868d192e4b47f360f4695 | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ConfigFlow.ui.test.ets | arkts | setCustomTimerSeconds | V0.6.7.7: drive the 自定义 timer dialog end-to-end. Caller is
responsible for already being on `ConfigPage` (the 自定义 button
lives in the timer row near the top of the form, so no scroll is
needed on the landscape emulator viewport). On return the page is
still ConfigPage with the chosen seconds applied and persisted.
The ... | async function setCustomTimerSeconds(driver: Driver, seconds: number): Promise<void> {
try {
await driver.assertComponentExist(ON.id('ConfigTimerCustom'));
await clickByIdShared(driver, 'ConfigTimerCustom');
await driver.delayMs(600);
await driver.assertComponentExist(ON.id('CustomTimerDialog'));
... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left setCustomTimerSeconds AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right... | async function setCustomTimerSeconds(driver: Driver, seconds: number): Promise<void> {
try {
await driver.assertComponentExist(ON.id('ConfigTimerCustom'));
await clickByIdShared(driver, 'ConfigTimerCustom');
await driver.delayMs(600);
await driver.assertComponentExist(ON.id('CustomTimerDialog'));
... | https://github.com/terryma2024/happyword | f8e3187e089db8c43e5295f09a4a7257d80a47f4 | github |
codelably/HCompass | packages/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets | arkts | requestGoodsDetail | 发起 GET 请求(商品详情) | requestGoodsDetail() {
RequestHelper.from<Goods>(this.repository.getGoodsInfo("1"))
.start((): void => {
this.getLoading = true;
})
.execute()
.then((data: Goods): void => {
const goods: Goods = new Goods(data);
ToastUtils.showSuccess($r("app.string.demo_network_req... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestGoodsDetail 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... | requestGoodsDetail() {
RequestHelper.from<Goods>(this.repository.getGoodsInfo("1"))
.start((): void => {
this.getLoading = true;
})
.execute()
.then((data: Goods): void => {
const goods: Goods = new Goods(data);
ToastUtils.showSuccess($r("app.string.demo_network_req... | https://github.com/codelably/HCompass | 53a939443927909bb3aedaa65ba8e37ba88e98c4 | github |
ibestservices/ibest-ui | library/src/main/ets/components/form/index.ets | arkts | setFormValues | 设置表单值 | setFormValues(values: Record<string, IBestFieldValueType>){
const keys = Object.keys(values)
this.formItems.forEach((item: IBestFieldItem) => {
if(keys.includes(item.prop)){
item.setValue(values[item.prop])
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFormValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identif... | setFormValues(values: Record<string, IBestFieldValueType>){
const keys = Object.keys(values)
this.formItems.forEach((item: IBestFieldItem) => {
if(keys.includes(item.prop)){
item.setValue(values[item.prop])
}
})
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/form/index.ets#L187-L194 | f96e88b32e18c704831b94af270bcabb431e1174 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | getLong | Gets an long value from an object by key and ensures it is an long.
@param {string} key - The key to look up
@returns {long} The long value
@throws {JsonTypeError} If the value is not an long or if this element is not an object
@throws {RangeError} If the key is not found | getLong(key: string): long {
return this.getElement(key).asLong()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri... | getLong(key: string): long {
return this.getElement(key).asLong()
} | https://gitcode.com/iop123123/arkts-static-skills | 3d68fbfa12f63a23112f630d4f376dcb09636682 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | from | Creates an BigInt64Array from array-like argument
@param o array-like object to initialize BigInt64Array
@param mapFn function to apply for each
@returns new BigInt64Array | public from(o: Object, mapFn: (e: Object) => long): BigInt64Array {
let newF: (e: Object, index: int) => long =
(e: Object, index: int): long => { 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) => long): BigInt64Array {
let newF: (e: Object, index: int) => long =
(e: Object, index: int): long => { return mapFn(e) }
return this.from(o, newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2d0d44f4eca91db2b4dcd986a96409e5fc3e88d6 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | getFavoritesByUsername | Get favorites by username | static async getFavoritesByUsername(username: string): Promise<IFavorite[]> {
try {
// 优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await FavoriteApi.getFavorites(1, 100);
if (response.code === 200 && response.data && response.data.list.length > 0) {
co... | 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 getFavoritesByUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST... | static async getFavoritesByUsername(username: string): Promise<IFavorite[]> {
try {
// 优先从服务器获取
if (SERVER_ENABLED) {
try {
const response = await FavoriteApi.getFavorites(1, 100);
if (response.code === 200 && response.data && response.data.list.length > 0) {
co... | https://github.com/Harrisonls2004/WaterFlow | 496d8026ddaad95b60b7368a70c2bbee13d0311e | github |
openharmony/arkui_advanced_ui_component | customappbar/source/custom_app_bar_forpc.ets | arkts | onMinimizeButtonClick | 点击最小化按钮 | onMinimizeButtonClick(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMinimizeButtonClick 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_expr... | onMinimizeButtonClick(): void {
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | e44a80db744501b8e3c13a1b845cb0cc1023c526 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/HapticManager.ets | arkts | trigger | 触发震动反馈
读取 input_haptic_enabled 和 input_haptic_strength 设置,
将强度 (1-100) 映射为震动时长 (5-50ms)。 | public trigger(): void {
const enabled = this.settingsManager.getSync<boolean>('input_haptic_enabled', true);
if (!enabled) return;
try {
const strength = this.settingsManager.getSync<number>('input_haptic_strength', 70);
const duration = Math.round(5 + (strength / 100) * 45);
vibrator.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trigger 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 ... | public trigger(): void {
const enabled = this.settingsManager.getSync<boolean>('input_haptic_enabled', true);
if (!enabled) return;
try {
const strength = this.settingsManager.getSync<number>('input_haptic_strength', 70);
const duration = Math.round(5 + (strength / 100) * 45);
vibrator.... | https://github.com/richshaw2015/nds | 30ce6d1976fdab77288ceb57e5e14d17aa66b21f | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/view/GoodsDetailPage.ets | arkts | build | 构建商品详情页面
@returns {void} 无返回值 | build() {
AppNavDestination({
hideTitleBar: true,
viewModel: this.vm,
paddingValue: {
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
hideTitleBar: true,
viewModel: this.vm,
paddingValue: {
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
BaseNetWorkView({
uiState: this.vm.uiState,
onRetry: (): void => this... | https://github.com/Joker-x-dev/CoolMallArkTS | 9f805b2628f597ce02bbfe1b9d3b7128d9b75d73 | github |
Gramony/Gramony | features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets | arkts | notifyDataReload | 通知LazyForEach组件需要重载所有子组件 | notifyDataReload(): void {
Logger.debug('notifyDataReload');
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataReload 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_b... | notifyDataReload(): void {
Logger.debug('notifyDataReload');
this.listeners.forEach(listener => {
listener.onDataReloaded();
})
} | https://github.com/Gramony/Gramony | 0c83c628aa4565e13918bb4a514e3a2449236f3d | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | int64Number | Read signed varint64 as number (may lose precision) | int64Number(): number { const v = this.int64(); const max = BigInt(Number.MAX_SAFE_INTEGER); return v <= max ? Number(v) : Number(v) } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left int64Number AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | int64Number(): number { const v = this.int64(); const max = BigInt(Number.MAX_SAFE_INTEGER); return v <= max ? Number(v) : Number(v) } | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 4f3589771c728642e87d166bc2842e14b3114b36 | gitcode |
SMAT-Lab/ArkAnalyzer-HapRay | test_hap/test_suite/src/main/ets/testcases/imageknife/pages/ImageCacheUtil.ets | arkts | initCacheDir | 初始化缓存目录 | static async initCacheDir(context: common.Context): Promise<void> {
if (ImageCacheUtil.initialized) {
return;
}
try {
const cacheDirPath = context.cacheDir;
ImageCacheUtil.cacheDir = cacheDirPath + '/image_cache';
// 确保缓存目录存在
if (!fileIO.accessSync(ImageCacheUtil.cacheDir)) {... | 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 initCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : A... | static async initCacheDir(context: common.Context): Promise<void> {
if (ImageCacheUtil.initialized) {
return;
}
try {
const cacheDirPath = context.cacheDir;
ImageCacheUtil.cacheDir = cacheDirPath + '/image_cache';
// 确保缓存目录存在
if (!fileIO.accessSync(ImageCacheUtil.cacheDir)) {... | https://github.com/SMAT-Lab/ArkAnalyzer-HapRay | ce05b8add3ac1a73688fae201f54f43ef034d43f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportPlugins | 导出插件信息 | private async exportPlugins(): Promise<PluginBackup[]> {
try {
const sql = `
SELECT
id, pluginId, name, version, description, author,
hspPath, configSchema, isEnabled, installTime, updateTime
FROM plugin
`;
const results = await this.dbManager.querySql(sql);
... | 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 exportPlugins AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | private async exportPlugins(): Promise<PluginBackup[]> {
try {
const sql = `
SELECT
id, pluginId, name, version, description, author,
hspPath, configSchema, isEnabled, installTime, updateTime
FROM plugin
`;
const results = await this.dbManager.querySql(sql);
... | https://github.com/DaLongZhuaZi/manxia | 3d9a2e80d7b86514c4d0bc67906a505bd81271a6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/RadarDataSet.ets | arkts | setDrawHighlightCircleEnabled | / Sets whether highlight circle should be drawn or not | public setDrawHighlightCircleEnabled(enabled: boolean): void {
this.mDrawHighlightCircleEnabled = enabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawHighlightCircleEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | public setDrawHighlightCircleEnabled(enabled: boolean): void {
this.mDrawHighlightCircleEnabled = enabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1edacfdbe6d2e8ac08f168c2607f17578ddd1eb6 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | removeTagFromBill | 从账单移除标签
@param billId 账单ID
@param tagId 标签ID | static async removeTagFromBill(billId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `DELETE FROM bill_tags WHERE bill_id = ? AND tag_id = ?`;
try {
await store.executeSql(sql, [billId, tagId]);
// 减少标签使用次数
await TagDAO.decrementUsageCou... | 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 removeTagFromBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left... | static async removeTagFromBill(billId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `DELETE FROM bill_tags WHERE bill_id = ? AND tag_id = ?`;
try {
await store.executeSql(sql, [billId, tagId]);
// 减少标签使用次数
await TagDAO.decrementUsageCou... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 433e06a6e4854fe1dcc5006e9f09c576f2837974 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | extractWithZlib | 使用系统zlib解压ZIP/CBZ格式 | private async extractWithZlib(archivePath: string, targetDir: string): Promise<void> {
logger.info(TAG, `使用系统zlib解压: ${archivePath}`);
await zlib.decompressFile(archivePath, targetDir);
} | 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 extractWithZlib AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left archivePath AST#identifier#Right AST#ERROR#Left AST#... | private async extractWithZlib(archivePath: string, targetDir: string): Promise<void> {
logger.info(TAG, `使用系统zlib解压: ${archivePath}`);
await zlib.decompressFile(archivePath, targetDir);
} | https://github.com/DaLongZhuaZi/manxia | b6c6a73a347f81079eacaf1fcae11003ee11b271 | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | testDouble | 测试 double (f64) | function testDouble() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc((2.71828).toDouble(), (2.71828).toDouble());
arktest.assertEQ(res, 2.71828);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testDouble AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declarat... | function testDouble() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc((2.71828).toDouble(), (2.71828).toDouble());
arktest.assertEQ(res, 2.71828);
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 247e1f27139cdbbfe2ef75fe9781bb7fa493b9a4 | gitcode |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | appendPostalLine | @param emitEveryTime If true, builder builds the line even when there's no entry. | public appendPostalLine(type: number, label: string,
contentValues: contact.PostalAddress | null,
isPrimary: boolean, emitEveryTime: boolean): void {
let reallyUseQuotedPrintable: boolean = false;
let appendCharset: boolean = false;
let addressValue: string = "";
if (... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left appendPostalLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public appendPostalLine(type: number, label: string,
contentValues: contact.PostalAddress | null,
isPrimary: boolean, emitEveryTime: boolean): void {
let reallyUseQuotedPrintable: boolean = false;
let appendCharset: boolean = false;
let addressValue: string = "";
if (... | https://gitee.com/openharmony-tpc/VCard.git | 123286631207043e4d12ca69c12f2d7e590386d9 | gitee |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue48.ets.audit.ets | arkts | sayHi | HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 9 : issue48.ets | sayHi(): void {
console.log("Hi!");
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sayHi 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 A... | sayHi(): void {
console.log("Hi!");
} | https://gitee.com/openharmony-sig/earth.git | 4834af5f207473a23895ab81837aa3a733555f12 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | getDestinationsByFloor | 按楼层获取POI列表
@buildingId 建筑ID
@floor 楼层号 | public getDestinationsByFloor(buildingId: string, floor: number): NavigationDestination[] {
if (!this.buildingData) return [];
return this.buildingData.pois.filter(
poi => poi.building === buildingId && poi.floor === floor
);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDestinationsByFloor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buildingId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | public getDestinationsByFloor(buildingId: string, floor: number): NavigationDestination[] {
if (!this.buildingData) return [];
return this.buildingData.pois.filter(
poi => poi.building === buildingId && poi.floor === floor
);
} | https://github.com/LJ666-ui/harmony-health-care | f81437369cadbc06d315740ad57e9f6b89af4ebc | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/PanZoomHandler.ets | arkts | setOnStateChanged | 设置状态变更回调 | setOnStateChanged(callback: (state: PanZoomState) => void): void {
this.onStateChanged = callback;
} | AST#program#Left AST#ERROR#Left AST#identifier#Left setOnStateChanged AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier... | setOnStateChanged(callback: (state: PanZoomState) => void): void {
this.onStateChanged = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | e53a8cc20e7169a8a430176697278a1850e97b34 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets | arkts | eventForSpellWrongTap | V0.8.4 — Spell letter-pool wrong tap (player −damage HP, question unchanged). | function eventForSpellWrongTap(damage: number): BattleAnimationEvent {
const e: BattleAnimationEvent = new BattleAnimationEvent();
e.projectileDirection = 'backward';
e.projectileIntensity = damage;
e.projectileLabel = '';
e.playerMotion = 'hurt';
e.monsterMotion = 'idle';
e.feedbackText = 'Try again';
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left eventForSpellWrongTap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left damage AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | function eventForSpellWrongTap(damage: number): BattleAnimationEvent {
const e: BattleAnimationEvent = new BattleAnimationEvent();
e.projectileDirection = 'backward';
e.projectileIntensity = damage;
e.projectileLabel = '';
e.playerMotion = 'hurt';
e.monsterMotion = 'idle';
e.feedbackText = 'Try again';
... | https://github.com/terryma2024/happyword | f4fb9630f19e719f5863d9cbdbc13b99d30bdbd6 | github |
YANGZX22/Voot | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onContinue | 跨端流转 - 保存状态
当用户发起流转时,系统会调用此方法保存当前状态 | onContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult {
console.info('[EntryAbility] onContinue called');
try {
// 从 AppStorage 获取当前状态
const isListening = AppStorage.get<boolean>('voot_is_listening') || false;
const isTranslating = AppStorage.get<boolean>('voot_is_... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onContinue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left wantParam AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | onContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult {
console.info('[EntryAbility] onContinue called');
try {
// 从 AppStorage 获取当前状态
const isListening = AppStorage.get<boolean>('voot_is_listening') || false;
const isTranslating = AppStorage.get<boolean>('voot_is_... | https://github.com/YANGZX22/Voot | ea3162545937dafc0051fe4bee785a2872072a8c | github |
HarmonyOS_Samples/multi-tab-navigation | entry/src/main/ets/pages/LeftTab.ets | arkts | build | [End LeftTab_builder_tab] | build() {
Column() {
// [Start LeftTab_stack]
Stack({ alignContent: Alignment.TopStart }) {
// The text of tab.
Row() {
ForEach(this.tabArray, (item: number, index: number) => {
this.tab(this.tabStr + item, item, index);
}, (item: number, _index: number)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
// [Start LeftTab_stack]
Stack({ alignContent: Alignment.TopStart }) {
// The text of tab.
Row() {
ForEach(this.tabArray, (item: number, index: number) => {
this.tab(this.tabStr + item, item, index);
}, (item: number, _index: number)... | https://gitcode.com/HarmonyOS_Samples/multi-tab-navigation | 91996ac0d8c8f86fd4c3c0c4c40610c6bbcf3772 | gitcode |
who7708/harmonyos-codelabs | HmosWorld/features/discover/src/main/ets/model/DiscoverModel.ets | arkts | setLikesCount | Set likes count of feed or article through public event parameters
@param eventData | setLikesCount(eventData: ActionEventData): void {
if (eventData.resourceType === ResourcesType.FEED) {
this.hotFeedList.forEach((res: LearningResource) => {
if (res.id === eventData.resourceId) {
res.likesCount += eventData.actionValue ? 1 : -1;
}
});
}
if (eventData.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLikesCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ActionEventData AST#identifier#Right ... | setLikesCount(eventData: ActionEventData): void {
if (eventData.resourceType === ResourcesType.FEED) {
this.hotFeedList.forEach((res: LearningResource) => {
if (res.id === eventData.resourceId) {
res.likesCount += eventData.actionValue ? 1 : -1;
}
});
}
if (eventData.... | https://github.com/who7708/harmonyos-codelabs | 8b0b8ec50631d9322fa1d0d4db2a9fa96e34cffe | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/location/PermissionManager.ets | arkts | requestPermissionAgain | 被拒绝后,再次点击全权限申请使用该方法 | async requestPermissionAgain(permissions: Array<Permissions>, context: Context): Promise<boolean> {
try {
const result = await this.atManager.requestPermissionOnSetting(context, permissions)
return result.every((status) => {
return status === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestPermissionAgain AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left permissions AST#identifier#Right AST#type_annotation#Lef... | async requestPermissionAgain(permissions: Array<Permissions>, context: Context): Promise<boolean> {
try {
const result = await this.atManager.requestPermissionOnSetting(context, permissions)
return result.every((status) => {
return status === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED
... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 565b50916ba74fefa1059d1209c08e76c3527c52 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseManager.ets | arkts | transaction | 执行事务
@throws | static async transaction(fn: () => Promise<void>): Promise<void> {
const store = DatabaseManager.getDatabase();
await store.beginTransaction();
try {
await fn();
await store.commit();
} catch (error) {
await store.rollBack();
throw DatabaseManager.toError('[DatabaseManager] 事务执... | 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 transaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#... | static async transaction(fn: () => Promise<void>): Promise<void> {
const store = DatabaseManager.getDatabase();
await store.beginTransaction();
try {
await fn();
await store.commit();
} catch (error) {
await store.rollBack();
throw DatabaseManager.toError('[DatabaseManager] 事务执... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 57b130fca1d9d8c942ea3893e50607aa1affbf7f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets | arkts | constructor | Constructs a new Boolean with default value false
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.value = false
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.value = false
} | https://gitcode.com/iop123123/arkts-static-skills | c005c6484095b8d99da129b94d6748a99192519d | gitcode |
arkui-x/samples | CodeLab/Cases/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets | arkts | onFocusIndexChange | toast弹窗时长
更新中间变量 | onFocusIndexChange() {
this.middleIndex = this.focusIndex;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onFocusIndexChange 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... | onFocusIndexChange() {
this.middleIndex = this.focusIndex;
} | https://gitcode.com/arkui-x/samples | 1bd353dce83e58fa267074ceb9bad202fdc50fe1 | gitcode |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/pages/HabitDetailPage.ets | arkts | statNumStyle | =================================================================
🆕 底部扩展样式定义 (@Extend & @Styles)
=================================================================
统计卡片中的数字样式 | @Extend(Text)
function statNumStyle() {
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#007DFF')
.textAlign(TextAlign.Center)
} | 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 statNumStyle() {
.fontSize(18)
.fontWeight(FontWeight.Bold)
.fontColor('#007DFF')
.textAlign(TextAlign.Center)
} | https://gitcode.com/openharmony/codelabs | 7fe9ea53739d383483ff7879235eb296918a9c3b | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/04.names_declarations_and_scopes/04.scopes/type_param_interface.ets | arkts | foo | overridden interface method | public override foo(p: T): T {
this.fld1 = p;
this.fld2 = this.fld1 * 2;
return this.fld2;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#identifier#Left foo AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#iden... | public override foo(p: T): T {
this.fld1 = p;
this.fld2 = this.fld1 * 2;
return this.fld2;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1681233911f469a5274a0ea1e1e2f00b5618a4e4 | gitee |
azhu0001/localsend-harmony | serve/src/main/ets/decode/BufferPool.ets | arkts | getCurrentBodyLength | 获取当前正文长度
如果headPos存在,返回数据写入位置与headPos之间的距离
如果headPos不存在,返回headPos
@return {number} 返回当前正文长度 | public getCurrentBodyLength(): number {
if (this.headEnd) { // 判断headPos是否存在
return this.writeStart - this.headEnd; // 返回数据写入位置与headPos之间的距离
} else {
return this.headEnd; // 如果headPos不存在,返回headPos
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentBodyLength 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 numbe... | public getCurrentBodyLength(): number {
if (this.headEnd) { // 判断headPos是否存在
return this.writeStart - this.headEnd; // 返回数据写入位置与headPos之间的距离
} else {
return this.headEnd; // 如果headPos不存在,返回headPos
}
} | https://gitcode.com/azhu0001/localsend-harmony | 21f181b127c965d355bd436335e414599b2e9f19 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | notifyListeners | 通知监听器 | private notifyListeners(record: TrackRecord): void {
this.listeners.forEach(listener => {
try {
listener(record);
} catch (error) {
logger.error(TAG, `监听器回调失败: ${String(error)}`);
}
});
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyListeners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private notifyListeners(record: TrackRecord): void {
this.listeners.forEach(listener => {
try {
listener(record);
} catch (error) {
logger.error(TAG, `监听器回调失败: ${String(error)}`);
}
});
} | https://github.com/DaLongZhuaZi/manxia | 67305429021a98dc59e16f1104768e48a54522f6 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | acos | Return a new Decimal whose value is the arccosine in radians of `n`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | static acos(n: Value): Decimal {
return new Decimal(n).acos();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left acos AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | static acos(n: Value): Decimal {
return new Decimal(n).acos();
} | https://gitcode.com/iop123123/arkts-static-skills | 6951db74e74dd22fbdb6bfdfcb11e8773562f0d8 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets | arkts | prepareRemoveAnimation | 准备删除动画 | private prepareRemoveAnimation(
oldPosMap: Map<string, ItemPosition>,
newPosMap: Map<string, ItemPosition>,
pixelMaps: Map<string, PixelMap>
): void {
// 被删除的条目:淡出并缩小
oldPosMap.forEach((oldPos, id) => {
if (!newPosMap.has(id)) {
const pixelMap = pixelMaps.get(id) || null;
c... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left prepareRemoveAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left oldPosMap AST#identifier#Right AST#ERROR#Left AST#:#Left :... | private prepareRemoveAnimation(
oldPosMap: Map<string, ItemPosition>,
newPosMap: Map<string, ItemPosition>,
pixelMaps: Map<string, PixelMap>
): void {
// 被删除的条目:淡出并缩小
oldPosMap.forEach((oldPos, id) => {
if (!newPosMap.has(id)) {
const pixelMap = pixelMaps.get(id) || null;
c... | https://github.com/DaLongZhuaZi/manxia | 1c241dae442099bd453821c3c40f336104dd5285 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RdpConnectionManager.ets | arkts | getSuggestedActions | 获取用于显示给用户的建议操作 | getSuggestedActions(info: RdpConnectionInfo): SuggestedAction[] {
const actions: SuggestedAction[] = []
if (info.status === 'timeout' || info.isStuck) {
actions.push({
label: '继续等待',
description: '等待连接完成(可能需要更长时间)',
action: 'wait',
danger: false
})
actions.pu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSuggestedActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RdpConnectionInfo AST#identifier#Rig... | getSuggestedActions(info: RdpConnectionInfo): SuggestedAction[] {
const actions: SuggestedAction[] = []
if (info.status === 'timeout' || info.isStuck) {
actions.push({
label: '继续等待',
description: '等待连接完成(可能需要更长时间)',
action: 'wait',
danger: false
})
actions.pu... | https://github.com/AetheriumSimulator/qemu-hmos | 92b1898929dea5d5b848661038f0663a61a7f269 | github |
fbinba3955/Flymby | common/src/main/ets/video/AvManager.ets | arkts | initAvSessionListener | 播控中心监听器 | public async initAvSessionListener(action?: string[]) {
if (!this.mCurrentAVSession) {
return;
}
let _actions = !action || action.length === 0 ?
['play', 'pause', 'stop', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek'] : action
if (_actions.indexOf('play') >= 0) {
this.m... | 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 initAvSessionListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#?#... | public async initAvSessionListener(action?: string[]) {
if (!this.mCurrentAVSession) {
return;
}
let _actions = !action || action.length === 0 ?
['play', 'pause', 'stop', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek'] : action
if (_actions.indexOf('play') >= 0) {
this.m... | https://github.com/fbinba3955/Flymby | 71b745e54a22ba6c59d8ad8ebd31e65021010d6d | github |
daugf2527/harmonyos-libretro-emulator | deprecated/legacy/archive/entry/src/main/ets/pages/Game2048Native.ets | arkts | updateFoldMode | 更新折叠模式 | updateFoldMode(foldStatus: display.FoldStatus) {
let newMode: FoldMode;
switch (foldStatus) {
case display.FoldStatus.FOLD_STATUS_FOLDED:
newMode = FoldMode.SINGLE;
break;
case display.FoldStatus.FOLD_STATUS_HALF_FOLDED:
newMode = FoldMode.DUAL;
break;
ca... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateFoldMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left foldStatus AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left display A... | updateFoldMode(foldStatus: display.FoldStatus) {
let newMode: FoldMode;
switch (foldStatus) {
case display.FoldStatus.FOLD_STATUS_FOLDED:
newMode = FoldMode.SINGLE;
break;
case display.FoldStatus.FOLD_STATUS_HALF_FOLDED:
newMode = FoldMode.DUAL;
break;
ca... | https://github.com/daugf2527/harmonyos-libretro-emulator | 0719c59a0183d2fa8fe3aa743c6592b82aea5308 | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/BoundDeviceInfoFlow.ui.test.ets | arkts | seedMockBinding | Seed the mock server's `_active_bindings` set by issuing a direct
`/api/v1/public/pair/redeem` call from the test process. Idempotent on the
mock side: redeeming twice with the same short code adds to the set
once and re-mints the same deterministic device token.
Why this is needed: a prior test run may have left the d... | async function seedMockBinding(): Promise<void> {
const req: http.HttpRequest = http.createHttp();
try {
await req.request(
'http://127.0.0.1:8123/api/v1/public/pair/redeem',
{
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: '{"devi... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left seedMockBinding AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST... | async function seedMockBinding(): Promise<void> {
const req: http.HttpRequest = http.createHttp();
try {
await req.request(
'http://127.0.0.1:8123/api/v1/public/pair/redeem',
{
method: http.RequestMethod.POST,
header: { 'Content-Type': 'application/json' },
extraData: '{"devi... | https://github.com/terryma2024/happyword | 3021a8ce9a965c2e1d2643f3b4d76a469b5ac84c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_ulong.ets | arkts | main | ---
desc: check not equal operation for two unsigned long integer operands
--- | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a != b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: ulong = {{v.left}}
const b: ulong = {{v.right}}
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b4e5d302e2baf7fff32f16b71becfdc5e9d4bdc0 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | from | Creates an Uint32Array from array-like argument
@param o array-like object to initialize Uint32Array
@param mapFn function to apply for each
@returns new Uint32Array | public from(o: Object, mapFn: (e: Object) => number): Uint32Array {
let newF: (e: Object, index: int) => number =
(e: Object, index: int): number => { 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) => number): Uint32Array {
let newF: (e: Object, index: int) => number =
(e: Object, index: int): number => { return mapFn(e) }
return this.from(o, newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8a85bba725a0b113e40b799742cf933b95157ead | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/dialog/dialog.ets | arkts | colorModeChange | 颜色模式切换 | colorModeChange() {
this.whiteColor = IBestDialogColor.white
this.contentBg = this.bgColor || IBestDialogColor.contentBg
this.titleDefaultColor = IBestDialogColor.titleColor
this.messageColor = IBestDialogColor.messageColor
this.cancelTextColor = IBestDialogColor.cancelTextColor
this.bdColor = IBestDialogC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left colorModeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | colorModeChange() {
this.whiteColor = IBestDialogColor.white
this.contentBg = this.bgColor || IBestDialogColor.contentBg
this.titleDefaultColor = IBestDialogColor.titleColor
this.messageColor = IBestDialogColor.messageColor
this.cancelTextColor = IBestDialogColor.cancelTextColor
this.bdColor = IBestDialogC... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dialog/dialog.ets#L209-L216 | d9ad8848421f5239b7afba1b2381177a50e005ec | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets | arkts | logoff | 注销账号
@param {Record<string, unknown>} params - 注销参数
@returns {Promise<NetworkResponse<Unknown>>} 注销结果 | async logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("user/info/logoff", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left logoff AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async logoff(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("user/info/logoff", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 62a611e586b5094c0f9cb12abb0ade3abb75f026 | github |
OHPG/FinSdk | emby/src/main/ets/api/SystemApi.ets | arkts | postPingSystem | postPingSystem
@summary Pings the system.
@throws {RequiredError}
@memberof SystemApi | public async postPingSystem(): Promise<string> {
return this.apiClient.post({ path: "/System/Ping" })
} | 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 postPingSystem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async postPingSystem(): Promise<string> {
return this.apiClient.post({ path: "/System/Ping" })
} | https://github.com/OHPG/FinSdk | 642db0354aa19f124271d5da26c5e282098970f3 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/ResourceManager.ets | arkts | getPluralStringAsync | 获取区分单复数的字符串资源的异步方法
此处直接透传 resourceManager 的 getPluralString 方法
暂不做任何【缓存处理】 和 对【同步引用方式】的适配
@param id 字符串资源的 ID
@param num 数量
@return 资源 ID 和 对应数量,在当前语言下组合后的字符串 | async getPluralStringAsync(id: number, num: number): Promise<string> {
return await (GlobalContext.getContext()
.getObject('resourceManager') as resmgr.ResourceManager).getPluralString(id, num);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPluralStringAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async getPluralStringAsync(id: number, num: number): Promise<string> {
return await (GlobalContext.getContext()
.getObject('resourceManager') as resmgr.ResourceManager).getPluralString(id, num);
} | https://gitee.com/openharmony-sig/applications_clock.git | 34a0c5038de4fe8e548d3a53c14ec10430959527 | gitee |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/water-fall/TnWaterFallTypes.ets | arkts | getAllData | 获取所有数据
@returns 数据数组副本 | getAllData(): Object[] {
return this.dataArray.slice();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | getAllData(): Object[] {
return this.dataArray.slice();
} | https://github.com/codelably/tuniao-ui | 67f2ae1340eeff1edce1f514ec0e2ead612f416f | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/i18n/facades/I18nManagerFacade.ets | arkts | getFlexDirection | 获取与当前布局方向匹配的 FlexDirection
RTL 返回 FlexDirection.RowReverse,LTR 返回 FlexDirection.Row | getFlexDirection(): FlexDirection {
return this.isRtl() ? FlexDirection.RowReverse : FlexDirection.Row;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFlexDirection 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 FlexDirection AST#identifier#Right AST#ERROR#... | getFlexDirection(): FlexDirection {
return this.isRtl() ? FlexDirection.RowReverse : FlexDirection.Row;
} | https://github.com/DaLongZhuaZi/NGF | 630a8971a8660acef8d6704b7ebd2b9bf2873e06 | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | getAudioTimeNs | 获取音频时间
@returns 基于单调纳秒系统定时器的音频时间(纳秒)
@remarks
- 用于精确的音频同步
- 时间基于系统单调时钟,不会受系统时间调整影响
@throws
- AudioRenderer 未初始化 | public async getAudioTimeNs(): Promise<number> {
if (!this.renderer) {
throw new Error('AudioRenderer not initialized');
}
return await this.renderer.getAudioTime();
} | 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 getAudioTimeNs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async getAudioTimeNs(): Promise<number> {
if (!this.renderer) {
throw new Error('AudioRenderer not initialized');
}
return await this.renderer.getAudioTime();
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L639-L644 | 5699e501ca8630fcf5bb2198cb399473069d67bb | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | isAdvancedUpstream | Reads the upstream resolver from its file, falling back to the built-in
default when the file is missing, empty, or not a valid IP address.
Reads the upstream resolver list from its file (one or more IPs separated by
newlines/commas), keeping only valid, de-duplicated entries. Falls back to
the built-in default when no... | private isAdvancedUpstream(value: string): boolean {
const v: string = value.trim();
if (v.length === 0) {
return false;
}
if (/^(udp|tcp|tls|https|h3|quic|sdns):\/\/\S+$/i.test(v)) {
return true;
}
if (/^\[\/.*\/\].+$/.test(v)) {
return true;
}
return /^[A-Za-z0-9]([... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isAdvancedUpstream 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#identifie... | private isAdvancedUpstream(value: string): boolean {
const v: string = value.trim();
if (v.length === 0) {
return false;
}
if (/^(udp|tcp|tls|https|h3|quic|sdns):\/\/\S+$/i.test(v)) {
return true;
}
if (/^\[\/.*\/\].+$/.test(v)) {
return true;
}
return /^[A-Za-z0-9]([... | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1216-L1228 | 1aa6edb3adbffc64ab8b1952906d357a68ca7fb8 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getGenres | 查询流派列表
@returns | public async getGenres(): Promise<Array<BaseItemDto>> {
return this.requireApi().getGenres(this.currentLibrary?.Id)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getGenres AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | public async getGenres(): Promise<Array<BaseItemDto>> {
return this.requireApi().getGenres(this.currentLibrary?.Id)
} | https://github.com/OHPG/FinMusic | b57ed5d2e75d4dff10092d3f16b01bfc5178e65d | github |
jiwangyihao/FlameChase | entry/src/main/ets/pages/ChroniclePage.ets | arkts | aboutToAppear | aboutToAppear 生命周期钩子,在组件即将显示时执行一次 | aboutToAppear() {
// 初始化时,根据当前日期设置显示的字符串
this.currentDate = this.getFormattedDate(this.displayDate);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 初始化时,根据当前日期设置显示的字符串
this.currentDate = this.getFormattedDate(this.displayDate);
} | https://github.com/jiwangyihao/FlameChase | 83551d7a609fc63026537c2595acc6abb275d42b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | map | Creates a new Uint8Array using fn(arr[i]) over all elements of current Uint8Array.
@param { function } fn - a function to apply for each element of current Uint8Array
@returns { Uint8Array } - a new Uint8Array,
where for each element from current Uint8Array fn was applied
@syscap SystemCapability.Utils.Lang
@FaAndStage... | public map(fn: (val: number, index: int, array: Uint8Array) => number): Uint8Array {
let resBuf = new ArrayBuffer(this.lengthInt * Uint8Array.BYTES_PER_ELEMENT)
let res = new Uint8Array(resBuf)
for (let i = 0; i < this.lengthInt; i++) {
res.set(i, fn(this.getUnsafe(i).toDouble(),... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: number, index: int, array: Uint8Array) => number): Uint8Array {
let resBuf = new ArrayBuffer(this.lengthInt * Uint8Array.BYTES_PER_ELEMENT)
let res = new Uint8Array(resBuf)
for (let i = 0; i < this.lengthInt; i++) {
res.set(i, fn(this.getUnsafe(i).toDouble(),... | https://gitcode.com/iop123123/arkts-static-skills | 49a778f0b123e0b21d44d3a4c5366d4655d5cc25 | gitcode |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getInputBackgroundColor | 获取输入框背景色 | static getInputBackgroundColor(): string {
return 'rgba(255, 255, 255, 0.4)';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInputBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left st... | static getInputBackgroundColor(): string {
return 'rgba(255, 255, 255, 0.4)';
} | https://github.com/chendi126/harmonyOS-TCP | be661ef5b17e5a1b043a617bf1e7b10c296931fc | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.