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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | notifyDataChanged | Call this method to let the ChartData know that the underlying data has
changed. Calling this performs all necessary recalculations needed when
the contained data has changed. | public notifyDataChanged(): void {
this.calcMinMax();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyDataChanged 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#expr... | public notifyDataChanged(): void {
this.calcMinMax();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | bedb675ef4fb9e68654b0e0b33cab925789e94c2 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | constructor | Default constructor.Initializes Date instance with current time.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor() {
this.ms = Date.now();
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.ms = Date.now();
} | https://gitcode.com/iop123123/arkts-static-skills | 1d7e08a79328c7ae0ef858569844501abd55f474 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | from | Creates a new `Array` instance from characters of `String` and mapping function.
@param str source string to be converted to array of character's `String`
@param fn map function to call on every character of source string.
@returns `Array` intance constructed from characters of source `String` and given function. | public static from<U>(str: String, fn: (v: String, k: number) => U): Array<U> {
let strs = Array.charStrings(str);
let d: Array<String> = Array.from<String>(strs);
return d.map<U>(fn);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identif... | public static from<U>(str: String, fn: (v: String, k: number) => U): Array<U> {
let strs = Array.charStrings(str);
let d: Array<String> = Array.from<String>(strs);
return d.map<U>(fn);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4c90097aa4c5c17f77f9e924e6035fa5ddf79d79 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | clearSessionFromStorage | 清除持久化会话 | private static async clearSessionFromStorage(): Promise<void> {
try {
const prefs = await UserSessionService.initPreferences();
if (prefs) {
await prefs.delete('current_session');
await prefs.flush();
}
} catch (error) {
console.error('[UserSessionService] 清除会话失败:', err... | 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 clearSessionFromStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right A... | private static async clearSessionFromStorage(): Promise<void> {
try {
const prefs = await UserSessionService.initPreferences();
if (prefs) {
await prefs.delete('current_session');
await prefs.flush();
}
} catch (error) {
console.error('[UserSessionService] 清除会话失败:', err... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8cb8446f11888c8ce98cced633fb7868e29abd33 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from begin to end of Int8Array.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@returns { Int8Array }
@sy... | public copyWithin(target: int): Int8Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int): Int8Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 3d214c87651db3712f5408bef94be8ebe3c06207 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | isLogEnabled | Returns true if log-output is enabled for the chart, false if not.
@return | public isLogEnabled(): boolean {
return this.mLogEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLogEnabled 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#... | public isLogEnabled(): boolean {
return this.mLogEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e01405be237a07179c1a1e2b6cbf9383ee70e0e8 | gitee |
fbinba3955/Flymby | common/src/main/ets/utils/BrightnessUtil.ets | arkts | getPageBrightness | 获取页面缓存的亮度值
@param pageName 页面名称 | public static getPageBrightness(pageName: string): number {
return BrightnessUtil.brightnessMap.get(pageName) || BrightnessUtil.DEFAULT_BRIGHTNESS;
} | 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 getPageBrightness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageName AST#identifier#Right AST#ERROR#Left AST#:#L... | public static getPageBrightness(pageName: string): number {
return BrightnessUtil.brightnessMap.get(pageName) || BrightnessUtil.DEFAULT_BRIGHTNESS;
} | https://github.com/fbinba3955/Flymby | ff679b06f4fe83e5a9146d6a3edba919f4053e57 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/PermissionUtil.ets | arkts | reqPermissionsFromUser | 重新申请权限 | static reqPermissionsFromUser(permissions: Permissions[], context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let grantStatus: number[] = data.authResults
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left reqPermissionsFromUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permissions AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#su... | static reqPermissionsFromUser(permissions: Permissions[], context: common.UIAbilityContext): void {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager()
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
let grantStatus: number[] = data.authResults
... | https://github.com/Yebingiscn/SweetVideo | bf2a0d6089a5177ba9155b6c5f602af13ae47379 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | syncState | Synchronizes component state on behalf of a Surface.
Called by Surface.syncState(); not intended for external use. | public syncState(surfaceId: string, componentId: string, changeJson: string): void {
this._surfaceBridge.syncState(surfaceId, componentId, changeJson);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left syncState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | public syncState(surfaceId: string, componentId: string, changeJson: string): void {
this._surfaceBridge.syncState(surfaceId, componentId, changeJson);
} | https://github.com/AGenUI/AGenUI | 2686c75a631c2a5ef7539f11cb58bc6cc6291e35 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/EventEditPage.ets | arkts | build | 构建主界面 | build() {
NavDestination() {
Stack() {
Column() {
// 顶部标题栏
this.buildHeader()
// 主体内容
Scroll() {
Column({ space: 24 }) {
// 1. 标题输入
this.buildTitleInput()
// 2. 描述输入
this.buildDescriptionInp... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
NavDestination() {
Stack() {
Column() {
// 顶部标题栏
this.buildHeader()
// 主体内容
Scroll() {
Column({ space: 24 }) {
// 1. 标题输入
this.buildTitleInput()
// 2. 描述输入
this.buildDescriptionInp... | https://gitcode.com/openharmony/codelabs | 882a732c0bfc734bda22cc60f798bd3b08b6d4d1 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CategoryDAO.ets | arkts | bulkInsert | 批量插入分类 - 使用 DAOHelper 统一事务处理 | static async bulkInsert(categories: Category[]): Promise<void> {
if (categories.length === 0) {
return;
}
await DAOHelper.transaction(async () => {
const now = new Date().toISOString();
const store = DatabaseManager.getDatabase();
for (const category of categories) {
i... | 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 bulkInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async bulkInsert(categories: Category[]): Promise<void> {
if (categories.length === 0) {
return;
}
await DAOHelper.transaction(async () => {
const now = new Date().toISOString();
const store = DatabaseManager.getDatabase();
for (const category of categories) {
i... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 713f8be048ca100be5471f3c01827b8d24813a18 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_clearcoat.ets | arkts | setClearcoatRoughness | [End pbr_clearcoat_changeRoughnessTexture]
Adjust clearcoat roughness intensity
[Start pbr_clearcoat_setClearcoatRoughness] | setClearcoatRoughness(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).clearCoatRoughness.factor;
f.y = v / RESO;
(this.material as MetallicRoughnessMaterial).clearCoatRoughness.factor = f;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setClearcoatRoughness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#... | setClearcoatRoughness(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).clearCoatRoughness.factor;
f.y = v / RESO;
(this.material as MetallicRoughnessMaterial).clearCoatRoughness.factor = f;
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 247f7903fc2846451dacdc189570739c1e6d6374 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AdviceFeedback.ets | arkts | getDeviationRate | 计算建议偏差率 | getDeviationRate(): number {
if (this.suggestedBudget === 0) {
return 0;
}
return Math.abs(this.actualBudgetSet - this.suggestedBudget) / this.suggestedBudget;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDeviationRate 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#state... | getDeviationRate(): number {
if (this.suggestedBudget === 0) {
return 0;
}
return Math.abs(this.actualBudgetSet - this.suggestedBudget) / this.suggestedBudget;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e24f3731968791ebdc7d646ae81eef650beda67e | github |
CLMC2025/Vignette | entry/src/main/ets/sync/VersionControl.ets | arkts | updateTimestamp | 更新时间戳(不增加版本号)
注意:
1. 此方法仅更新内存中的时间戳,不负责持久化。
2. VersionControl 通常嵌入在导出数据中一起持久化。
3. 调用者需确保不存在并发修改(WebDavSyncManager 已通过 status 字段防止并发备份)。 | updateTimestamp(): void {
this.currentVersion.timestamp = Date.now();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl... | updateTimestamp(): void {
this.currentVersion.timestamp = Date.now();
} | https://github.com/CLMC2025/Vignette | c01efc676abeae80c1f8d2117c407e510de427f6 | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/permission/PermissionUtils.ets | arkts | requestAudioPermission | 申请录音权限
用法示例:PermissionUtils.requestAudioPermission() { granted => ... }
@param callback 权限申请结果回调 | public async requestAudioPermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = ["ohos.permission.MICROPHONE"];
await this.handlePermissionResult('录音权限', callback, permissions);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left requestAudioPermission AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#... | public async requestAudioPermission(callback: (granted: boolean) => void): Promise<void> {
const permissions: Permissions[] = ["ohos.permission.MICROPHONE"];
await this.handlePermissionResult('录音权限', callback, permissions);
} | https://github.com/Joker-x-dev/CoolMallArkTS | c45e91ed8fdb81c8f452bcc48531e971cdee1d60 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/MessageManager.ets | arkts | saveAllMessages | Save all messages. | private static async saveAllMessages(messages: IMessage[]): Promise<boolean> {
if (!MessageManager.dataPreferences) {
Logger.warn('MessageManager', 'Preferences not initialized');
return false;
}
try {
await MessageManager.dataPreferences.put(MessageManager.KEY_MESSAGES, JSON.stringify(... | 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 saveAllMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left... | private static async saveAllMessages(messages: IMessage[]): Promise<boolean> {
if (!MessageManager.dataPreferences) {
Logger.warn('MessageManager', 'Preferences not initialized');
return false;
}
try {
await MessageManager.dataPreferences.put(MessageManager.KEY_MESSAGES, JSON.stringify(... | https://github.com/Harrisonls2004/WaterFlow | 0efa0b6a1bd17963c5670ca6be78b0311b91922e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | getLoginInfo | 获取登录信息(对应Legado的getLoginInfo) | getLoginInfo(sourceId: string): string {
return this.loginInfoStore.get(sourceId) || '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoginInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#... | getLoginInfo(sourceId: string): string {
return this.loginInfoStore.get(sourceId) || '';
} | https://github.com/DaLongZhuaZi/manxia | 2ee95f5faf0330ea8686f83c0b70976e4612a09a | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/OrderRepository.ets | arkts | getOrderPage | 获取订单分页列表
@param params 分页查询参数
@returns 订单分页数据 | async getOrderPage(params: OrderPageRequest): Promise<NetworkResponse<NetworkPageData<Order>>> {
return this.networkDataSource.getOrderPage(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOrderPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async getOrderPage(params: OrderPageRequest): Promise<NetworkResponse<NetworkPageData<Order>>> {
return this.networkDataSource.getOrderPage(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | a424be1c075ca8b6f314b277b535830a9281a908 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets | arkts | extractCbzArchive | 解压CBZ漫画归档文件 | public async extractCbzArchive(cbzPath: string, extractDir?: string): Promise<ComicChapterInfo> {
try {
logger.info(TAG, `开始解压CBZ归档: ${cbzPath}`);
// 验证CBZ文件存在
if (!await this.sandboxManager.exists(cbzPath)) {
throw new Error(`CBZ文件不存在: ${cbzPath}`);
}
// 准备解压目录... | 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 extractCbzArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cbzPath AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async extractCbzArchive(cbzPath: string, extractDir?: string): Promise<ComicChapterInfo> {
try {
logger.info(TAG, `开始解压CBZ归档: ${cbzPath}`);
// 验证CBZ文件存在
if (!await this.sandboxManager.exists(cbzPath)) {
throw new Error(`CBZ文件不存在: ${cbzPath}`);
}
// 准备解压目录... | https://github.com/DaLongZhuaZi/manxia | c6fb60bf70354d905af5470ea1a5271ded32a4ff | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | calculateDirSize | 递归计算目录大小 | private async calculateDirSize(dirPath: string): Promise<DirectoryInfo> {
let totalSize = 0;
let totalCount = 0;
try {
const entries = SafeFileUtils.listFileSync(dirPath);
for (const entry of entries) {
const fullPath = `${dirPath}/${entry}`;
try {
const stat = S... | 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 calculateDirSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#L... | private async calculateDirSize(dirPath: string): Promise<DirectoryInfo> {
let totalSize = 0;
let totalCount = 0;
try {
const entries = SafeFileUtils.listFileSync(dirPath);
for (const entry of entries) {
const fullPath = `${dirPath}/${entry}`;
try {
const stat = S... | https://github.com/DaLongZhuaZi/manxia | 3e9dc083e573eb0ec24274b519460f7669ccd635 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | languageAbbr | Resolve a language tag name to its 2-letter code; '' if not a known language. | static languageAbbr(name: string): string {
const code: string | undefined = EhConstants.iso936().get(name.toLowerCase().trim())
return code !== undefined ? code : ''
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left languageAbbr 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 str... | static languageAbbr(name: string): string {
const code: string | undefined = EhConstants.iso936().get(name.toLowerCase().trim())
return code !== undefined ? code : ''
} | https://github.com/erosTeam/NextE | 6e9499818d1a44cc01a2f0b00f224352c9ea53c1 | github |
HarmonyOS_Samples/sample_in_harmonyos | features/devpractices/src/main/ets/model/ImageModel.ets | arkts | pinchGestureEnd | The Pinch gesture is recognized successfully, and the callback is triggered when the finger is lifted. | pinchGestureEnd(): void {
runWithAnimation(() => {
// When the scale is less than 1
if (this.curScale <= this.defaultScaleValue) {
this.pictureScaling(this.defaultScaleValue);
this.imageReset();
} else if (this.curScale >= this.maxScale) {
this.curScale -= 0.1;
th... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pinchGestureEnd 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... | pinchGestureEnd(): void {
runWithAnimation(() => {
// When the scale is less than 1
if (this.curScale <= this.defaultScaleValue) {
this.pictureScaling(this.defaultScaleValue);
this.imageReset();
} else if (this.curScale >= this.maxScale) {
this.curScale -= 0.1;
th... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 433924da6f70d7f4141054226c44454d113a2eb5 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | getPresetConfig | 获取预定义动画配置 | public getPresetConfig(preset: 'fast' | 'normal' | 'slow' | 'bounce'): AnimationConfig {
switch (preset) {
case 'fast':
return { type: AnimationType.FADE_IN, duration: 150, easing: AnimationEasing.EASE_OUT };
case 'normal':
return { type: AnimationType.FADE_IN, duration: 300, easing: A... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPresetConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left preset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_express... | public getPresetConfig(preset: 'fast' | 'normal' | 'slow' | 'bounce'): AnimationConfig {
switch (preset) {
case 'fast':
return { type: AnimationType.FADE_IN, duration: 150, easing: AnimationEasing.EASE_OUT };
case 'normal':
return { type: AnimationType.FADE_IN, duration: 300, easing: A... | https://github.com/DaLongZhuaZi/manxia | 05997b4f9eba742b3396492927d55bc0b5b35d1b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | set | Copies all elements of arr to the current BigInt64Array starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} | public set(arr: BigInt[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: long[]): size of arr is greater than BigInt64Array.length")
}
for (let i =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: BigInt[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: long[]): size of arr is greater than BigInt64Array.length")
}
for (let i =... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fafa3aa4e43f89e227961b9276f73879eb7452c5 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | openEBookDetail | 打开电子书详情页 | private openEBookDetail(ebook: EBook): void {
const pageType = PageSettingsHelper.getEBookDetailPageType();
const rawCoverPath = this.getEBookCoverPath(ebook);
const displayCoverPath = this.getValidEBookCoverPath(ebook);
const cachedCoverPath = rawCoverPath.length > 0
&& !this.isNetworkUrl(rawCo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openEBookDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private openEBookDetail(ebook: EBook): void {
const pageType = PageSettingsHelper.getEBookDetailPageType();
const rawCoverPath = this.getEBookCoverPath(ebook);
const displayCoverPath = this.getValidEBookCoverPath(ebook);
const cachedCoverPath = rawCoverPath.length > 0
&& !this.isNetworkUrl(rawCo... | https://github.com/DaLongZhuaZi/manxia | b184e5b24f7739e3176599f0c94e5d6558697aa7 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getWidgetType | 从Want中获取卡片类型名称 | function getWidgetType(want: Want): string {
const name = want.parameters?.['ohos.extra.param.key.form_name'] as string;
if (name === 'widget' || name === 'form') {
const identity = want.parameters?.['ohos.extra.param.key.form_identity'] as string;
if (identity && identity.includes('month')) {
return ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getWidgetType AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left want AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function getWidgetType(want: Want): string {
const name = want.parameters?.['ohos.extra.param.key.form_name'] as string;
if (name === 'widget' || name === 'form') {
const identity = want.parameters?.['ohos.extra.param.key.form_identity'] as string;
if (identity && identity.includes('month')) {
return ... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 9acb8d1f643ae20ffaab6d7b993119de18511dc1 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/MedicalImageUtils.ets | arkts | calculateAverageBrightness | 计算平均亮度
@param pixelMap 图像
@returns 平均亮度(0-1) | static async calculateAverageBrightness(pixelMap: image.PixelMap): Promise<number> {
try {
// 获取图像信息
const imageInfo = await pixelMap.getImageInfo();
const width = imageInfo.size.width;
const height = imageInfo.size.height;
// 读取像素数据
const pixelBytesNumber = pixelMap.getPixelB... | 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 calculateAverageBrightness AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#iden... | static async calculateAverageBrightness(pixelMap: image.PixelMap): Promise<number> {
try {
// 获取图像信息
const imageInfo = await pixelMap.getImageInfo();
const width = imageInfo.size.width;
const height = imageInfo.size.height;
// 读取像素数据
const pixelBytesNumber = pixelMap.getPixelB... | https://github.com/LJ666-ui/harmony-health-care | 19977ec24e5dc8b99c79152ca34fefee07fc385d | github |
RoooyHe/toona-ohos | toona/src/main/ets/services/MediaManager.ets | arkts | uploadAudio | ✅ 修复 2:音频同理 | async uploadAudio(data: ArrayBuffer, fileName: string): Promise<string> {
const response = await this.uploadMedia(data, 'audio/mp4', fileName); // 录音一般是 m4a/mp4
return response.content_uri;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left uploadAudio AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async uploadAudio(data: ArrayBuffer, fileName: string): Promise<string> {
const response = await this.uploadMedia(data, 'audio/mp4', fileName); // 录音一般是 m4a/mp4
return response.content_uri;
} | https://github.com/RoooyHe/toona-ohos | 084d4c990a21ba075c165b59e805b351500a3db4 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | togglePostReaction | 切换帖子回应(discourse-reactions 插件) | static togglePostReaction(postId: number, reactionId: string): string {
return `/discourse-reactions/posts/${postId}/custom-reactions/${encodeURIComponent(reactionId)}/toggle.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left togglePostReaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left postId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static togglePostReaction(postId: number, reactionId: string): string {
return `/discourse-reactions/posts/${postId}/custom-reactions/${encodeURIComponent(reactionId)}/toggle.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 05eec9fe72f66354e719a5e52b88ad08152c3b8a | github |
openharmony-sig/earth | hpauditor/tests/issues/expected/issue579.ets.audit.ets | arkts | fancyImage | this one should trigger | @Extend(Image) function fancyImage(isSync: boolean) {
.syncLoad(isSync)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Image AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#... | @Extend(Image) function fancyImage(isSync: boolean) {
.syncLoad(isSync)
} | https://gitee.com/openharmony-sig/earth.git | e4d34633cb12375d359fa3f40fd049e5d252bdee | gitee |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | getSelectedCarts | 获取选中的购物车项
@returns {Cart[]} 选中的购物车列表 | private getSelectedCarts(): Cart[] {
const result: Cart[] = [];
for (const cart of this.cartList) {
// 获取该商品下选中的规格
const selectedSpecs: CartGoodsSpec[] = [];
for (const spec of cart.spec) {
const key = `${cart.goodsId}_${spec.id}`;
if (this.selectedSpecIds.has(key)) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSelectedCarts 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 Ca... | private getSelectedCarts(): Cart[] {
const result: Cart[] = [];
for (const cart of this.cartList) {
// 获取该商品下选中的规格
const selectedSpecs: CartGoodsSpec[] = [];
for (const spec of cart.spec) {
const key = `${cart.goodsId}_${spec.id}`;
if (this.selectedSpecIds.has(key)) {
... | https://github.com/Joker-x-dev/CoolMallArkTS | c2934566e66bb96f65fa90c370d8e2eddb578759 | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/library/src/main/ets/HttpProxyCacheServer.ets | arkts | getProxyPort | 返回端口号 用于编写单元测试
@returns 端口号 | public getProxyPort(): number {
return this.port;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getProxyPort 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#nu... | public getProxyPort(): number {
return this.port;
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | e843809be89998dc1025ff32cd4811fe8ffab51f | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | ensureEpubExtracted | 对 EPUB 文件执行懒解压(不触发完整解析),返回解压根路径
供阅读器在 extractedRootPath 为空时按需调用 | public static async ensureEpubExtracted(filePath: string): Promise<string> {
if (!filePath || !filePath.toLowerCase().endsWith('.epub')) {
return '';
}
const parser = new ReaderKitEBookParser(filePath, EBookFormat.EPUB);
return parser.getExtractionRoot();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left ensureEpubExtracted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#... | public static async ensureEpubExtracted(filePath: string): Promise<string> {
if (!filePath || !filePath.toLowerCase().endsWith('.epub')) {
return '';
}
const parser = new ReaderKitEBookParser(filePath, EBookFormat.EPUB);
return parser.getExtractionRoot();
} | https://github.com/DaLongZhuaZi/manxia | 90934cf472a518b78647c2cc4cde741d81ad6da2 | github |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/database/EncryptedDB.ets | arkts | queryEvents | Query event logs from database and decrypt them | static queryEvents(
dbQuery: () => EncryptedEventLogRow[]
): PlainEventLog[] {
const rows: EncryptedEventLogRow[] = dbQuery()
const result: PlainEventLog[] = []
for (let i = 0; i < rows.length; i++) {
result.push(SecurityService.decryptLogFields(rows[i]))
}
return result
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left queryEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left dbQuery AST#identifier#Right AST#ERROR#Left AST#:#Left... | static queryEvents(
dbQuery: () => EncryptedEventLogRow[]
): PlainEventLog[] {
const rows: EncryptedEventLogRow[] = dbQuery()
const result: PlainEventLog[] = []
for (let i = 0; i < rows.length; i++) {
result.push(SecurityService.decryptLogFields(rows[i]))
}
return result
} | https://gitcode.com/openharmony/codelabs | f4e72703d643439023577b397bf029c10dfd9080 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | createAssociations | 创建词汇关联 | private createAssociations(
targetWord: string,
supportWords: string[],
strength: number
): WordAssociation[] {
const associations: WordAssociation[] = [];
for (const supportWord of supportWords) {
// 根据词汇关系确定关联类型
const associationType = this.determineAssociationType(targetWord, sup... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createAssociations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetWord AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | private createAssociations(
targetWord: string,
supportWords: string[],
strength: number
): WordAssociation[] {
const associations: WordAssociation[] = [];
for (const supportWord of supportWords) {
// 根据词汇关系确定关联类型
const associationType = this.determineAssociationType(targetWord, sup... | https://github.com/CLMC2025/Vignette | d6f113e1dfd550b26aa12826400e42be85d3b818 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | receiveCoupon | 领取优惠券
@param {Coupon} coupon - 优惠券
@returns {void} 无返回值 | receiveCoupon(coupon: Coupon): void {
if (!this.userState.isLoggedIn()) {
this.hideCouponModal();
AuthNavigator.toLogin();
return;
}
const request: ReceiveCouponRequest = new ReceiveCouponRequest();
request.couponId = coupon.id;
RequestHelper.repository<string>(this.couponReposi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left receiveCoupon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left coupon AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Coupon AST#identifier#Right AST#)#Left )... | receiveCoupon(coupon: Coupon): void {
if (!this.userState.isLoggedIn()) {
this.hideCouponModal();
AuthNavigator.toLogin();
return;
}
const request: ReceiveCouponRequest = new ReceiveCouponRequest();
request.couponId = coupon.id;
RequestHelper.repository<string>(this.couponReposi... | https://github.com/Joker-x-dev/CoolMallArkTS | 3decf9a80e869d34046f5af3496f5cfcb43d9116 | github |
Bistu-OSSDT-2024/16-ArkNotes | database/MemoTable.ets | arkts | deleteData | 删除数据的方法,接收单条memo笔记对象,和回调函数 | deleteData(memo: MemoModel, callback: Function) {
// 初始化操作数据库的谓词对象
let predicates = new relationalStore.RdbPredicates(CommonConstants.MEMO_TABLE.tableName);
// 配置谓词以匹配数据表的id列中值的字段,为笔记对象的id
predicates.equalTo('id', memo.id);
// 使用谓词执行memoTable的删除方法,透传回调函数
this.memoTable.deleteData(predicates, c... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left memo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MemoModel AST#identifier#Right... | deleteData(memo: MemoModel, callback: Function) {
// 初始化操作数据库的谓词对象
let predicates = new relationalStore.RdbPredicates(CommonConstants.MEMO_TABLE.tableName);
// 配置谓词以匹配数据表的id列中值的字段,为笔记对象的id
predicates.equalTo('id', memo.id);
// 使用谓词执行memoTable的删除方法,透传回调函数
this.memoTable.deleteData(predicates, c... | https://github.com/Bistu-OSSDT-2024/16-ArkNotes | 306d2dc181eae71e95799bbe7fa9a4d493e92c8f | github |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/utils/dateUtils.ets | arkts | toDate | 输入容错转换,将各种 DateLike 转为 Date 对象,失败返回 null
支持 Date/number/string/null/undefined | function toDate(input: DateLike): Date | null {
if (input === null || input === undefined) {
return null;
}
if (input instanceof Date) {
return isNaN(input.getTime()) ? null : input;
}
if (typeof input === 'number') {
const d: Date = new Date(input);
return isNaN(d.getTime()) ? null : d;
}
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left toDate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left input AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | function toDate(input: DateLike): Date | null {
if (input === null || input === undefined) {
return null;
}
if (input instanceof Date) {
return isNaN(input.getTime()) ? null : input;
}
if (typeof input === 'number') {
const d: Date = new Date(input);
return isNaN(d.getTime()) ? null : d;
}
... | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/utils/dateUtils.ets#L25-L41 | 433913f1c0f54f30988cb0b05f46e9b0dde31ba9 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | send_check_like | 7x8 喜欢状态广播 // | private send_check_like() {
try {
const path = this.play_list[this.play_list_index]
// 读取检查 //
const tmp = this.like_list.includes(`${fs.statSync(path).ino}`)
// 更新 //
this.is_like = tmp
// 广播 //
emitter.emit({ eventId: 718 }, { data: { like: tmp } })
emitter.em... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_check_like 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#{#L... | private send_check_like() {
try {
const path = this.play_list[this.play_list_index]
// 读取检查 //
const tmp = this.like_list.includes(`${fs.statSync(path).ino}`)
// 更新 //
this.is_like = tmp
// 广播 //
emitter.emit({ eventId: 718 }, { data: { like: tmp } })
emitter.em... | https://github.com/Nekofox-POT/LinMusic | c03ba0408c877d5e3537df5b6544da498f149a8b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | of | Returns a new array from a set of elements.
@returns { Uint8ClampedArray } - a new Uint8ClampedArray
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(): Uint8ClampedArray {
return new Uint8ClampedArray(0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | public static of(): Uint8ClampedArray {
return new Uint8ClampedArray(0)
} | https://gitcode.com/iop123123/arkts-static-skills | 08b1b1cccbeeac5ab745180175383ab92d469f21 | gitcode |
openharmony/codelabs | ETSUI/TransitionAnimation/entry/src/main/ets/pages/BottomTransition.ets | arkts | pageTransition | Page transition parameters are configured using the global pageTransition method.
SlideEffect.Bottom Slides in from the bottom of the screen when entering.
SlideEffect.Bottom slides out from the bottom of the screen when exiting. | pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.slide(SlideEffect.Bottom);
PageTransitionExit({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.slide(SlideEffect.Bottom);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pageTransition() {
PageTransitionEnter({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.slide(SlideEffect.Bottom);
PageTransitionExit({ duration: TRANSITION_ANIMATION_DURATION, curve: Curve.Smooth })
.slide(SlideEffect.Bottom);
} | https://gitee.com/openharmony/codelabs.git | a3e9d05fda0dfd52592dd6f747b67dc3949619ec | gitee |
gongshijier/harmonyLab | entry/src/main/ets/feed/load/db/DBHelper.ets | arkts | insert | insert item | insert() {
var u8 = new Uint8Array([1, 2, 3])
const valueBucket = { "name": "Tom", "age": 18, "salary": 100.5, "blobType": u8 }
let insertPromise = this.dbInstance.insert("test", valueBucket)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#variable_declaration#Left AST#... | insert() {
var u8 = new Uint8Array([1, 2, 3])
const valueBucket = { "name": "Tom", "age": 18, "salary": 100.5, "blobType": u8 }
let insertPromise = this.dbInstance.insert("test", valueBucket)
} | https://github.com/gongshijier/harmonyLab | 4bf243f3a70e12bcf5d7f7c4fa07a04b369777f6 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/XAxis.ets | arkts | getLabelRotationAngle | returns the angle for drawing the X axis labels (in degrees) | public getLabelRotationAngle(): number {
return this.mLabelRotationAngle;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLabelRotationAngle 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 numb... | public getLabelRotationAngle(): number {
return this.mLabelRotationAngle;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c6cf8d2dd09c6dc14285d340273752c34cde1541 | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | saveCurrentColumns | 保存当前数据库列信息
@param columns 列名数组 | async saveCurrentColumns(columns: string[]): Promise<void> {
try {
await this.dao.put(AppConstants.PREF_KEY_CURRENT_VERSION, JSON.stringify(columns));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to save current columns: ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveCurrentColumns AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left columns AST#identifier#Right AST#type_annotation#Left AST#:#... | async saveCurrentColumns(columns: string[]): Promise<void> {
try {
await this.dao.put(AppConstants.PREF_KEY_CURRENT_VERSION, JSON.stringify(columns));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to save current columns: ${JSON.stringify(err)}`);
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | 157853ec7dc0d26cc737d9677fdf04e7b661261e | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets | arkts | getVp | Obtains the screen horizontal adaptation vp.
@return number | static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left getVp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
} | https://gitee.com/harmonyos/codelabs.git | 98d39124bd08cbce365f1e6760ab826d2c546ef1 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/VNCNativeClient.ets | arkts | callVncMethod3 | 辅助函数:安全调用 VNC 方法(3个参数) | function callVncMethod3<T>(methodName: string, arg1: number, arg2: string, arg3: number): T | null {
try {
const api = qemu as QemuAPI
if (methodName === 'vncConnect' && api.vncConnect !== undefined) {
return api.vncConnect(arg1, arg2, arg3) as T
}
return null
} catch (e) {
hilog.error(0x0... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left callVncMethod3 AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#... | function callVncMethod3<T>(methodName: string, arg1: number, arg2: string, arg3: number): T | null {
try {
const api = qemu as QemuAPI
if (methodName === 'vncConnect' && api.vncConnect !== undefined) {
return api.vncConnect(arg1, arg2, arg3) as T
}
return null
} catch (e) {
hilog.error(0x0... | https://github.com/AetheriumSimulator/qemu-hmos | 410efa2171e2201ce458ee9319d3b641fb956208 | github |
apap6628114/nga_oh | entry/src/main/ets/common/utils/LinkUtils.ets | arkts | extractPath | 从 URL 中提取路径部分。
例:'https://nga.178.com/read.php?tid=1' → '/read.php' | function extractPath(url: string): string {
const start: number = url.indexOf('://') + 3
const pathStart: number = url.indexOf('/', start)
if (pathStart < 0) return '/'
const qsStart: number = url.indexOf('?', pathStart)
return qsStart >= 0 ? url.substring(pathStart, qsStart) : url.substring(pathStart)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractPath AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function extractPath(url: string): string {
const start: number = url.indexOf('://') + 3
const pathStart: number = url.indexOf('/', start)
if (pathStart < 0) return '/'
const qsStart: number = url.indexOf('?', pathStart)
return qsStart >= 0 ? url.substring(pathStart, qsStart) : url.substring(pathStart)
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/utils/LinkUtils.ets#L26-L32 | 143db7d050209c0a1c9cdc6875bab1e74a5ab5b2 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | find | Finds the first element in the Uint16Array that satisfies the condition
@param fn condition
@returns the first element that satisfies fn | public find(fn: (val: number, index: int) => boolean): number {
let newF: (val: number, index: int, array: Uint16Array) => boolean =
(val: number, index: int, array: Uint16Array): boolean => { return fn(val, index) }
return this.find(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public find(fn: (val: number, index: int) => boolean): number {
let newF: (val: number, index: int, array: Uint16Array) => boolean =
(val: number, index: int, array: Uint16Array): boolean => { return fn(val, index) }
return this.find(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 04f040b89f741e4f956f7b3e881946c6aa8e648d | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | insertEpisode | 插入Episode | async insertEpisode(episode: Episode): Promise<number> {
if (!this.rdbStore) return -1;
try {
const valueBucket: relationalStore.ValuesBucket = {
id: episode.id,
podcastId: episode.podcastId,
title: episode.title,
description: episode.description,
link: episode.l... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertEpisode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Le... | async insertEpisode(episode: Episode): Promise<number> {
if (!this.rdbStore) return -1;
try {
const valueBucket: relationalStore.ValuesBucket = {
id: episode.id,
podcastId: episode.podcastId,
title: episode.title,
description: episode.description,
link: episode.l... | https://github.com/pangpang20/antennaPodHM | d618e7d2cdc85124f21f40488ad954dbc98470e9 | github |
fa223797/Harmonyos-notebook | entry/src/main/ets/viewmodel/TaskModel.ets | arkts | updateTaskStatus | 用于根据当前任务时间,计算我们的任务状态(前提要先把日期统一格式) | updateTaskStatus(){
if (this.taskStatus === TaskStatusType.DONE) {
return; // 已手动标记为完成,不更新状态
}
//taskTime = 2024/05/17 如果是上面的格式就需要下面的转换,
//currentDate = 2024/05/17 得到的日期和上面对比
const currentDate = formateDate(new Date().getTime(),"yyyy-mm-dd")
//时间对比的方法,用taskTime任务日期和当前时间currentDate对比
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateTaskStatus 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#L... | updateTaskStatus(){
if (this.taskStatus === TaskStatusType.DONE) {
return; // 已手动标记为完成,不更新状态
}
//taskTime = 2024/05/17 如果是上面的格式就需要下面的转换,
//currentDate = 2024/05/17 得到的日期和上面对比
const currentDate = formateDate(new Date().getTime(),"yyyy-mm-dd")
//时间对比的方法,用taskTime任务日期和当前时间currentDate对比
... | https://github.com/fa223797/Harmonyos-notebook | 05d2af3b4c3e54a1a9995c77bfefa4e114e259c7 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/AudioService.ets | arkts | dispose | Release every preloaded player. Subsequent play() is a no-op. | async dispose(): Promise<void> {
this.disposed = true;
const releases: Promise<void>[] = [];
this.slots.forEach((slot: PlayerSlot): void => {
const player: media.AVPlayer | undefined = slot.player;
slot.player = undefined;
slot.ready = false;
slot.muted = true;
if (player !==... | 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 dispose AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right... | async dispose(): Promise<void> {
this.disposed = true;
const releases: Promise<void>[] = [];
this.slots.forEach((slot: PlayerSlot): void => {
const player: media.AVPlayer | undefined = slot.player;
slot.player = undefined;
slot.ready = false;
slot.muted = true;
if (player !==... | https://github.com/terryma2024/happyword | a8451ecd6fafd63d53a75a12e776b6754dd4e4ea | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/TouchPointerView.ets | arkts | setVisible | Set pointer visibility | setVisible(visible: boolean): void {
this.isVisible = visible;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setVisible AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left visible AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) ... | setVisible(visible: boolean): void {
this.isVisible = visible;
} | https://github.com/tangwengang-del/freerdp-harmonyos | c212a6e1ed33e989301357dfc3e8f3539950f945 | github |
Delsin-Yu/JustPDF | entry/src/main/ets/components/PageInfo.ets | arkts | getBestCachedScaleBelow | 取低于 targetScale 的已缓存档位中**质量最高**的一档,用于加载更高档时的占位。
避免同时存在预览与 4x 时误选最低档导致缩放瞬间画面变糊。 | private getBestCachedScaleBelow(targetScale: number): PageCache | undefined {
let bestScale: number | undefined = undefined;
let bestCache: PageCache | undefined = undefined;
for (const pair of this.caches.entries()) {
const scale = pair[0];
const cache = pair[1];
if (scale >= targetScal... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getBestCachedScaleBelow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetScale AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left nu... | private getBestCachedScaleBelow(targetScale: number): PageCache | undefined {
let bestScale: number | undefined = undefined;
let bestCache: PageCache | undefined = undefined;
for (const pair of this.caches.entries()) {
const scale = pair[0];
const cache = pair[1];
if (scale >= targetScal... | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L597-L612 | 24e515be81dc3dba1028fe48b24df5a3664a3359 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | getCrashLogFiles | 获取崩溃日志文件列表 | public async getCrashLogFiles(): Promise<string[]> {
const files: string[] = [];
try {
if (!this.logDirPath) {
return files;
}
const isExist = await fileIo.access(this.logDirPath);
if (!isExist) {
return files;
}
const dirFiles = fileIo.listFileSync(this.lo... | 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 getCrashLogFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public async getCrashLogFiles(): Promise<string[]> {
const files: string[] = [];
try {
if (!this.logDirPath) {
return files;
}
const isExist = await fileIo.access(this.logDirPath);
if (!isExist) {
return files;
}
const dirFiles = fileIo.listFileSync(this.lo... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L422-L447 | b31b331400f57e40f8f99cd1877db0569594afd7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/BackupPage.ets | arkts | disconnectFTP | FTP操作方法 | disconnectFTP(): void {
this.currentFTPConnection = null;
if (this.ftpClient) {
this.ftpClient.destroy();
this.ftpClient = null;
}
this.ftpConnected = false;
this.ftpFiles = [];
this.ftpCurrentPath = '/';
this.ftpTestResult = '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left disconnectFTP 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_bloc... | disconnectFTP(): void {
this.currentFTPConnection = null;
if (this.ftpClient) {
this.ftpClient.destroy();
this.ftpClient = null;
}
this.ftpConnected = false;
this.ftpFiles = [];
this.ftpCurrentPath = '/';
this.ftpTestResult = '';
} | https://github.com/DaLongZhuaZi/manxia | 811af882675522dbbdbbfa10240e7d9145ca331c | github |
bhengubv/aether-protocol | harmonyos/teal/entry/src/main/ets/service/NearLinkTransportService.ets | arkts | startAdvertising | ── PERIPHERAL ROLE: Advertising ───────────────────────────────────────── | async startAdvertising(): Promise<void> {
this.assertAvailable('startAdvertising');
if (this._advertisingHandle >= 0) {
return;
}
const settings: advertising.AdvertisingSettings = {
interval: 160,
power: 2
};
const advData: advertising.AdvertisingData = {
serviceUuids: ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startAdvertising AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Ri... | async startAdvertising(): Promise<void> {
this.assertAvailable('startAdvertising');
if (this._advertisingHandle >= 0) {
return;
}
const settings: advertising.AdvertisingSettings = {
interval: 160,
power: 2
};
const advData: advertising.AdvertisingData = {
serviceUuids: ... | https://github.com/bhengubv/aether-protocol | 3e5c88f43586d5531ad7e872b8a60f79aa906861 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/WebNode.ets | arkts | dispose | 解除当前builderNode与后端实体的引用关系 | dispose() {
if (this.builderNode) {
this.builderNode.dispose();
console.log(`[WebNode][dispose] OK!`);
} else {
console.warn(`[WebNode][dispose] Failed!`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dispose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left... | dispose() {
if (this.builderNode) {
this.builderNode.dispose();
console.log(`[WebNode][dispose] OK!`);
} else {
console.warn(`[WebNode][dispose] Failed!`);
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 0d82f128d261f33f1fadb4019d80fc6de34a1654 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/SystemBarDemo.ets | arkts | hideSystemBar | 隐藏顶部的系统状态栏和底部的系统导航栏 | hideSystemBar() {
this.windowClass.setWindowSystemBarEnable([]).then(() => {
this.message = '隐藏成功';
}).catch((err: BusinessError) => {
this.message =`隐藏失败, errCode:${err.code}, errMessage:${err.message}`;
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left hideSystemBar 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... | hideSystemBar() {
this.windowClass.setWindowSystemBarEnable([]).then(() => {
this.message = '隐藏成功';
}).catch((err: BusinessError) => {
this.message =`隐藏失败, errCode:${err.code}, errMessage:${err.message}`;
});
} | https://github.com/webabcd/HarmonyDemo | 19dba548450665aeedf1fcb92cefb42d52e0e971 | github |
2763981847/Clock-Alarm | entry/src/main/ets/viewmodel/AlarmClockViewModel.ets | arkts | getTaskTimeContent | 获取闹钟任务的时间内容。
@param hour number 小时
@param minute number 分钟
@return content string 时间内容字符串 | public getTaskTimeContent(hour: number, minute: number): string {
return (AlarmClockViewModel.fillZero(hour)
+ AlarmClockConstants.DEFAULT_STRING_COLON
+ AlarmClockViewModel.fillZero(minute));
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTaskTimeContent 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#Le... | public getTaskTimeContent(hour: number, minute: number): string {
return (AlarmClockViewModel.fillZero(hour)
+ AlarmClockConstants.DEFAULT_STRING_COLON
+ AlarmClockViewModel.fillZero(minute));
} | https://github.com/2763981847/Clock-Alarm | e48639f5be55d05c19436f6c209001311bcdd398 | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/FootprintViewModel.ets | arkts | shouldShowClearAction | 是否显示清空操作
@returns {boolean} 是否显示 | shouldShowClearAction(): boolean {
return this.footprints.length > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldShowClearAction 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... | shouldShowClearAction(): boolean {
return this.footprints.length > 0;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 220d34b229f59e9b58ae03e2c9347ced5f2abf1f | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/AudioCapturerManager.ets | arkts | stopRenderer | 停止播放录音 | async stopRenderer() {
// 获取音频渲染器(播放器)
const audioRenderer = await this.getAudioRenderer()
// RUNNING 和 PAUSED 状态下才能 stop,stop 后自动 release 释放资源(硬件)
if ([audio.AudioState.STATE_RUNNING, audio.AudioState.STATE_PAUSED].includes(this.audioRenderer!.state)) {
await audioRenderer.stop() // 停止渲染(播放)
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stopRenderer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#R... | async stopRenderer() {
// 获取音频渲染器(播放器)
const audioRenderer = await this.getAudioRenderer()
// RUNNING 和 PAUSED 状态下才能 stop,stop 后自动 release 释放资源(硬件)
if ([audio.AudioState.STATE_RUNNING, audio.AudioState.STATE_PAUSED].includes(this.audioRenderer!.state)) {
await audioRenderer.stop() // 停止渲染(播放)
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 783fb6c4def848b81c9276c893c73173e50d612e | gitcode |
kumaleap/ArkLuban | library/src/main/ets/luban/LogUtil.ets | arkts | init | 是否显示打印日志
初始化日志参数(该方法建议在Ability里调用)
@param domain
@param tag
@param showLog | static init(domain: number = LOGGER_DOMAIN, tag: string = LOGGER_TAG, showLog: boolean = true) {
LogUtil.domain = domain
LogUtil.tag = tag
LogUtil.showLog = showLog
} | AST#program#Left AST#expression_statement#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#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST... | static init(domain: number = LOGGER_DOMAIN, tag: string = LOGGER_TAG, showLog: boolean = true) {
LogUtil.domain = domain
LogUtil.tag = tag
LogUtil.showLog = showLog
} | https://github.com/kumaleap/ArkLuban | e7cb96775f07354670a79141c739b396a6ad282e | github |
LZZLHY/hlib | entry/src/main/ets/utils/Redact.ets | arkts | headers | 脱敏 headers:返回新对象,敏感头的值替换为 ***。
入参用 Object 以兼容 http 响应头(值可能是 string 或 string[])。 | static headers(h: Object | null | undefined): Record<string, string> {
const out: Record<string, string> = {};
if (h === null || h === undefined) {
return out;
}
const obj: Record<string, string | string[]> = h as Record<string, string | string[]>;
const keys: string[] = Object.keys(obj);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left headers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left h AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#... | static headers(h: Object | null | undefined): Record<string, string> {
const out: Record<string, string> = {};
if (h === null || h === undefined) {
return out;
}
const obj: Record<string, string | string[]> = h as Record<string, string | string[]>;
const keys: string[] = Object.keys(obj);
... | https://github.com/LZZLHY/hlib | b27a14d32fb0aa6ac9e1c9a881b8926ccb13ca5e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | getUTCFullYear | Returns the year of the specified date according to local time.
For dates between the years 1000 and 9999, `getUTCFullYear()` returns a four-digit number,
for example, 1995. Use this function to make sure a year is compliant with years after 2000.
@returns { int } get the UTCYear
@syscap SystemCapability.Utils.Lang
@Fa... | public getUTCFullYear(): int {
return ecmaYearFromTime(this.ms);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCFullYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST... | public getUTCFullYear(): int {
return ecmaYearFromTime(this.ms);
} | https://gitcode.com/iop123123/arkts-static-skills | b97bae48d33212c1daa00745d61588ebae578031 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/iconmaincolor/src/main/ets/components/mainpage/MainPage.ets | arkts | mockData | 添加模拟数据 | mockData() {
const huaweiCloud: AppInfo = new AppInfo('icon_main_color_ic_public_game2.png', '云空间', '云存储');
const huaweiEmail: AppInfo = new AppInfo('icon_main_color_ic_public_game3.png', '邮箱', '邮箱管理');
const huaweiHealth: AppInfo = new AppInfo('icon_main_color_ic_public_app3.png', '运动健康', '运动健康管家');
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mockData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST... | mockData() {
const huaweiCloud: AppInfo = new AppInfo('icon_main_color_ic_public_game2.png', '云空间', '云存储');
const huaweiEmail: AppInfo = new AppInfo('icon_main_color_ic_public_game3.png', '邮箱', '邮箱管理');
const huaweiHealth: AppInfo = new AppInfo('icon_main_color_ic_public_app3.png', '运动健康', '运动健康管家');
... | https://gitcode.com/arkui-x/samples | 776627e4cb0f203dddb00a8b73eb462c2329b30b | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/DownloadDirManager.ets | arkts | initDownloadDirectory | 初始化下载目录(首次使用时调用)
使用 DOWNLOAD 模式获取 Download/{bundleName}/ 目录 | public async initDownloadDirectory(): Promise<string> {
if (this.downloadDirPath) {
console.info(`${TAG} Download directory already initialized: ${this.downloadDirPath}`);
return this.downloadDirPath;
}
if (!this.context) {
console.error(`${TAG} Context not initialized`);
return '... | 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 initDownloadDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public async initDownloadDirectory(): Promise<string> {
if (this.downloadDirPath) {
console.info(`${TAG} Download directory already initialized: ${this.downloadDirPath}`);
return this.downloadDirPath;
}
if (!this.context) {
console.error(`${TAG} Context not initialized`);
return '... | https://github.com/richshaw2015/nds | d7cc5949d1078c68785812f731801b607a778118 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/NdsRomCache.ets | arkts | notifyCacheChanged | 通知缓存变化 | private notifyCacheChanged(): void {
for (const listener of this.cacheChangeListeners) {
try {
listener();
} catch (err) {
hilog.error(DOMAIN, TAG, 'Cache change listener error: %{public}s', (err as Error).message);
}
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyCacheChanged 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#... | private notifyCacheChanged(): void {
for (const listener of this.cacheChangeListeners) {
try {
listener();
} catch (err) {
hilog.error(DOMAIN, TAG, 'Cache change listener error: %{public}s', (err as Error).message);
}
}
} | https://github.com/richshaw2015/nds | cbd3b759546e96f72f98ee8a63208602d473db83 | github |
arkui-x/samples | CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets | arkts | getAddressData | 获取rawfile下指定json文件的数据
@returns 返回省数据的数组 | getAddressData(): Array<Province> {
// TODO 知识点:使用getRawFileContentSync从rawfile目录下读取省市区json文件数据,使用util.TextDecoder进行解码。
// 从rawfile本地json文件中获取数据
const value = getContext().resourceManager.getRawFileContentSync(this.jsonFileDir);
// 解码为utf-8格式
const textDecoder = util.TextDecoder.create('utf-8', { ... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAddressData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array... | getAddressData(): Array<Province> {
// TODO 知识点:使用getRawFileContentSync从rawfile目录下读取省市区json文件数据,使用util.TextDecoder进行解码。
// 从rawfile本地json文件中获取数据
const value = getContext().resourceManager.getRawFileContentSync(this.jsonFileDir);
// 解码为utf-8格式
const textDecoder = util.TextDecoder.create('utf-8', { ... | https://gitcode.com/arkui-x/samples | cf0e09f22748fe4afbb4f9e952651363c42d33f5 | gitcode |
codelably/HCompass | core/network/src/main/ets/DefaultResponseParser.ets | arkts | isSuccess | 判断响应是否成功
@param response 原始响应数据
@returns 是否成功 | isSuccess(response: Unknown): boolean {
if (!response || typeof response !== 'object') {
return false;
}
const code = this.getCode(response);
return code === this.config.successCode;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Unknown AST#identifier#Right AST#ERROR#Right AST#)#Left ) ... | isSuccess(response: Unknown): boolean {
if (!response || typeof response !== 'object') {
return false;
}
const code = this.getCode(response);
return code === this.config.successCode;
} | https://github.com/codelably/HCompass | b5fa8fdb4b07155d543dc74caf2714f7500c51e6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/customkey/CustomKeyStore.ets | arkts | getKeys | ── 按键管理 ──
获取当前配置的所有按键 | static async getKeys(): Promise<CustomKeyDef[]> {
const profile = await CustomKeyStore.getActiveProfile();
return profile.keys;
} | 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 getKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | static async getKeys(): Promise<CustomKeyDef[]> {
const profile = await CustomKeyStore.getActiveProfile();
return profile.keys;
} | https://github.com/AlkaidLab/moonlight-harmony | 3e1dcb738b64ff25e9c399575460e55a133ddeee | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | backupData | ==================== 数据备份与恢复 ====================
备份数据 | public async backupData(): Promise<string> {
try {
const backupDir = `${this.sandboxManager.getDirectory('database')}/backups`;
const backupFileName = `backup_${TimeUtils.toISOString(Date.now()).replace(/[:.]/g, '-')}.db`;
const backupPath = `${backupDir}/${backupFileName}`;
// 创建备份目录
... | 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 backupData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef... | public async backupData(): Promise<string> {
try {
const backupDir = `${this.sandboxManager.getDirectory('database')}/backups`;
const backupFileName = `backup_${TimeUtils.toISOString(Date.now()).replace(/[:.]/g, '-')}.db`;
const backupPath = `${backupDir}/${backupFileName}`;
// 创建备份目录
... | https://github.com/DaLongZhuaZi/manxia | 8fb807040ccb7d955bb60db8eba109c0d3d59746 | github |
cduestc-course/ArkLearn | entry/src/main/ets/pages/05/5.3.2re.ets | arkts | commonStyles | 1. 全局定义 | @Styles function commonStyles () {
.width(100)
.height(100)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Styles AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left commonStyles AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Lef... | @Styles function commonStyles () {
.width(100)
.height(100)
} | https://github.com/cduestc-course/ArkLearn | b95d9488c7dffc51008ae445c9a17a5bcae4f9af | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/components/MusicPlayerInfoComp.ets | arkts | navigationAnimation | 隐藏navigation导航栏,设置为全屏。 | navigationAnimation(isFullScreen: boolean): void {
animateTo({
duration: CommonConstants.MUSIC_DURATION,
curve: Curve.EaseInOut,
}, () => {
this.isFullScreen = isFullScreen;
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigationAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFullScreen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)... | navigationAnimation(isFullScreen: boolean): void {
animateTo({
duration: CommonConstants.MUSIC_DURATION,
curve: Curve.EaseInOut,
}, () => {
this.isFullScreen = isFullScreen;
})
} | https://gitcode.com/arkui-x/samples | de1b74c9347a68fcc390d866a53a053d3a5a4ed3 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/SimpleCalculator/entry/src/main/ets/common/util/CalculateUtil.ets | arkts | mulOrDiv | multiplication and division operation.
@param arg1 Number 1.
@param arg2 Number 2.
@param symbol Operators.
@return Multiply and divide result. | mulOrDiv(arg1: string, arg2: string, symbol: string): number {
let mulFlag = (symbol === CommonConstants.MUL);
if (this.containScientificNotation(arg1) || this.containScientificNotation(arg2)) {
if (mulFlag) {
return Number(arg1) * Number(arg2);
}
return Number(arg1) / Number(arg2);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mulOrDiv AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arg1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#... | mulOrDiv(arg1: string, arg2: string, symbol: string): number {
let mulFlag = (symbol === CommonConstants.MUL);
if (this.containScientificNotation(arg1) || this.containScientificNotation(arg2)) {
if (mulFlag) {
return Number(arg1) * Number(arg2);
}
return Number(arg1) / Number(arg2);
... | https://gitee.com/harmonyos/codelabs.git | ca3f6ca17f90248c3e160aeaa6a82b3d3c9ed318 | gitee |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/service/AlgorithmService.ets | arkts | getComponentDataByLocal | 获取本地组件数据
@returns Promise<ResponseModel<ComponentModel>> | public getComponentDataByLocal(): Promise<ResponseModel<ComponentModel>> {
return new Promise((resolve: (value: ResponseModel<ComponentModel>) => void,
reject: (reason?: Object) => void) => {
LocalRequestManager.get<ResponseModel<ComponentModel>>(LocalFileNameEnum.COMPONENT_DATA)
.then((result... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentDataByLocal 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 AS... | public getComponentDataByLocal(): Promise<ResponseModel<ComponentModel>> {
return new Promise((resolve: (value: ResponseModel<ComponentModel>) => void,
reject: (reason?: Object) => void) => {
LocalRequestManager.get<ResponseModel<ComponentModel>>(LocalFileNameEnum.COMPONENT_DATA)
.then((result... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | eec3d259a2354f45ca4f9a2dc61fb9385aa72cca | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | PerformanceAnalysis/BptaFramePractice/entry/src/main/ets/components/DiscoverView.ets | arkts | ActionButtonBuilder | Build subcomponents using @Builder | @Builder
function ActionButtonBuilder() {
// ...
} | 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 ActionButtonBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right A... | @Builder
function ActionButtonBuilder() {
// ...
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 8c052d049556cc5b26dea43c8e12e85c7243049a | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | clearAllTables | 清空三张业务表的所有数据 (重置加密时调用) | async clearAllTables(): Promise<void> {
if (!this.store) { return; }
try {
const tables: string[] = ['remotehosts', 'rdpcredentials', 'sshkeys', 'totpentries', 'rustdeskrelays'];
for (let i = 0; i < tables.length; i++) {
await this.store.executeSql("DELETE FROM " + tables[i]);
hilo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearAllTables AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ... | async clearAllTables(): Promise<void> {
if (!this.store) { return; }
try {
const tables: string[] = ['remotehosts', 'rdpcredentials', 'sshkeys', 'totpentries', 'rustdeskrelays'];
for (let i = 0; i < tables.length; i++) {
await this.store.executeSql("DELETE FROM " + tables[i]);
hilo... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 26cfb692ed96e9ebc748afc251c8c5b52f3801ea | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/SettingsService.ets | arkts | put | 写入数据并通知观察者 | public async put(key: string, value: preferences.ValueType): Promise<void> {
if (!this.preferences) {
return;
}
try {
await this.preferences.put(key, value);
await this.preferences.flush(); // 重要!确保数据持久化
// 自动同步到远端设备
SyncSettingsService.syncSetting(key, value);
// 通知... | 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 put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AS... | public async put(key: string, value: preferences.ValueType): Promise<void> {
if (!this.preferences) {
return;
}
try {
await this.preferences.put(key, value);
await this.preferences.flush(); // 重要!确保数据持久化
// 自动同步到远端设备
SyncSettingsService.syncSetting(key, value);
// 通知... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L182-L200 | 941b7d0a5cda208693336738bbd14296a2a0f268 | github |
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | getZoomRatioRange | [End init_camera]
Obtains the variable focal length range | getZoomRatioRange(): Array<number> {
let zoomRatioRange: Array<number> = [];
if (this.session !== undefined) {
try {
zoomRatioRange = this.session.getZoomRatioRange();
} catch (error) {
let err = error as BusinessError;
Logger.warn('testTag', `getZoomRatioRange failed, code... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getZoomRatioRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:... | getZoomRatioRange(): Array<number> {
let zoomRatioRange: Array<number> = [];
if (this.session !== undefined) {
try {
zoomRatioRange = this.session.getZoomRatioRange();
} catch (error) {
let err = error as BusinessError;
Logger.warn('testTag', `getZoomRatioRange failed, code... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | c1924eea3d1a11fa304dba709195c0ad6ebbf137 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/MyButtonAttributeModifier.ets | arkts | applyNormalAttribute | applyNormalAttribute - normal 状态的样式
applyPressedAttribute - pressed 状态的样式
applySelectedAttribute - selected 状态的样式
applyDisabledAttribute - disabled 状态的样式
applyFocusedAttribute - focused 状态的样式 | applyNormalAttribute(instance: ButtonAttribute): void {
if (this.isDark) {
instance.foregroundColor(Color.White)
instance.backgroundColor(Color.Black)
} else {
instance.foregroundColor(Color.Black)
instance.backgroundColor(Color.Yellow)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyNormalAttribute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ButtonAttribute AST#identifier#... | applyNormalAttribute(instance: ButtonAttribute): void {
if (this.isDark) {
instance.foregroundColor(Color.White)
instance.backgroundColor(Color.Black)
} else {
instance.foregroundColor(Color.Black)
instance.backgroundColor(Color.Yellow)
}
} | https://github.com/webabcd/HarmonyDemo | 24547e0223d065a83fe15fa744830094a8bad133 | github |
openharmony/codelabs | CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/DetailViewModel.ets | arkts | setAlarmRemind | Set the alarm remind.
@param alarmItem AlarmItem | public async setAlarmRemind(alarmItem: AlarmItem) {
alarmItem.hour = this.getAlarmTime(CommonConstants.DEFAULT_SINGLE);
alarmItem.minute = this.getAlarmTime(CommonConstants.DEFAULT_DATA_PICKER_HOUR_SELECTION);
let index = await this.findAlarmWithId(alarmItem.id);
if (index !== CommonConstants.DEFAULT_... | 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 setAlarmRemind AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmItem AST#identifier#Right AST#:#Left... | public async setAlarmRemind(alarmItem: AlarmItem) {
alarmItem.hour = this.getAlarmTime(CommonConstants.DEFAULT_SINGLE);
alarmItem.minute = this.getAlarmTime(CommonConstants.DEFAULT_DATA_PICKER_HOUR_SELECTION);
let index = await this.findAlarmWithId(alarmItem.id);
if (index !== CommonConstants.DEFAULT_... | https://gitee.com/openharmony/codelabs.git | a838bba6261f0fa5927ff5f6397709740807a4b8 | gitee |
arkui-x/samples | CodeLab/Cases/feature/imageviewer/src/main/ets/view/PicturePreview.ets | arkts | getListMaxLength | 获取图片数量和设置懒加载图片数据 | getListMaxLength() {
this.listMaxLength = this.imageList.length;
this.lazyImageList.clearAndPushAll(this.imageList)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getListMaxLength 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#L... | getListMaxLength() {
this.listMaxLength = this.imageList.length;
this.lazyImageList.clearAndPushAll(this.imageList)
} | https://gitcode.com/arkui-x/samples | a5ed1464ee3fb3483eb5bef530856bc67574c70a | gitcode |
somnio-software/my-bot-pal | entry/src/main/ets/features/chat/view/pages/ChatPage.ets | arkts | constructor | Default to today (first day) | constructor(message: ChatMessage, selectedDayIndex: number = 0) {
this.message = message;
this.selectedDayIndex = selectedDayIndex;
} | 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 message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ChatMessage AST#identifier... | constructor(message: ChatMessage, selectedDayIndex: number = 0) {
this.message = message;
this.selectedDayIndex = selectedDayIndex;
} | https://github.com/somnio-software/my-bot-pal | 23a5e44a94561eccc538bccb598821dfd57916ca | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets | arkts | getAbility | host所有实现方法开始======start | getAbility(): UIAbility {
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAbility 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 UIAbility AST#identifier#Right AST#ERROR#Right AST#... | getAbility(): UIAbility {
return this;
} | https://gitee.com/openharmony-sig/flutter_engine.git | 3d35830d7e291040383e6e57b8dbd48572585aff | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | addComputerInternal | 内部添加电脑方法
如果该 UUID 的电脑已存在,合并更新而非替换,保留 serverCert 等配对信息 | private async addComputerInternal(address: string, options?: AddComputerInternalOptions): Promise<ComputerInfo> {
const discoveredName = options?.discoveredName;
const httpPort = options?.httpPort;
const discoveredIpv6 = options?.discoveredIpv6;
const robustServerInfo = options?.robustServerInfo === t... | 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 addComputerInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left address AST#identifier#Right AST#ERROR#Left AST#... | private async addComputerInternal(address: string, options?: AddComputerInternalOptions): Promise<ComputerInfo> {
const discoveredName = options?.discoveredName;
const httpPort = options?.httpPort;
const discoveredIpv6 = options?.discoveredIpv6;
const robustServerInfo = options?.robustServerInfo === t... | https://github.com/AlkaidLab/moonlight-harmony | 4334cbf82494a6698cd3d280cf265148d6535850 | github |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | notifyTimeListChanges | Notifies record time list changes | private async notifyTimeListChanges() {
if (this.timeListUpdateListener) {
this.timeListUpdateListener(this.timeList, this.lastTimeMs);
}
if (this.preferences) {
//@ts-ignore
await this.preferences.put(this.timeListStr, this.timeList);
await this.preferences.put(this.lastTimeMsStr,... | 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 notifyTimeListChanges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async notifyTimeListChanges() {
if (this.timeListUpdateListener) {
this.timeListUpdateListener(this.timeList, this.lastTimeMs);
}
if (this.preferences) {
//@ts-ignore
await this.preferences.put(this.timeListStr, this.timeList);
await this.preferences.put(this.lastTimeMsStr,... | https://gitee.com/openharmony-sig/applications_clock.git | 67a74b8ae0a69ddc5487f637360e329be1467d24 | gitee |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/ReadingSettings.ets | arkts | setPrefetchPageCount | 设置预加载页数(0~5,0 表示关闭预加载) | setPrefetchPageCount(v: number): void {
this.ctx.state.prefetchPageCount = Math.max(0, Math.min(5, v))
this.ctx.persist()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPrefetchPageCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left... | setPrefetchPageCount(v: number): void {
this.ctx.state.prefetchPageCount = Math.max(0, Math.min(5, v))
this.ctx.persist()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/ReadingSettings.ets#L22-L25 | 754013caef48b3eaf2418038c8cd2137b5a9d365 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/LifecycleObserver.ets | arkts | dispatchAutoView | Internal auto-view dispatch. Same buffering as fg/bg, the most recent
pending ability wins, since `startAutoStoppedView` would auto-stop any
earlier one anyway. | private dispatchAutoView(shortName: string, fullName: string): void {
const cb: ((shortName: string, fullName: string) => void) | null = this.onAbilityForeground;
if (cb === null) return;
if (!this.ready) {
this.pendingAutoView = new PendingAutoView(shortName, fullName);
return;
}
cb(s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dispatchAutoView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shortName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private dispatchAutoView(shortName: string, fullName: string): void {
const cb: ((shortName: string, fullName: string) => void) | null = this.onAbilityForeground;
if (cb === null) return;
if (!this.ready) {
this.pendingAutoView = new PendingAutoView(shortName, fullName);
return;
}
cb(s... | https://github.com/Countly/countly-sdk-hos | 7bd9412e579a6fdfafcb8e0a365e1fff90d413e7 | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/File.ets | arkts | delUserPath | 删除用户目录 | static delUserPath(userId: string) {
if (userId) {
const dir = getContext().filesDir + '/' + userId
const flag = fileIo.accessSync(dir)
if (flag) {
fileIo.rmdirSync(dir)
}
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left delUserPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static delUserPath(userId: string) {
if (userId) {
const dir = getContext().filesDir + '/' + userId
const flag = fileIo.accessSync(dir)
if (flag) {
fileIo.rmdirSync(dir)
}
}
} | https://github.com/SMAT-Lab/PhantomRendering | b50fd470188f01749e87d4ad96d95c0f2e37a529 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | getSleepTimerMinutes | 获取当前睡眠定时器分钟数 | getSleepTimerMinutes(): number {
return this.sleepTimerMinutes;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSleepTimerMinutes 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#s... | getSleepTimerMinutes(): number {
return this.sleepTimerMinutes;
} | https://github.com/pangpang20/antennaPodHM | 694dec3be9e72722edf721785dd41ad3239bf1c7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | children | 获取子元素列表 | get children(): HTMLElement[] {
return this.childNodes.filter((n: Node): boolean => n.nodeType === NodeType.ELEMENT_NODE) as HTMLElement[];
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left children 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#L... | get children(): HTMLElement[] {
return this.childNodes.filter((n: Node): boolean => n.nodeType === NodeType.ELEMENT_NODE) as HTMLElement[];
} | https://github.com/DaLongZhuaZi/manxia | c75a32c9e600d605047188cf0188a6356e929109 | github |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | destroy | 销毁信令客户端 | public destroy(): void {
this.stopHeartbeat();
if (this.reconnectTimer !== null) {
clearTimeout(this.reconnectTimer);
this.reconnectTimer = null;
}
this.closeWebSocket();
this.callback = null;
this.pendingQueue = [];
LogUtil.info(`${TAG} 已销毁`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy 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_sta... | public destroy(): void {
this.stopHeartbeat();
if (this.reconnectTimer !== null) {
clearTimeout(this.reconnectTimer);
this.reconnectTimer = null;
}
this.closeWebSocket();
this.callback = null;
this.pendingQueue = [];
LogUtil.info(`${TAG} 已销毁`);
} | https://github.com/tdcare/tdwebrtc | ac7e262d9f47cb9877427991401f85f70453cbcd | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | setCurrentIndex | 设置当前播放索引 | setCurrentIndex(index: number): void {
this.audioManager.setCurrentIndex(index);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCurrentIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ... | setCurrentIndex(index: number): void {
this.audioManager.setCurrentIndex(index);
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 98d68d660b05db64995d1417c582ee1c32d23445 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | templateMgr | 获取NavDestination页面模板管理器
@returns | public static templateMgr() {
return TemplateMgr.getInstance()
} | 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 templateMgr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR... | public static templateMgr() {
return TemplateMgr.getInstance()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L338-L340 | 4c6a1ef8f207d95342c365ba8a5067b9f4f81c17 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationErrorHandler.ets | arkts | getUserMessage | 获取用户友好的错误消息
@param errorType 错误类型
@returns 用户友好的错误消息 | private static getUserMessage(errorType: NavigationErrorType): string {
return NavigationErrorHandler.ERROR_MESSAGES[errorType];
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left errorType AST#identifier#Right AST#:#... | private static getUserMessage(errorType: NavigationErrorType): string {
return NavigationErrorHandler.ERROR_MESSAGES[errorType];
} | https://github.com/LJ666-ui/harmony-health-care | bce49c04424ab61304390184b9c8ee923417ddc6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Long.ets | arkts | createFromJSONValue | Creates a Long instance based on JSONValue
@param json: JSONValue - a JSON representation
@throws JSONTypeError if json does not encode a valid long
@returns Long - long value decoded from JSON | static createFromJSONValue(json: JSONValue): Long {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
if (Double.isInteger(num) && Long.MIN_VALUE <= num && num <= Long.MAX_VALUE) {
return Long.valueOf(num as long)
}
}
t... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFromJSONValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static createFromJSONValue(json: JSONValue): Long {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
if (Double.isInteger(num) && Long.MIN_VALUE <= num && num <= Long.MAX_VALUE) {
return Long.valueOf(num as long)
}
}
t... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 442d6082b2a602c9e3e782fd3ae3e8185cfca9f7 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | matchSelectorChain | 匹配选择器链 | private matchSelectorChain(chain: SelectorNode[], startIndex: number): HTMLElement[] {
if (startIndex >= chain.length) return [];
const currentNode = chain[startIndex];
const isLast = startIndex === chain.length - 1;
const descendants = this.getElementsByTagName('*');
const matches: HTML... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left matchSelectorChain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | private matchSelectorChain(chain: SelectorNode[], startIndex: number): HTMLElement[] {
if (startIndex >= chain.length) return [];
const currentNode = chain[startIndex];
const isLast = startIndex === chain.length - 1;
const descendants = this.getElementsByTagName('*');
const matches: HTML... | https://github.com/DaLongZhuaZi/manxia | d4ccfcd04dbbe62851f76b8bd06c87b28a926d27 | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | existingContact | Save to Existing Contacts | existingContact(number) {
var actionData: LooseObject = {};
actionData.phoneNumber = number;
actionData.pageFlag = common.contactPage.PAGE_FLAG_SAVE_EXIST_CONTACT;
this.jumpToContact(actionData);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left existingContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#e... | existingContact(number) {
var actionData: LooseObject = {};
actionData.phoneNumber = number;
actionData.pageFlag = common.contactPage.PAGE_FLAG_SAVE_EXIST_CONTACT;
this.jumpToContact(actionData);
} | https://gitee.com/openharmony/applications_mms.git | 47889e27da9407bde2bfbc9d7b9fa2303667d404 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets | arkts | searchByTitle | 按标题搜索书籍
@param title 书籍标题
@param limit 返回数量限制 (最大40) | public async searchByTitle(title: string, limit: number = 20): Promise<ScraperSearchResult> {
const query = `intitle:${title}`;
return this.searchVolumes(query, limit);
} | 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 searchByTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AS... | public async searchByTitle(title: string, limit: number = 20): Promise<ScraperSearchResult> {
const query = `intitle:${title}`;
return this.searchVolumes(query, limit);
} | https://github.com/DaLongZhuaZi/manxia | ac99c6810275b54a445c02b3959393966cdb6f21 | github |
xblLab/HarmonyProjectTemplate | commons/lib_common/src/main/ets/utils/RouterUtils.ets | arkts | replacePathByName | 更换页面
@param name
@param param
@param animated | public static replacePathByName(name: RouterMap, param: Object | null = null, animated: boolean = true,
stackName: string = StackEnum.Main) {
RouterUtils.getStack(stackName).replacePathByName(name, param, animated);
} | 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 replacePathByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left ... | public static replacePathByName(name: RouterMap, param: Object | null = null, animated: boolean = true,
stackName: string = StackEnum.Main) {
RouterUtils.getStack(stackName).replacePathByName(name, param, animated);
} | https://github.com/xblLab/HarmonyProjectTemplate | 2f00df5fec59cde597fbec2c59a6ebdd45442259 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.