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 |
|---|---|---|---|---|---|---|---|---|---|---|
HarmonyCandies/image_cropper | image_cropper/src/main/ets/Utils.ets | arkts | isZero | 根据需要调整精度 | static isZero(value: number): boolean {
return Math.abs(value) < NumberUtils.precisionErrorTolerance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isZero AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | static isZero(value: number): boolean {
return Math.abs(value) < NumberUtils.precisionErrorTolerance;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/Utils.ets#L28-L30 | 7124c1b125239a7b0213c661bae2e2e3524ac0d0 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/config/RouteConfigManager.ets | arkts | getAllRoutes | 获取所有路由
@returns string[] | public getAllRoutes(): string[] {
return Array.from(this.routes);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllRoutes 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 string AS... | public getAllRoutes(): string[] {
return Array.from(this.routes);
} | https://github.com/LJ666-ui/harmony-health-care | 91d061d1a37b1ba04c1718da9ed9a76fd2bb5288 | github |
LZZLHY/hlib | entry/src/main/ets/storage/PreferencesStore.ets | arkts | init | 必须最早在 EntryAbility.onCreate 中调用一次 | static async init(context: common.Context): Promise<void> {
if (PreferencesStore.initialized) {
return;
}
try {
const settingsOptions: preferences.Options = { name: 'settings' };
const authOptions: preferences.Options = { name: 'auth' };
PreferencesStore.settings = await preference... | 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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async init(context: common.Context): Promise<void> {
if (PreferencesStore.initialized) {
return;
}
try {
const settingsOptions: preferences.Options = { name: 'settings' };
const authOptions: preferences.Options = { name: 'auth' };
PreferencesStore.settings = await preference... | https://github.com/LZZLHY/hlib | af9814ea31e943023972b791d265684a1e673029 | github |
HarmonyOS_Samples/Spatialization | products/entry/src/main/ets/util/MaterialUtil.ets | arkts | getMaterialModifier | [StartExclude immersive_menu]
[StartExclude immersive_dialog] | public static getMaterialModifier(options: ModifierOptions): CommonModifier {
if (deviceInfo.apiAvailable('26.0.0') && hdsMaterial.getSystemMaterialTypes().length > 0) {
const materialOptions: uiMaterial.ImmersiveOptions = {
style: uiMaterial.ImmersiveStyle.ULTRA_THIN,
interactive: true,
... | 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 getMaterialModifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#... | public static getMaterialModifier(options: ModifierOptions): CommonModifier {
if (deviceInfo.apiAvailable('26.0.0') && hdsMaterial.getSystemMaterialTypes().length > 0) {
const materialOptions: uiMaterial.ImmersiveOptions = {
style: uiMaterial.ImmersiveStyle.ULTRA_THIN,
interactive: true,
... | https://gitcode.com/HarmonyOS_Samples/Spatialization | 4af417ece5068c06a46b341eb17ac5759c6b1b55 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/basic/Hello.ets | arkts | hello | 定义普通函数 | hello(): string {
return `hello: ${this.name}`
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hello AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_block#... | hello(): string {
return `hello: ${this.name}`
} | https://github.com/webabcd/HarmonyDemo | ddfa3ff39745d6abb2a99193eb2b848cd857fece | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | findParentStartTag | 查找父元素开始标签位置 | private findParentStartTag(content: string, endIndex: number): number {
let depth = 0;
let i = endIndex - 1;
while (i >= 0) {
// 向前查找标签
let tagEnd = i;
while (tagEnd >= 0 && content[tagEnd] !== '>') tagEnd--;
if (tagEnd < 0) break;
let tagStart = tagEnd;
while (t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findParentStartTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private findParentStartTag(content: string, endIndex: number): number {
let depth = 0;
let i = endIndex - 1;
while (i >= 0) {
// 向前查找标签
let tagEnd = i;
while (tagEnd >= 0 && content[tagEnd] !== '>') tagEnd--;
if (tagEnd < 0) break;
let tagStart = tagEnd;
while (t... | https://github.com/DaLongZhuaZi/manxia | 1cb50b39d6132d65a37908208fd8916d176d30a6 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/CommandLine.ets | arkts | getOptionProperties | Retrieve the map of values associated to the option. This is convenient for options specifying Java properties like
<code>-Dparam1=value1
-Dparam2=value2</code>. The first argument of the option is the key, and the 2nd argument is the value. If the option
has only one argument ({@code -Dfoo}) it is considered as a bool... | public getOptionProperties(opt: string): Properties{
let props: Properties = new Properties();
for (let index = 0; index < this.options.length(); index++) {
let option: CliOption = this.options.get(index);
if (opt == (option.getOpt()) || opt == (option.getLongOpt())) {
let values: JList<st... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOptionProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left opt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public getOptionProperties(opt: string): Properties{
let props: Properties = new Properties();
for (let index = 0; index < this.options.length(); index++) {
let option: CliOption = this.options.get(index);
if (opt == (option.getOpt()) || opt == (option.getLongOpt())) {
let values: JList<st... | https://gitee.com/openharmony-sig/commons-cli.git | 636e6252120d8aab9bdfcd8bb479913cc774d64c | gitee |
openharmony/applications_contacts | entry/src/main/ets/util/StringFormatUtil.ets | arkts | getDayMessage | Obtain the description of the time within a day based on the hour.
@param {number} hour
@return {string} Time node | static getDayMessage(hour: number, minutes: string) :Resource|undefined{
if (hour >= 0 && hour < 5) {
return $r('app.string.time_early_morning', hour, minutes);
}
if (hour >= 5 && hour < 11) {
return $r('app.string.time_morning', hour, minutes);
}
if (hour >= 11 && hour < 13) {
r... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDayMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hour AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | static getDayMessage(hour: number, minutes: string) :Resource|undefined{
if (hour >= 0 && hour < 5) {
return $r('app.string.time_early_morning', hour, minutes);
}
if (hour >= 5 && hour < 11) {
return $r('app.string.time_morning', hour, minutes);
}
if (hour >= 11 && hour < 13) {
r... | https://gitee.com/openharmony/applications_contacts.git | a29c9c69e4b966cceca5d2694bdf6bdb691aa324 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/IntentClassifier.ets | arkts | getAgentIdsForIntent | 获取意图对应的智能体ID列表
@param intent 意图类型
@returns 智能体ID列表 | getAgentIdsForIntent(intent: IntentType): string[] {
const mapping: Record<IntentType, string[]> = {
[IntentType.SYMPTOM_CONSULTATION]: ['internal_medicine'],
[IntentType.MEDICATION_GUIDANCE]: ['internal_medicine', 'tcm'],
[IntentType.REHABILITATION_ADVICE]: ['rehab', 'nutrition'],
[Intent... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAgentIdsForIntent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left intent AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IntentType AST#identifier#Right A... | getAgentIdsForIntent(intent: IntentType): string[] {
const mapping: Record<IntentType, string[]> = {
[IntentType.SYMPTOM_CONSULTATION]: ['internal_medicine'],
[IntentType.MEDICATION_GUIDANCE]: ['internal_medicine', 'tcm'],
[IntentType.REHABILITATION_ADVICE]: ['rehab', 'nutrition'],
[Intent... | https://github.com/LJ666-ui/harmony-health-care | ef0bdd01b7ad4288921095b1093c56ceb32dc11c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | parseJsonElement | Parses a JSON string and returns a JsonElement.
@param {string} text - The JSON string to parse
@param {jsonx.ParseOptions} [options] - BigInt parsing options
@returns {JsonElement} The parsed JSON element
@throws {JsonParseError} If the JSON string is invalid
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageMode... | public static parseJsonElement(text: string, options?: jsonx.ParseOptions): jsonx.JsonElement {
return new UnifiedJsonParser(text, options).parse()
} | 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 parseJsonElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left :... | public static parseJsonElement(text: string, options?: jsonx.ParseOptions): jsonx.JsonElement {
return new UnifiedJsonParser(text, options).parse()
} | https://gitcode.com/iop123123/arkts-static-skills | b4722a83a12ce4396caa9bcc15cba14b3bb60d91 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/LimitLine.ets | arkts | getLimit | Returns the limit that is set for this line.
@return | public getLimit(): number {
return this.mLimit;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLimit 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... | public getLimit(): number {
return this.mLimit;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 232d0414689b6f7a98f9c7d07e6c5b49c033ee1a | gitee |
Vincent-Leon/zotero-harmony | entry/src/main/ets/components/PdfView.ets | arkts | parseAnnotationPayload | JSON shape sent by viewer.js's saveHighlight bridge call. Tolerates
missing `type` for old viewer revisions (defaults to highlight). | function parseAnnotationPayload(json: string): NewAnnotationPayload {
const root: Object = JSON.parse(json);
if (typeof root !== 'object') {
throw new Error('payload not an object');
}
const obj = root as Record<string, Object>;
const attachmentKey = obj['attachmentKey'];
const pageIndex = obj['pageInde... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseAnnotationPayload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | function parseAnnotationPayload(json: string): NewAnnotationPayload {
const root: Object = JSON.parse(json);
if (typeof root !== 'object') {
throw new Error('payload not an object');
}
const obj = root as Record<string, Object>;
const attachmentKey = obj['attachmentKey'];
const pageIndex = obj['pageInde... | https://github.com/Vincent-Leon/zotero-harmony | d55d29ee0f7dd968bfdbb66f7d04ddfa28ea91d8 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/RemoteKeyDispatcher.ets | arkts | sendVirtualKeyTap | 发送单键 down+up | sendVirtualKeyTap(loader: ExtensionLoader, sessionId: number,
keyCode: number, label: string): void {
try {
loader.sendKey(sessionId, keyCode, true);
loader.sendKey(sessionId, keyCode, false);
hilog.info(DOMAIN, TAG, 'key-tap: ' + label + ' code=' + keyCode.toString());
} catch (err) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendVirtualKeyTap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loader AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ExtensionLoader AST#identifier#Right... | sendVirtualKeyTap(loader: ExtensionLoader, sessionId: number,
keyCode: number, label: string): void {
try {
loader.sendKey(sessionId, keyCode, true);
loader.sendKey(sessionId, keyCode, false);
hilog.info(DOMAIN, TAG, 'key-tap: ' + label + ' code=' + keyCode.toString());
} catch (err) {
... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 8d96baaeb995754365f242888a654666dd70a4af | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readBool | Reads the next boolean. | readBool(): boolean {
return this.getInt8(this.mByteOffset++) !== 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_... | readBool(): boolean {
return this.getInt8(this.mByteOffset++) !== 0
} | https://gitee.com/openharmony-sig/flutter_engine.git | 861ea01f72a0a0f3a4176eb0977d34aa1347b3d5 | gitee |
arkui-x/samples | CodeLab/Cases/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets | arkts | getParams | 获取输入参数
@param name - tab项标题
@returns: 输入参数 | public getParams(name: string): ESObject {
return this.tabsInfo.get(name)?.params;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | public getParams(name: string): ESObject {
return this.tabsInfo.get(name)?.params;
} | https://gitcode.com/arkui-x/samples | 29a04153b812d66e758386406df2d68a26b92ab6 | gitcode |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | getFBDanmakuVisibility | @return �Ƿ���ʾ�ײ���Ļ | public getFBDanmakuVisibility(): boolean {
return this.FBDanmakuVisibility;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFBDanmakuVisibility 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 bo... | public getFBDanmakuVisibility(): boolean {
return this.FBDanmakuVisibility;
} | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | db6db74705aab2c251dbc6550c7dfd4a14713fc9 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | toString | toString
@param { double } d return the string value
@returns { String }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toString(d: double): String {
return Double.toString(d, 10);
} | 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 toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Righ... | public static toString(d: double): String {
return Double.toString(d, 10);
} | https://gitcode.com/iop123123/arkts-static-skills | 7faf5bf4a11e4e7d9d7ca60855c2182995c96444 | gitcode |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordCheck.ets | arkts | freezeView | When freezing time is greater than 0, start count down view.
@return : button visibility | freezeView() {
if (this.freezingTime <= 0) {
this.stopCountDown();
return;
}
this.freezingTimeForView = this.freezingTime / 1000;
LogUtil.info(this.TAG_PAGE + `freezeView freezingTimeForView = ${this.freezingTimeForView}`);
this.freezingTimeFlag = setTimeout(() => {
this.freezin... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left freezeView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | freezeView() {
if (this.freezingTime <= 0) {
this.stopCountDown();
return;
}
this.freezingTimeForView = this.freezingTime / 1000;
LogUtil.info(this.TAG_PAGE + `freezeView freezingTimeForView = ${this.freezingTimeForView}`);
this.freezingTimeFlag = setTimeout(() => {
this.freezin... | https://gitee.com/openharmony/applications_settings.git | 5c55688e16f44c380ce63d306c3eeceeb7ccbff3 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataInitializer.ets | arkts | clearAllData | 清除所有数据 | async clearAllData(): Promise<void> {
const records = await this.dataManager.getAllHealthRecords();
for (const record of records) {
await this.dataManager.deleteHealthRecord(record.id);
}
console.info('所有数据已清除');
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAllData 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 clearAllData(): Promise<void> {
const records = await this.dataManager.getAllHealthRecords();
for (const record of records) {
await this.dataManager.deleteHealthRecord(record.id);
}
console.info('所有数据已清除');
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | f06fc09820874246e572d15435face15a1c836ac | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | executeSql | 执行SQL语句 | public async executeSql(sql: string, args?: DatabaseValue[]): Promise<number> {
try {
const store = this.getStore();
const startTime = Date.now();
await store.executeSql(sql, args);
this.logSqlExecutionSuccess(sql, Date.now() - startTime);
// HarmonyOS的executeSql不返回影响行数,返回1表示执行成功
... | 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 executeSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sql AST#identifier#Right AST#:#Left : AST#:#R... | public async executeSql(sql: string, args?: DatabaseValue[]): Promise<number> {
try {
const store = this.getStore();
const startTime = Date.now();
await store.executeSql(sql, args);
this.logSqlExecutionSuccess(sql, Date.now() - startTime);
// HarmonyOS的executeSql不返回影响行数,返回1表示执行成功
... | https://github.com/DaLongZhuaZi/manxia | bccd9e292897f3a364f96cd996f0f33d89f5a2cd | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | resetState | 重置所有输入状态(串流停止时调用) | resetState(): void {
this.releaseAllKeys();
this.modifierFlags = 0;
this.lastEscUpTime = 0;
this.hasShownEscHint = false;
this.knownGamepadDeviceIds.clear();
this.stopMouseInterceptor();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | resetState(): void {
this.releaseAllKeys();
this.modifierFlags = 0;
this.lastEscUpTime = 0;
this.hasShownEscHint = false;
this.knownGamepadDeviceIds.clear();
this.stopMouseInterceptor();
} | https://github.com/AlkaidLab/moonlight-harmony | 0479948aa0d603a90d8271ad8e2d75d3d8e8aed7 | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootTokenInjection | 测试通道:当 want.parameters.bootToken 存在时,
直接把它写入 Preferences,使 WelcomePage 检测到 token 后跳过 LoginPage。
仅用于真机回归(aa start --PS bootToken xxxx),生产路径不会带该参数。 | private handleBootTokenInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_TOKEN];
if (typeof raw !== 'string') {
return;
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootTokenInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private handleBootTokenInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_TOKEN];
if (typeof raw !== 'string') {
return;
}... | https://github.com/CarGuo/GSYGithubAppOH | 59e8962da56fa042ed029080212c139382d7c0ed | github |
huangyuanlove/HelloArkUI | entry/src/main/ets/pages/flutter/FlutterEntryWithRouterPage.ets | arkts | onPageShow | Navigation的生命周期是onShown | onPageShow() {
Log.d("Flutter", "Index onPageShow===");
FlutterManager.getInstance().setUseFullScreen(true)
this.flutterEntry?.onPageShow()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
Log.d("Flutter", "Index onPageShow===");
FlutterManager.getInstance().setUseFullScreen(true)
this.flutterEntry?.onPageShow()
} | https://github.com/huangyuanlove/HelloArkUI | a03a7a4adc474689f149bc01ceccc6b2b5ccbf26 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/FolderUtil.ets | arkts | isBottomFixedFolder | Is folder bottom fixed
@param folderData - Folder
@return boolean - fottom fixed folder: deleted or favorite return true. else return false | isBottomFixedFolder(folderData: FolderData): boolean {
if (folderData === undefined || folderData === null) {
LogUtil.info(TAG, "isBottomFixedFolder folderData undefined")
}
if (folderData.uuid === undefined || folderData.uuid === null) {
LogUtil.info(TAG, "isBottomFixedFolder folderData uuid ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isBottomFixedFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left folderData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FolderData AST#identifier#Righ... | isBottomFixedFolder(folderData: FolderData): boolean {
if (folderData === undefined || folderData === null) {
LogUtil.info(TAG, "isBottomFixedFolder folderData undefined")
}
if (folderData.uuid === undefined || folderData.uuid === null) {
LogUtil.info(TAG, "isBottomFixedFolder folderData uuid ... | https://gitee.com/openharmony/applications_notes.git | 0954838224bec8384d2dfce04241467eb53faf55 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test29_original_index.ets | arkts | testFromCharCodeRange | --- String.fromCharCode range (build alphabet) --- | function testFromCharCodeRange(): string {
let result: string = '';
for (let i: number = 65; i <= 70; i++) {
result = result + String.fromCharCode(i);
}
return result;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFromCharCodeRange 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#prede... | function testFromCharCodeRange(): string {
let result: string = '';
for (let i: number = 65; i <= 70; i++) {
result = result + String.fromCharCode(i);
}
return result;
} | https://github.com/miaochiahao/ark-ghidra | 081767b20b1df1475931f9590bc59b7d23405ff6 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/TransactionOptions.ets | arkts | createDefault | 创建默认事务选项
@returns 默认事务选项实例 | static createDefault(): TransactionOptions {
return new TransactionOptions()
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefault 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 Transact... | static createDefault(): TransactionOptions {
return new TransactionOptions()
} | https://github.com/offlinecat-dev/OCNetORM | a0e56d87d2d58b55efe352e97dc1ea5652f23b89 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneStream.ets | arkts | isMicrophoneAvailable | 检查主机是否请求了麦克风 | isMicrophoneAvailable(): boolean {
return this.moonBridge.isMicrophoneRequested();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isMicrophoneAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right A... | isMicrophoneAvailable(): boolean {
return this.moonBridge.isMicrophoneRequested();
} | https://github.com/AlkaidLab/moonlight-harmony | ac964770bff049f01a33924b4c4f1defa0873638 | github |
eclipse-oniro4openharmony/f-oh | entry/src/main/ets/pages/Browser.ets | arkts | aboutToAppear | 执行其build()函数之前执行 | aboutToAppear() {
this.isLoading = true
try {
let deviceType = systemparameter.getSync("const.build.characteristics")
// 修改为:default 也认为是 phone
if (deviceType === 'phone' || deviceType === 'default') {
this.isPhone = true
}
} catch (e) {
hilog.info(0x0, '[Index]', `ge... | 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.isLoading = true
try {
let deviceType = systemparameter.getSync("const.build.characteristics")
// 修改为:default 也认为是 phone
if (deviceType === 'phone' || deviceType === 'default') {
this.isPhone = true
}
} catch (e) {
hilog.info(0x0, '[Index]', `ge... | https://github.com/eclipse-oniro4openharmony/f-oh | 497ca6302322f6753f76ee7243f9345d5de4e247 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/Topic.ets | arkts | fromJson | 从 JSON 解析 Topic | static fromJson(json: Record<string, Object>): Topic {
const topic = new Topic();
const idVal = json['id'];
topic.id = idVal !== undefined && idVal !== null ? idVal as number : 0;
const titleVal = json['title'];
topic.title = titleVal !== undefined && titleVal !== null ? titleVal as string : '';
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expressio... | static fromJson(json: Record<string, Object>): Topic {
const topic = new Topic();
const idVal = json['id'];
topic.id = idVal !== undefined && idVal !== null ? idVal as number : 0;
const titleVal = json['title'];
topic.title = titleVal !== undefined && titleVal !== null ? titleVal as string : '';
... | https://github.com/Amaz1ny/HarmonyDO-public | f5d1f7c4bc9596cf6a05990add65f192a5051a47 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock_realdata.ets | arkts | getPatient201 | 获取患者张三(ID:201)的真实信息 | public getPatient201(): WardPatientInfo {
return {
patientId: '201',
name: '张三*',
age: 65,
gender: 'male',
admissionDate: Date.now() - 2 * 24 * 3600 * 1000, // 2天前入院
diagnosis: '左膝关节骨性关节炎(KL III级)',
attendingDoctor: '王主任',
nurseName: '李护士',
riskLevel: PatientR... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPatient201 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 WardPati... | public getPatient201(): WardPatientInfo {
return {
patientId: '201',
name: '张三*',
age: 65,
gender: 'male',
admissionDate: Date.now() - 2 * 24 * 3600 * 1000, // 2天前入院
diagnosis: '左膝关节骨性关节炎(KL III级)',
attendingDoctor: '王主任',
nurseName: '李护士',
riskLevel: PatientR... | https://github.com/LJ666-ui/harmony-health-care | d6a1897779621ecfbc2b703f325edb1403b289db | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnInputViewModel.ets | arkts | setAlignRightValue | 设置右对齐输入框的内容
@param value 新的输入值 | setAlignRightValue(value: string): void {
this.alignRightValue = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAlignRightValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Le... | setAlignRightValue(value: string): void {
this.alignRightValue = value;
} | https://github.com/codelably/tuniao-ui | 8605cb402e570c5c85185272be3275cd5ec8c89f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | getControllerType | 获取控制器类型 (别名) | getControllerType(): number {
return this.type;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getControllerType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stat... | getControllerType(): number {
return this.type;
} | https://github.com/AlkaidLab/moonlight-harmony | 6370b420df1b9710bb0cebd9f6a8d53cda2cfea5 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/AuthService.ets | arkts | login | 用户登录
@param request 登录请求参数
@returns 登录响应 | static async login(request: UserLoginRequest): Promise<BaseResponse<LoginResponse>> {
const loginData = {
username: request.phone,
password: request.password
};
return await HttpUtil.post<LoginResponse>(`${this.BASE_URL}/login`, loginData, { skipAuth: true });
} | 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 login AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Ri... | static async login(request: UserLoginRequest): Promise<BaseResponse<LoginResponse>> {
const loginData = {
username: request.phone,
password: request.password
};
return await HttpUtil.post<LoginResponse>(`${this.BASE_URL}/login`, loginData, { skipAuth: true });
} | https://github.com/LJ666-ui/harmony-health-care | a5fd0fec957a9ea7ae2eb14c845efa0a6432c0b3 | github |
HarmonyOS_Samples/BestPracticeSnippets | ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets | arkts | splitArrayBuffer | [Start split_buffer1]
Split the picture pixel data ArrayBuffer according to the number of tasks N. | function splitArrayBuffer(buffer: ArrayBuffer, taskCount: number): ArrayBuffer[] {
const BYTES_PER_PIXEL = 4; // RGBA
const bytesPerTask = Math.floor(buffer.byteLength / taskCount / BYTES_PER_PIXEL) * BYTES_PER_PIXEL;
let result: ArrayBuffer[] = [];
for (let i = 0; i < taskCount; i++) {
if (i === taskCou... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left splitArrayBuffer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buffer AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function splitArrayBuffer(buffer: ArrayBuffer, taskCount: number): ArrayBuffer[] {
const BYTES_PER_PIXEL = 4; // RGBA
const bytesPerTask = Math.floor(buffer.byteLength / taskCount / BYTES_PER_PIXEL) * BYTES_PER_PIXEL;
let result: ArrayBuffer[] = [];
for (let i = 0; i < taskCount; i++) {
if (i === taskCou... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | dfd34317fe9acdc300372f93797bb5f3768eb312 | gitcode |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateReject | 拒绝反馈 — 两次尖锐振动,表示操作被拒绝或失败 | static vibrateReject(): void {
VibratorManager.logExecution('vibrateReject');
VibratorManager.vibratePreset(HapticEffect.SHARP, 2, 80, VibrationUsage.PHYSICAL_FEEDBACK);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateReject 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#expressi... | static vibrateReject(): void {
VibratorManager.logExecution('vibrateReject');
VibratorManager.vibratePreset(HapticEffect.SHARP, 2, 80, VibrationUsage.PHYSICAL_FEEDBACK);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | a70e37808eb9cca90cec02f54113003a7404556f | github |
holg/eulumdat-rs | EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets | arkts | heatmapSvg | Generate heatmap diagram SVG
@param width SVG width in pixels
@param height SVG height in pixels
@param theme Light or Dark theme
@returns SVG string | public heatmapSvg(width: number = 400, height: number = 300, theme: SvgTheme = SvgTheme.Light): string {
return eulumdat_napi.heatmapSvg(width, height, theme);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left heatmapSvg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio... | public heatmapSvg(width: number = 400, height: number = 300, theme: SvgTheme = SvgTheme.Light): string {
return eulumdat_napi.heatmapSvg(width, height, theme);
} | https://github.com/holg/eulumdat-rs | d4a5cf875f398da5a8a83bf0ec8e9f7c849da65d | github |
2763981847/Clock-Alarm | entry/src/main/ets/viewmodel/AlarmClockViewModel.ets | arkts | constructor | 构造函数,用于初始化成员变量 | private constructor() {
// 初始化闹钟项数组为空数组
this.alarms = new Array();
// 创建 ReminderService 实例
this.reminderService = new ReminderService();
// 打开通知权限
this.reminderService.openNotificationPermission();
// 禁用已过期的提醒
this.disableExpiredReminders();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#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 ... | private constructor() {
// 初始化闹钟项数组为空数组
this.alarms = new Array();
// 创建 ReminderService 实例
this.reminderService = new ReminderService();
// 打开通知权限
this.reminderService.openNotificationPermission();
// 禁用已过期的提醒
this.disableExpiredReminders();
} | https://github.com/2763981847/Clock-Alarm | 59aae4c7abd6b092940d4a4973de1b68feab2c73 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/view/AlgorithmDetailView.ets | arkts | assignViewData | 分配视图数据 | assignViewData() {
this.cardComponentDetailViewModel = ComponentDetailManager.getInstance().getDetailViewModel(this.componentName)
if (!this.cardComponentDetailViewModel) {
this.cardComponentDetailViewModel = new CardComponentDetailViewModel(this.componentName)
}
const range: ExpectedFrameRateRa... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left assignViewData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | assignViewData() {
this.cardComponentDetailViewModel = ComponentDetailManager.getInstance().getDetailViewModel(this.componentName)
if (!this.cardComponentDetailViewModel) {
this.cardComponentDetailViewModel = new CardComponentDetailViewModel(this.componentName)
}
const range: ExpectedFrameRateRa... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | bc4b4d2079dcb45ad31869f8d68870aaa5ed5136 | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | features/devpractices/src/main/ets/model/ImageModel.ets | arkts | onScale | Calculates the offset X and offset Y of the current picture and the scaling value of the current picture. | onScale(scale: number, offX: number, offY: number): void {
if (this.lastScale * scale > this.maxScale) {
this.curScale = this.maxScale;
} else if (this.lastScale * scale < this.minScale) {
this.curScale = this.minScale;
} else {
this.curScale = this.lastScale * scale;
}
if (this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#... | onScale(scale: number, offX: number, offY: number): void {
if (this.lastScale * scale > this.maxScale) {
this.curScale = this.maxScale;
} else if (this.lastScale * scale < this.minScale) {
this.curScale = this.minScale;
} else {
this.curScale = this.lastScale * scale;
}
if (this.... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 864a428c460752dee8d7b4684d8e1a93b51cb92c | gitcode |
nyzhhd/HMMusic | entry/src/main/ets/pages/Start.ets | arkts | aboutToAppear | 过3s后自动跳转到布局页,方法:计时3s | aboutToAppear(): void { //生命周期
setTimeout(() => {
this.pathStack.replacePathByName('Layout', null, false)
}, 3000) //以毫秒为单位
} | AST#program#Left AST#ERROR#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#ERROR#Right AST#expression_statement#Left AST#unary_expression#L... | aboutToAppear(): void { //生命周期
setTimeout(() => {
this.pathStack.replacePathByName('Layout', null, false)
}, 3000) //以毫秒为单位
} | https://github.com/nyzhhd/HMMusic | 24e887f22635b09e658b18d508b095416c2ffd85 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/SubtitleUtil.ets | arkts | normalizeSubtitleMode | 存储所有字幕项(已按开始时间排序) | static normalizeSubtitleMode(subtitleMode?: SubtitleMode): SubtitleMode {
return SubtitleUtil.normalizeEnum(subtitleMode,
[SubtitleMode.NONE, SubtitleMode.INNER_SUBTITLE, SubtitleMode.EXTERNAL_SUBTITLE, SubtitleMode.AI_SUBTITLE],
SubtitleMode.NONE)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left normalizeSubtitleMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left subtitleMode AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Rig... | static normalizeSubtitleMode(subtitleMode?: SubtitleMode): SubtitleMode {
return SubtitleUtil.normalizeEnum(subtitleMode,
[SubtitleMode.NONE, SubtitleMode.INNER_SUBTITLE, SubtitleMode.EXTERNAL_SUBTITLE, SubtitleMode.AI_SUBTITLE],
SubtitleMode.NONE)
} | https://github.com/Yebingiscn/SweetVideo | 976c38d4afdacdc3c4ef0db82af62ba22abaec1f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | searchWithError | 搜索书籍(带详细错误信息)
用于校验时获取详细的错误类型 | async searchWithError(
keyword: string,
page: number = 1,
parseOptions?: SearchParseOptions
): Promise<SearchResultWithError> {
if (!this.source.searchUrl) {
logger.warn(TAG, `[书源:${this.source.bookSourceName}] 没有配置搜索URL`);
return { books: [], errorType: SearchErrorType.NONE, errorMessag... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left searchWithError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right ... | async searchWithError(
keyword: string,
page: number = 1,
parseOptions?: SearchParseOptions
): Promise<SearchResultWithError> {
if (!this.source.searchUrl) {
logger.warn(TAG, `[书源:${this.source.bookSourceName}] 没有配置搜索URL`);
return { books: [], errorType: SearchErrorType.NONE, errorMessag... | https://github.com/DaLongZhuaZi/manxia | 65c44742558767a410b8e5214d8e0349d3209bd6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | handleWidgetRouter | 处理卡片router事件
根据卡片传递的targetPage参数设置AppStorage标记 | private handleWidgetRouter(want: Want): void {
try {
if (!want.parameters || !want.parameters['params']) {
return;
}
// 解析params参数
const paramsRaw = want.parameters['params'];
let params: Record<string, string> = {};
if (typeof paramsRaw === 'string') {
p... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleWidgetRouter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private handleWidgetRouter(want: Want): void {
try {
if (!want.parameters || !want.parameters['params']) {
return;
}
// 解析params参数
const paramsRaw = want.parameters['params'];
let params: Record<string, string> = {};
if (typeof paramsRaw === 'string') {
p... | https://github.com/DaLongZhuaZi/manxia | 72db0d7fa548eb9c8e4ad51f9679143b5686311d | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | greaterThan | Greater-than operator. | greaterThan(other: OffsetBase): boolean {
return this._dx > other._dx && this._dy > other._dy;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left greaterThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left OffsetBase AST#identifier#Right AST#)#Left ... | greaterThan(other: OffsetBase): boolean {
return this._dx > other._dx && this._dy > other._dy;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L38-L40 | f00869218c7b85e77eff9acf23bab91a2278ad98 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/AnalyticsService.ets | arkts | init | 从持久存储加载(幂等,EntryAbility 启动后也可重复调用) | static init(): void {
if (AnalyticsService.loaded) return;
AnalyticsService.loaded = true;
try {
const c = AppStorage.get<string>(COUNTS_KEY);
if (c) AnalyticsService.counts = JSON.parse(c) as Record<string, number>;
} catch (_e) {
AnalyticsService.counts = {};
}
try {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | static init(): void {
if (AnalyticsService.loaded) return;
AnalyticsService.loaded = true;
try {
const c = AppStorage.get<string>(COUNTS_KEY);
if (c) AnalyticsService.counts = JSON.parse(c) as Record<string, number>;
} catch (_e) {
AnalyticsService.counts = {};
}
try {
... | https://github.com/XJTUWYD/ArkDiff | 1cf0c6406977cde1a3dbaa1e5a71b2120cb8a71a | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets | arkts | generateNotificationId | 生成通知ID | private generateNotificationId(eventId: string): number {
let hash = 0;
for (let i = 0; i < eventId.length; i++) {
hash = ((hash << 5) - hash) + eventId.charCodeAt(i);
hash |= 0;
}
return Math.abs(hash) % 1000000;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateNotificationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | private generateNotificationId(eventId: string): number {
let hash = 0;
for (let i = 0; i < eventId.length; i++) {
hash = ((hash << 5) - hash) + eventId.charCodeAt(i);
hash |= 0;
}
return Math.abs(hash) % 1000000;
} | https://gitcode.com/openharmony/codelabs | 0514699743b2b5f1ae4c50e6263d027a9a7f47a7 | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | playNext | Loads the next queue index in linear order (wraps to 0 at end). | private playNext() {
const len = this.getQueueLength();
if (len === 0) {
return;
}
Logger.info(TAG, 'playNext Index:' + this.musicIndex + ', length-1:' + (len - 1));
if (this.musicIndex === len - 1) {
this.loadAsset(0);
} else {
this.loadAsset(this.musicIndex + 1);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left playNext 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... | private playNext() {
const len = this.getQueueLength();
if (len === 0) {
return;
}
Logger.info(TAG, 'playNext Index:' + this.musicIndex + ', length-1:' + (len - 1));
if (this.musicIndex === len - 1) {
this.loadAsset(0);
} else {
this.loadAsset(this.musicIndex + 1);
}
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | b3be9e593b1f38b3f02d2ccec28e8f1d1a974881 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | add | Performs floating point addition of this instance with provided one, returns the result as new instance
@param other Right hand side of the addition
@returns Result of the addition | public add(other: Float): Float {
return new Float((this.value + other.toFloat()) as float)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public add(other: Float): Float {
return new Float((this.value + other.toFloat()) as float)
} | https://gitcode.com/iop123123/arkts-static-skills | c17c1972a01654f7657fbc9d5ad11c86dff16c28 | gitcode |
XHXYT/Pixark | entry/src/main/ets/entryability/EntryAbility.ets | arkts | initWindowDimensions | 初始化窗口尺寸与断点计算 | private initWindowDimensions(windowClass: window.Window, UIContext: UIContext) {
try {
let properties = windowClass.getWindowProperties()
let rect = properties.windowRect
let WindowHeight = UIContext.px2vp(rect.height)
let WindowWidth = UIContext.px2vp(rect.width)
const widthBp: Widt... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initWindowDimensions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | private initWindowDimensions(windowClass: window.Window, UIContext: UIContext) {
try {
let properties = windowClass.getWindowProperties()
let rect = properties.windowRect
let WindowHeight = UIContext.px2vp(rect.height)
let WindowWidth = UIContext.px2vp(rect.width)
const widthBp: Widt... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L358-L379 | 420a3d84ce778c8e68e20969d0369e761a7ab3cb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | / === with element lambda functions ===
Finds the last element in the Float64Array that satisfies the condition
@param { function } fn - condition
@returns { number } - the last element that satisfies fn
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Float64Array) => boolean =
(val: number, index: int, array: Float64Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Float64Array) => boolean =
(val: number, index: int, array: Float64Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | https://gitcode.com/iop123123/arkts-static-skills | b1af6336d9556b96c7e5ba88dcf3be0c6041e86b | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | getAxisLeft | Returns the left y-axis object. In the horizontal bar-chart, this is the
top axis.
@return | public getAxisLeft(): YAxis | null {
return this.mAxisLeft;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAxisLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST... | public getAxisLeft(): YAxis | null {
return this.mAxisLeft;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1399a8ae6ce3863fb20a8211dc7191b6139b7faf | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/StoragePaths.ets | arkts | initPublicDirs | 初始化公共目录结构(应用启动时调用)
如果目录结构不符合预期,会删除并重建
@param context 可选,传入则尝试使用系统 Download 目录 | static async initPublicDirs(context?: common.UIAbilityContext): Promise<void> {
hilog.info(0x0000, 'STORAGE', '========== 开始初始化公共目录 ==========')
try {
let appDir: string
let usePublicDownload = false
// 如果有 context,尝试申请权限并使用系统 Download 目录
if (context) {
const hasPer... | 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 initPublicDirs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#Left ?... | static async initPublicDirs(context?: common.UIAbilityContext): Promise<void> {
hilog.info(0x0000, 'STORAGE', '========== 开始初始化公共目录 ==========')
try {
let appDir: string
let usePublicDownload = false
// 如果有 context,尝试申请权限并使用系统 Download 目录
if (context) {
const hasPer... | https://github.com/AetheriumSimulator/qemu-hmos | 2b89fa320981de1faca13e1068b4eef537170f10 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | toLocaleString | Converts Int8Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Int8Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Int8Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | acf999541e07ca3672edb60dc0e9e46442900a9d | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/TerminalManager.ets | arkts | navigateToPage | 导航到页面(带权限检查)
@param pageUrl 页面URL
@param params 参数(可选) | async navigateToPage(pageUrl: string, params?: Record<string, any>): Promise<boolean> {
// 检查权限
if (!this.canAccessPage(pageUrl)) {
console.error(`无权访问页面: ${pageUrl}`);
await this.showAccessDenied();
return false;
}
try {
await router.pushUrl({
url: pageUrl,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left navigateToPage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pageUrl AST#identifier#Right A... | async navigateToPage(pageUrl: string, params?: Record<string, any>): Promise<boolean> {
// 检查权限
if (!this.canAccessPage(pageUrl)) {
console.error(`无权访问页面: ${pageUrl}`);
await this.showAccessDenied();
return false;
}
try {
await router.pushUrl({
url: pageUrl,
... | https://github.com/LJ666-ui/harmony-health-care | 1af4c462736d546fef2c911e0a0f70f3fa922634 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/viewmodel/TrainsMapModel.ets | arkts | calcDistance | Calculate the distance traveled by a train for one lap. | calcDistance(data: Position[]): number {
let sumDistance: number = 0;
const length = data.length;
data.forEach((item: Position, index: number) => {
const startX = item.x;
const startY = item.y;
const endX = index === length - 1 ? data[0].x : data[index + 1].x;
const endY = index ==... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calcDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Position AST#... | calcDistance(data: Position[]): number {
let sumDistance: number = 0;
const length = data.length;
data.forEach((item: Position, index: number) => {
const startX = item.x;
const startY = item.y;
const endX = index === length - 1 ? data[0].x : data[index + 1].x;
const endY = index ==... | https://gitee.com/harmonyos/codelabs.git | 5a0d405906446ef03551d2cf3e56501e8aa22855 | gitee |
XJTUWYD/ArkDiff | entry/src/main/ets/engine/FilterRuleEngine.ets | arkts | filterLines | 对文本行应用过滤规则,返回过滤后的行列表
@param lines 原始行
@param config 过滤配置
@param diffTypes 可选 — 每行的差异类型(用于 contextLines 计算)
@returns 过滤后的行索引映射(新索引 → 原始索引) | static filterLines(
lines: string[],
config: FilterConfig,
diffTypes?: string[]
): number[] {
const indices: number[] = [];
// 第一步:计算仅差异模式下哪些行需要保留
let diffRowSet: Set<number> | null = null;
if (config.onlyShowDiff && diffTypes) {
diffRowSet = new Set<number>();
for (let i = ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left filterLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lines AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressio... | static filterLines(
lines: string[],
config: FilterConfig,
diffTypes?: string[]
): number[] {
const indices: number[] = [];
// 第一步:计算仅差异模式下哪些行需要保留
let diffRowSet: Set<number> | null = null;
if (config.onlyShowDiff && diffTypes) {
diffRowSet = new Set<number>();
for (let i = ... | https://github.com/XJTUWYD/ArkDiff | 47588f285fe5aac4f5c4e393b1f306f40eb666d2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint16Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = this.$_get(0).toDouble()
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint16Array) => number): number {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = this.$_get(0).toDouble()
... | https://gitcode.com/iop123123/arkts-static-skills | 0950b99cc5c7009dc87460ce9c37ca0925c6bbbb | gitcode |
somnio-software/my-bot-pal | entry/src/main/ets/utils/StringUtils.ets | arkts | getStringFromResource | Gets a string value from a resource
@param res Resource reference
@returns Promise that resolves to the string value | static getStringFromResource(context: Context, res: Resource): string {
try {
let systemResourceManager = context.resourceManager;
return systemResourceManager.getStringSync(res.id);
} catch (error) {
const businessError = error as BusinessError;
console.error(`Failed to load string re... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStringFromResource 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#identif... | static getStringFromResource(context: Context, res: Resource): string {
try {
let systemResourceManager = context.resourceManager;
return systemResourceManager.getStringSync(res.id);
} catch (error) {
const businessError = error as BusinessError;
console.error(`Failed to load string re... | https://github.com/somnio-software/my-bot-pal | 746128ba013e7bab1a2481e4224f6a1b2a6194ae | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/AnalyticsService.ets | arkts | captureException | 便捷:从异常对象捕获(自动提取 message) | static captureException(scope: string, e: Object): void {
let msg: string;
if (e instanceof Error) {
msg = e.message;
} else {
const rec = e as Record<string, Object>;
const m = rec['message'];
msg = m !== undefined ? String(m) : String(e);
}
AnalyticsService.captureError(s... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left captureException AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scope AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static captureException(scope: string, e: Object): void {
let msg: string;
if (e instanceof Error) {
msg = e.message;
} else {
const rec = e as Record<string, Object>;
const m = rec['message'];
msg = m !== undefined ? String(m) : String(e);
}
AnalyticsService.captureError(s... | https://github.com/XJTUWYD/ArkDiff | c6ea18a1755e492bede44d21c044d1a2a8cbb493 | github |
popsiclelmlm/Hey | entry/src/main/ets/core/SingboxConfig.ets | arkts | buildTls | ---- TLS / 传输转换 ---- | function buildTls(stream: JsonObject): SbTls | undefined {
const security = asString(stream['security']);
if (security === 'tls' || security === 'xtls') {
const tlsSettings = asObject(stream['tlsSettings']) ?? asObject(stream['xtlsSettings']) ?? {};
const tls: SbTls = { enabled: true };
const sni = asSt... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildTls AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stream AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function buildTls(stream: JsonObject): SbTls | undefined {
const security = asString(stream['security']);
if (security === 'tls' || security === 'xtls') {
const tlsSettings = asObject(stream['tlsSettings']) ?? asObject(stream['xtlsSettings']) ?? {};
const tls: SbTls = { enabled: true };
const sni = asSt... | https://github.com/popsiclelmlm/Hey | af8667af306d380530b20517768f69b9ed603de4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getNovelReadStatusText | 获取小说阅读状态文本 | private getNovelReadStatusText(status: NovelReadStatus): string {
switch (status) {
case NovelReadStatus.UNREAD:
return '未读';
case NovelReadStatus.READING:
return '阅读中';
case NovelReadStatus.FINISHED:
return '已完成';
default:
return '未读';
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNovelReadStatusText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private getNovelReadStatusText(status: NovelReadStatus): string {
switch (status) {
case NovelReadStatus.UNREAD:
return '未读';
case NovelReadStatus.READING:
return '阅读中';
case NovelReadStatus.FINISHED:
return '已完成';
default:
return '未读';
}
} | https://github.com/DaLongZhuaZi/manxia | 1c56809af055636231c30e0f8b6567c766c230f1 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnPickerViewModel.ets | arkts | onMultiObjConfirm | 多列对象数组选择器确认回调
@param values 各列选中值 | onMultiObjConfirm(values: Array<string | number>): void {
const labels: string[] = [];
for (let i = 0; i < values.length; i++) {
labels.push(String(values[i]));
}
this.multiObjLabel = labels.join(" - ");
this.multiObjOpen = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMultiObjConfirm 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#identifier#Left Ar... | onMultiObjConfirm(values: Array<string | number>): void {
const labels: string[] = [];
for (let i = 0; i < values.length; i++) {
labels.push(String(values[i]));
}
this.multiObjLabel = labels.join(" - ");
this.multiObjOpen = false;
} | https://github.com/codelably/tuniao-ui | 12ae06b68017d2137066b14ed131dd6d6b2bb983 | github |
Explore-In-HMOS-Wearable/currency-converter | entry/src/main/ets/viewmodel/CurrencyViewModel.ets | arkts | calculateConversion | Calculate conversion | calculateConversion(amount: string): string {
if (!amount || isNaN(parseFloat(amount))) {
return '0.00';
}
const rate = this._selectedTargetCurrency.rate / this._selectedBaseCurrency.rate;
const convertedAmount = parseFloat(amount) * rate;
return convertedAmount.toFixed(4);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateConversion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left amount AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#... | calculateConversion(amount: string): string {
if (!amount || isNaN(parseFloat(amount))) {
return '0.00';
}
const rate = this._selectedTargetCurrency.rate / this._selectedBaseCurrency.rate;
const convertedAmount = parseFloat(amount) * rate;
return convertedAmount.toFixed(4);
} | https://github.com/Explore-In-HMOS-Wearable/currency-converter | 41cdbe4818dae62c04f2ea5279f57c29d573a900 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/call/common/CallStore.ets | arkts | getDisplayName | 获取显示名称(优先备注 > 昵称 > ID) | getDisplayName(): string {
if (this.remark.length > 0) {
return this.remark;
} else if (this.name.length > 0) {
return this.name;
}
return this.id;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stateme... | getDisplayName(): string {
if (this.remark.length > 0) {
return this.remark;
} else if (this.name.length > 0) {
return this.name;
}
return this.id;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 6b9ee276494c60965ce73b588986f6d5d6ee4521 | github |
openharmony/applications_mms | entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets | arkts | autoHandleAutoRetrieveMmsValueChange | This method is used when the value of autoRetrieveMmsSwitch changes. | autoHandleAutoRetrieveMmsValueChange(newValue) {
HiLog.i(TAG, 'autoHandleAutoRetrieveMmsValueChange, newValue = ' + newValue);
let messageCode = common.route.MESSAGE_CODE_UPDATE_AUTO_RETRIEVE_MMS_VALUE;
let actionData: LooseObject = {};
actionData.intValue = newValue;
this.up... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left autoHandleAutoRetrieveMmsValueChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newValue AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;... | autoHandleAutoRetrieveMmsValueChange(newValue) {
HiLog.i(TAG, 'autoHandleAutoRetrieveMmsValueChange, newValue = ' + newValue);
let messageCode = common.route.MESSAGE_CODE_UPDATE_AUTO_RETRIEVE_MMS_VALUE;
let actionData: LooseObject = {};
actionData.intValue = newValue;
this.up... | https://gitee.com/openharmony/applications_mms.git | 5aa842d625056e02c6acf25d5e7f4f6ab5ec65ae | gitee |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | generateSmartTitle | 生成智能标题:按会话 ID 写回,避免切换会话后丢失生成结果。 | private async generateSmartTitle(
sessionId: string,
session: ChatSession,
retryCount: number = 0,
force: boolean = false
): Promise<void> {
let retryScheduled = false
this.notifyTitleGeneratingForSession(sessionId, true)
try {
const content = this.buildTitleConversationContent(se... | 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 generateSmartTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST... | private async generateSmartTitle(
sessionId: string,
session: ChatSession,
retryCount: number = 0,
force: boolean = false
): Promise<void> {
let retryScheduled = false
this.notifyTitleGeneratingForSession(sessionId, true)
try {
const content = this.buildTitleConversationContent(se... | https://github.com/LongLiveY96/chatcube | 337ebb494d729e871f2c950a05df2d6e998a5061 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | constructor | Creates a test suite instance.
@param {string} name The test suite name.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(name: string) {
this.name = name;
this.tests = new Array<ArkTestBase>();
} | 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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | constructor(name: string) {
this.name = name;
this.tests = new Array<ArkTestBase>();
} | https://gitcode.com/iop123123/arkts-static-skills | 986b1e6590e071358360d930b6e0f7dba7e5f7b8 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | buildBorderRow | Builds a border row for the table
@param {string} char - String to use for the border line
@param {string} commonConnector - Character for column separators
@param {string} connectorLeft - Character for left border
@param {string} connectorRight - Character for right border
@returns {string} Formatted border row
@priva... | private buildBorderRow(
ch: string,
commonConnector: string,
connectorLeft: string,
connectorRight: string,
): string {
const connLength: int =
this._indexColumnWidth -
connectorLeft.length.toInt() -
connectorRight.length.toInt();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildBorderRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private buildBorderRow(
ch: string,
commonConnector: string,
connectorLeft: string,
connectorRight: string,
): string {
const connLength: int =
this._indexColumnWidth -
connectorLeft.length.toInt() -
connectorRight.length.toInt();
... | https://gitcode.com/iop123123/arkts-static-skills | a0b356adabb77af59b279610ac2d591fe41a600d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/FTP/FTPNativeClient.ets | arkts | getCurrentPath | 获取当前路径 | getCurrentPath(): string {
return this.currentPath;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stateme... | getCurrentPath(): string {
return this.currentPath;
} | https://github.com/DaLongZhuaZi/manxia | 4a3c77d2436737da9a6fb4ab047d893b03424c53 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toString | Converts the primitive to a string
@param { byte } v value to be converted
@returns { string }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static toString(v: byte): string {
return StringBuilder.toString(v);
} | 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 toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Righ... | public static toString(v: byte): string {
return StringBuilder.toString(v);
} | https://gitcode.com/iop123123/arkts-static-skills | 7bf3f7f4fb243e4271405903d3102933fabf6279 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets | arkts | constructor | Create a Task instance
@param { string } name The name of task
@param { Function } func Concurrent function to execute in the taskpool
@param { ...Any } args arguments for function to execute with | constructor(name: string, func: Function, ...args: FixedArray<Any>) {
this.name = name;
this.arguments = Array.from(args);
if (isTaskpoolSupportInterop) {
let serializeHelper = new InteropSerializeHelper(args);
this.taskFunction = (): Any => {
... | 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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | constructor(name: string, func: Function, ...args: FixedArray<Any>) {
this.name = name;
this.arguments = Array.from(args);
if (isTaskpoolSupportInterop) {
let serializeHelper = new InteropSerializeHelper(args);
this.taskFunction = (): Any => {
... | https://gitcode.com/iop123123/arkts-static-skills | 212cff44cde7db33aa83408c69b71506c714a370 | gitcode |
Joker-x-dev/HarmonyKit | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | deleteById | 按主键删除 Demo 记录
@param {number} id - 记录主键
@returns {Promise<void>} Promise<void> | async deleteById(id: number): Promise<void> {
this.orm.deleteById(DemoEntity, id);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left ... | async deleteById(id: number): Promise<void> {
this.orm.deleteById(DemoEntity, id);
} | https://github.com/Joker-x-dev/HarmonyKit | 65934b9fb8a5faa266ee8206a9292f50f6dcdd97 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/UserProfileDAO.ets | arkts | updateAdviceAcceptanceRate | 更新建议接受率 | static async updateAdviceAcceptanceRate(userId: number, acceptanceRate: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const valueBucket: relationalStore.ValuesBucket = {
advice_acceptance_rate: acceptanceRate,
updated_at: new Date().toISOString()
... | 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 updateAdviceAcceptanceRate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right A... | static async updateAdviceAcceptanceRate(userId: number, acceptanceRate: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const valueBucket: relationalStore.ValuesBucket = {
advice_acceptance_rate: acceptanceRate,
updated_at: new Date().toISOString()
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 4ab1459eb73dfa192758bdd90696a9db4cc7832d | github |
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets | arkts | nativeSetWorker | Init main worker. | public static nativeSetWorker(): void {
tuanjie.nativeSetWorker();
} | 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 nativeSetWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public static nativeSetWorker(): void {
tuanjie.nativeSetWorker();
} | https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | 7ebe97feca7deb3662f425cb60b12b7759bd756f | github |
somnio-software/my-bot-pal | entry/src/main/ets/features/settings/datasource/DevicePermissionsDataSource.ets | arkts | getPermissionModels | Gets the permission models without checking their status
@returns List of permission models with default status (false) | getPermissionModels(): DevicePermissionModel[] {
return [
new DevicePermissionModel(
PERMISSION_MICROPHONE,
$r('app.string.permission_microphone'),
$r('app.string.permission_microphone_description'),
'ohos.permission.MICROPHONE',
false
),
new DevicePermiss... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPermissionModels 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 DevicePermissionModel AST#identifier#Right... | getPermissionModels(): DevicePermissionModel[] {
return [
new DevicePermissionModel(
PERMISSION_MICROPHONE,
$r('app.string.permission_microphone'),
$r('app.string.permission_microphone_description'),
'ohos.permission.MICROPHONE',
false
),
new DevicePermiss... | https://github.com/somnio-software/my-bot-pal | 3d1cf321556285f9a4a5f6a6b0844d21642ea225 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/UserAuthenticationDemo.ets | arkts | startUserAuth | UserAuthInstance - 用户认证器对象
userAuth.getUserAuthInstance() - 创建一个用户认证器对象
authParam - 认证参数(一个 AuthParam 对象)
challenge - 随机值,用于防止重放攻击
authType - 认证窗口需要提供的认证类型(UserAuthType 枚举)
PIN - 密码
FACE - 人脸
FINGERPRINT - 指纹
authTrustLevel - 认证等级(AuthTrustLevel 枚举)
ATL1 - 一般等级
ATL2 - 应用级
ATL3 - 设备级
ATL4 - 支付级
widgetParam - 认证窗口的界面参数(一... | startUserAuth() {
try {
const authParam: userAuth.AuthParam = {
challenge: cryptoFramework.createRandom().generateRandomSync(16).data,
authType: [userAuth.UserAuthType.PIN, userAuth.UserAuthType.FACE, userAuth.UserAuthType.FINGERPRINT],
authTrustLevel: userAuth.AuthTrustLevel.ATL4,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startUserAuth 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... | startUserAuth() {
try {
const authParam: userAuth.AuthParam = {
challenge: cryptoFramework.createRandom().generateRandomSync(16).data,
authType: [userAuth.UserAuthType.PIN, userAuth.UserAuthType.FACE, userAuth.UserAuthType.FINGERPRINT],
authTrustLevel: userAuth.AuthTrustLevel.ATL4,
... | https://github.com/webabcd/HarmonyDemo | 9df5f0cb894c663d01fadccca03c5c7c28f6fe29 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalWanDBViewModel.ets | arkts | fetchLocalLoginInfo | 获取本地登录用户数据
返回依次为:id,login_info,user_info,cookie,password,login_state .为空则是没有登录账户 | async fetchLocalLoginInfo(): Promise<[number, string, string, string, string, number] | null> {
if (this.isReady()) {
return this.wanUserModel.fetchLocalLoginInfo()
} else {
return new Promise((_resolve, reject) => {
reject(" WanDB is not ready!")
})
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchLocalLoginInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#... | async fetchLocalLoginInfo(): Promise<[number, string, string, string, string, number] | null> {
if (this.isReady()) {
return this.wanUserModel.fetchLocalLoginInfo()
} else {
return new Promise((_resolve, reject) => {
reject(" WanDB is not ready!")
})
}
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 021194739c630a38b3e1bd0aa113e01d83111761 | github |
honjow/Next2V | shared/src/main/ets/utils/FoldScreenUtil.ets | arkts | getStatusDescription | Get fold state description (for debugging) | getStatusDescription(): string {
const isFoldable = this.isFoldable()
const foldStatus = this.getFoldStatus()
const displayMode = this.getFoldDisplayMode()
let statusStr = ''
switch (foldStatus) {
case display.FoldStatus.FOLD_STATUS_UNKNOWN:
statusStr = 'unknown'
break
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatusDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#s... | getStatusDescription(): string {
const isFoldable = this.isFoldable()
const foldStatus = this.getFoldStatus()
const displayMode = this.getFoldDisplayMode()
let statusStr = ''
switch (foldStatus) {
case display.FoldStatus.FOLD_STATUS_UNKNOWN:
statusStr = 'unknown'
break
... | https://github.com/honjow/Next2V | 9b90d9ba992088bda2c7117fe3f15c2ae4e5f156 | github |
CLMC2025/Vignette | entry/src/main/ets/ui/Animations.ets | arkts | Pulse | 脉冲动画组件 | @Builder
function Pulse(
key: string,
duration: number = 1000,
progress: number
): void {
Column() {
// 内容直接嵌入
}
.scale({
x: 1 + Math.sin(progress * Math.PI * 2) * 0.1,
y: 1 + Math.sin(progress * Math.PI * 2) * 0.1
})
.animation({
duration: duration,
curve: Curve.EaseInOut,
itera... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left Pulse AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_pa... | @Builder
function Pulse(
key: string,
duration: number = 1000,
progress: number
): void {
Column() {
// 内容直接嵌入
}
.scale({
x: 1 + Math.sin(progress * Math.PI * 2) * 0.1,
y: 1 + Math.sin(progress * Math.PI * 2) * 0.1
})
.animation({
duration: duration,
curve: Curve.EaseInOut,
itera... | https://github.com/CLMC2025/Vignette | fc9dfd3911aef4206fd889fd0e2873e22f0eeae3 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | dismissGroup | 解散群聊
@param conversationId 会话ID | async dismissGroup(conversationId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/im/conversations/${conversationId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left dismissGroup AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AST#:... | async dismissGroup(conversationId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/im/conversations/${conversationId}`)
} | https://github.com/David8Idira/AI-OA | 32cdd1d4ad0f20d54a3b1180dd4dc413d98b8563 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/WatchHistoryManager.ets | arkts | removeWatchHistory | 删除单条历史记录 | async removeWatchHistory(historyId: string): Promise<void> {
try {
const prefs = this.getPreferences()
if (!prefs) return
const historyList = this.getAllWatchHistory()
const filteredList = historyList.filter(item => item.id !== historyId)
// 转换为普通对象保存
const historyDataList = ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeWatchHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left historyId AST#identifier#Right AST#type_annotation#Left AST#... | async removeWatchHistory(historyId: string): Promise<void> {
try {
const prefs = this.getPreferences()
if (!prefs) return
const historyList = this.getAllWatchHistory()
const filteredList = historyList.filter(item => item.id !== historyId)
// 转换为普通对象保存
const historyDataList = ... | https://github.com/SMAT-Lab/PhantomRendering | 4f5f5e7870cf3a56ddc7584537e62346288e10c6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets | arkts | destroy | 销毁管理器,清理所有资源 | async destroy(): Promise<void> {
if (this.isDestroyed) {
logger.warn(TAG, `[${this.pageId}] 重复调用 destroy()`);
return;
}
this.isDestroyed = true;
const startTime = Date.now();
logger.info(TAG, `[${this.pageId}] 开始清理资源...`);
// 1. 清理所有定时器
const timerCount = this.ti... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left destroy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#L... | async destroy(): Promise<void> {
if (this.isDestroyed) {
logger.warn(TAG, `[${this.pageId}] 重复调用 destroy()`);
return;
}
this.isDestroyed = true;
const startTime = Date.now();
logger.info(TAG, `[${this.pageId}] 开始清理资源...`);
// 1. 清理所有定时器
const timerCount = this.ti... | https://github.com/DaLongZhuaZi/manxia | bb198c4fd723d2402dfd84562f5acbdd2cdd69b7 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/ChatService.ets | arkts | init | 初始化聊天服务 | async init(userId: string, userRole: string): Promise<void> {
this.currentUserId = userId;
this.currentUserRole = userRole;
console.info('聊天服务初始化完成');
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId ... | async init(userId: string, userRole: string): Promise<void> {
this.currentUserId = userId;
this.currentUserRole = userRole;
console.info('聊天服务初始化完成');
} | https://github.com/LJ666-ui/harmony-health-care | f380cb10892be7777215b008024f7aa10e69bab0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | getCachedPixelMap | 从已有在线图片缓存读取 PixelMap,不触发新的网络请求。
调用方获得的是独立 PixelMap,使用完成后需要释放。 | public async getCachedPixelMap(url: string, options?: OnlineLoadOptions): Promise<image.PixelMap | null> {
try {
const effectiveOptions: OnlineLoadOptions = this.cloneLoadOptions(options);
const cacheKey = this.generateCacheKey(url, effectiveOptions);
const memoryCached = this.getFromCache(cache... | 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 getCachedPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : ... | public async getCachedPixelMap(url: string, options?: OnlineLoadOptions): Promise<image.PixelMap | null> {
try {
const effectiveOptions: OnlineLoadOptions = this.cloneLoadOptions(options);
const cacheKey = this.generateCacheKey(url, effectiveOptions);
const memoryCached = this.getFromCache(cache... | https://github.com/DaLongZhuaZi/manxia | f4e136173f7c115f16eebfc31ae8e1b3eb40fbee | github |
CLMC2025/Vignette | entry/src/main/ets/context/TemplateManager.ets | arkts | getExternalTemplateCount | How many external templates are currently loaded. | getExternalTemplateCount(): number {
let cnt = 0;
this.templates.forEach((templates: ContextTemplate[]) => {
for (const t of templates) {
if (t.id.startsWith(TemplateLoader.EXTERNAL_ID_PREFIX)) {
cnt++;
}
}
});
return cnt;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getExternalTemplateCount 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 A... | getExternalTemplateCount(): number {
let cnt = 0;
this.templates.forEach((templates: ContextTemplate[]) => {
for (const t of templates) {
if (t.id.startsWith(TemplateLoader.EXTERNAL_ID_PREFIX)) {
cnt++;
}
}
});
return cnt;
} | https://github.com/CLMC2025/Vignette | 468130b41ce1bce22a00ad9f893710a2b15e227a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | isInteger | Checks if double is similar to an integer value
@param { double } v the double to test
@returns { boolean } true if the argument is similar to an integer value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isInteger(v: double): boolean {
// In the language % works as C fmod that differs with IEEE-754 % definition
return (abs(v % (1.0 as double)) == 0.0);
} | 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 isInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Rig... | public static isInteger(v: double): boolean {
// In the language % works as C fmod that differs with IEEE-754 % definition
return (abs(v % (1.0 as double)) == 0.0);
} | https://gitcode.com/iop123123/arkts-static-skills | 8bb948abbe5826a5439ac86e7276c3cf30716c8e | gitcode |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | defineHttpMethod | Define HTTP method metadata for a method | static defineHttpMethod(method: string, path: string, target: Object, propertyKey: string | symbol): void {
this.defineMetadata('retrofit:httpMethod', method, target, propertyKey);
this.defineMetadata('retrofit:path', path, target, propertyKey);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left defineHttpMethod AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left method AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static defineHttpMethod(method: string, path: string, target: Object, propertyKey: string | symbol): void {
this.defineMetadata('retrofit:httpMethod', method, target, propertyKey);
this.defineMetadata('retrofit:path', path, target, propertyKey);
} | https://github.com/killetom/ktretrofit | e77ab735ec8da88195560f56d06bca2a43609b82 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/NotificationService.ets | arkts | getNotifications | 获取当前用户的通知列表
@param limit 数量限制 | static async getNotifications(limit: number = 50): Promise<Notification[]> {
const userId = await UserSessionService.getCurrentUserId();
if (!userId) {
return [];
}
return await NotificationDAO.getByUserId(userId, limit);
} | 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 getNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left :... | static async getNotifications(limit: number = 50): Promise<Notification[]> {
const userId = await UserSessionService.getCurrentUserId();
if (!userId) {
return [];
}
return await NotificationDAO.getByUserId(userId, limit);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | efa9f6d01cb5aff2e82fbce3fccb0f8105c9ce32 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/TrickPlayApi.ets | arkts | getTrickPlayTileImageUrl | getTrickPlayTileImageUrl
@summary Gets a trickplay tile image.
@param {TrickPlayApiGetTrickPlayTileImageRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof TrickPlayApi | public async getTrickPlayTileImageUrl(requestParameters: TrickPlayApiGetTrickPlayTileImageRequest): Promise<string> {
this.assertParam(requestParameters.itemId)
this.assertParam(requestParameters.width)
this.assertParam(requestParameters.index)
return this.apiClient.createUrl({ path: `/Videos/${reques... | 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 getTrickPlayTileImageUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifie... | public async getTrickPlayTileImageUrl(requestParameters: TrickPlayApiGetTrickPlayTileImageRequest): Promise<string> {
this.assertParam(requestParameters.itemId)
this.assertParam(requestParameters.width)
this.assertParam(requestParameters.index)
return this.apiClient.createUrl({ path: `/Videos/${reques... | https://github.com/OHPG/FinSdk | ca5857a7a642cf80845eae0e1c19dbf41226de5f | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | setFlip | Set flip.
@param isFlipHorizontal
@param isFlipVertically | setFlip(isFlipHorizontal: boolean, isFlipVertically: boolean) {
this.isFlipHorizontal = isFlipHorizontal;
this.isFlipVertically = isFlipVertically;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFlip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFlipHorizontal AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Righ... | setFlip(isFlipHorizontal: boolean, isFlipVertically: boolean) {
this.isFlipHorizontal = isFlipHorizontal;
this.isFlipVertically = isFlipVertically;
} | https://gitee.com/openharmony/codelabs.git | 7429876d115b177e906c8c7b31bd5dc0641ea04d | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseManager.ets | arkts | enableForeignKeys | 启用外键约束 | private static async enableForeignKeys(): Promise<void> {
try {
const store = DatabaseManager.getDatabase();
await store.executeSql('PRAGMA foreign_keys = ON');
console.log('[DatabaseManager] 外键约束已启用');
} catch (error) {
console.warn('[DatabaseManager] 启用外键约束失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left enableForeignKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arg... | private static async enableForeignKeys(): Promise<void> {
try {
const store = DatabaseManager.getDatabase();
await store.executeSql('PRAGMA foreign_keys = ON');
console.log('[DatabaseManager] 外键约束已启用');
} catch (error) {
console.warn('[DatabaseManager] 启用外键约束失败:', error);
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ebc491e868c44c23f2fea16e37b83b63dad28f1e | github |
dingzhilin1990/zhilinclaw | src/plugins/PluginManager.ets | arkts | enable | 启用插件
@param name 插件名称 | public async enable(name: string): Promise<void> {
const wrapper = this.plugins.get(name);
if (!wrapper) {
throw new Error(`插件不存在:${name}`);
}
if (wrapper.enabled) {
console.log(`[PluginManager] 插件已启用:${name}`);
return;
}
// 调用插件启用钩子
if (wrapper.plugin.onEnable) {
... | 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 enable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Righ... | public async enable(name: string): Promise<void> {
const wrapper = this.plugins.get(name);
if (!wrapper) {
throw new Error(`插件不存在:${name}`);
}
if (wrapper.enabled) {
console.log(`[PluginManager] 插件已启用:${name}`);
return;
}
// 调用插件启用钩子
if (wrapper.plugin.onEnable) {
... | https://github.com/dingzhilin1990/zhilinclaw | 2718ec8208131424b78f8ec146293c07eef4c126 | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | push | 页面跳转
@param name 页面路由名称 | public push(name: string) {
NavAnimationStore.getInstance().push(name)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left push AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:... | public push(name: string) {
NavAnimationStore.getInstance().push(name)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L130-L132 | 0c5c42339dd78bc75d151d48b6c823b00e8dea0d | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets | arkts | $_set | Sets the element at the specified index.
@param index - The index of the element to set.
@param val - The value to set at the specified index.
@throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}.
Received value is: ${index} | public $_set(index: int, val: T): void {
this.checkIndex(index);
this.buffer[this.getRealIndex(index)] = val;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public $_set(index: int, val: T): void {
this.checkIndex(index);
this.buffer[this.getRealIndex(index)] = val;
} | https://gitcode.com/iop123123/arkts-static-skills | 5909ab02ad81d0ecb50713d10d57acaef4ea19fc | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/StringBuilder.ets | arkts | constructor | Constructs a new builder instance with provided string
@param s string that will be used to initialize the builder | public constructor (s: String) {
let capacity = StringBuilder.newCapacity(16, s.length());
this.count = s.length();
this.value = new char[capacity];
for (let i = 0; i < this.count; ++i) {
this.value[i] = s.charAt(i);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String ... | public constructor (s: String) {
let capacity = StringBuilder.newCapacity(16, s.length());
this.count = s.length();
this.value = new char[capacity];
for (let i = 0; i < this.count; ++i) {
this.value[i] = s.charAt(i);
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e3fa0a4e02c9793c02e06db18d988a8b0069e1dd | gitee |
dingzhilin1990/zhilinclaw | src/security/CredentialVault.ets | arkts | rotate | 轮换凭证(生成新的凭证值)
@param id 凭证 ID
@param newValue 新凭证值 | public async rotate(id: string, newValue: string): Promise<boolean> {
const credential = this.credentials.get(id);
if (!credential) {
return false;
}
// 加密新值
credential.encryptedValue = await this.encrypt(newValue);
credential.createdAt = Date.now();
credential.usageCount = 0;
... | 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 rotate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right ... | public async rotate(id: string, newValue: string): Promise<boolean> {
const credential = this.credentials.get(id);
if (!credential) {
return false;
}
// 加密新值
credential.encryptedValue = await this.encrypt(newValue);
credential.createdAt = Date.now();
credential.usageCount = 0;
... | https://github.com/dingzhilin1990/zhilinclaw | 62ef486c36eac804fbb3b1efde4191a074133551 | github |
openharmony-sig/flutter_packages | packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerUtils.ets | arkts | needRequestCameraPermission | Camera permission need request if it present in manifest
<p>Camera permission may be used in another package, as example flutter_barcode_reader.
https://github.com/flutter/flutter/issues/29837
@param callback return true, if need request camera permission, otherwise false | public static needRequestCameraPermission(callback: AsyncCallback<boolean>): void {
return ImagePickerUtils.isPermissionPresentInManifest(CAMERA_PERMISSION, callback);
} | 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 needRequestCameraPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Rig... | public static needRequestCameraPermission(callback: AsyncCallback<boolean>): void {
return ImagePickerUtils.isPermissionPresentInManifest(CAMERA_PERMISSION, callback);
} | https://gitee.com/openharmony-sig/flutter_packages.git | 1bb5b403779751635e265be064331654d10221cf | gitee |
HarmonyOS_Samples/BestPracticeSnippets | AppFreeze/entry/src/main/ets/pages/appfreezecase.ets | arkts | getForeachKey | [Start appfreeze_advise2] | function getForeachKey(item : ItemType) : string {
// ...
return `${item.xxx2}${item.xxx2}...${item.themeStyle}`;
} // 这部分逻辑如果较为耗时,执行次数多,总时长就是发生冻屏的耗时操作 | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getForeachKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function getForeachKey(item : ItemType) : string {
// ...
return `${item.xxx2}${item.xxx2}...${item.themeStyle}`;
} // 这部分逻辑如果较为耗时,执行次数多,总时长就是发生冻屏的耗时操作 | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 017ccda7842f23634849c95d040236063372be87 | gitcode |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/AudioManager.ets | arkts | setPlaylist | 设置播放列表
@param playlist 播放列表
@param index 起始索引 | setPlaylist(playlist: SongInfo[], index: number = 0): void {
this.playlist = [...playlist];
this.currentIndex = index;
this.currentSong = playlist[index] || null;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left playlist AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left SongInfo A... | setPlaylist(playlist: SongInfo[], index: number = 0): void {
this.playlist = [...playlist];
this.currentIndex = index;
this.currentSong = playlist[index] || null;
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | dc55054966750328714cb19cfa76e00ad59f5612 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/TokenManager.ets | arkts | isDoctorLoggedIn | 判断医生是否已登录 | static isDoctorLoggedIn(): boolean {
const isLoggedIn = SettingsUtil.get('isLoggedInAsDoctor');
const token = SettingsUtil.get('doctorToken');
return isLoggedIn === true && token !== null && token !== '';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isDoctorLoggedIn 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 ... | static isDoctorLoggedIn(): boolean {
const isLoggedIn = SettingsUtil.get('isLoggedInAsDoctor');
const token = SettingsUtil.get('doctorToken');
return isLoggedIn === true && token !== null && token !== '';
} | https://github.com/LJ666-ui/harmony-health-care | f72102ec95faa64269d1f1553288ef263eff6e4b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.