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 |
|---|---|---|---|---|---|---|---|---|---|---|
HarmonyOS_Samples/ArkTSComponentsTest | entry/src/ohosTest/ets/testability/TestAbility.ets | arkts | onDestroy | [StartExclude set_data] | onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
this.abilityDelegator.finishTest('TestAbility onDestroy unexpectedly!', ON_DESTROY_ERROR, () => {
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDestroy 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 AST... | onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
this.abilityDelegator.finishTest('TestAbility onDestroy unexpectedly!', ON_DESTROY_ERROR, () => {
});
} | https://gitcode.com/HarmonyOS_Samples/ArkTSComponentsTest | 798e4ee8506f0a4fa964fe2c28c91d5e682598b1 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets | arkts | has | Determines whether a value exists in the Set.
@param { K } val - The value to check.
@returns { boolean } - Return true if the value exists, otherwise return false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | override has(val: K): boolean {
return this.elements.has(val)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden... | override has(val: K): boolean {
return this.elements.has(val)
} | https://gitcode.com/iop123123/arkts-static-skills | 5ba44fcd0af2c9504c6ce908298ec22bd172d7cd | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVPlayer/entry/src/main/ets/model/BasicDataSource.ets | arkts | getData | Retrieve data at the specified index. | public getData(index: number): void {
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData 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 ... | public getData(index: number): void {
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 219c5e3d1db7581474c2496b6b847b99fcfedd1d | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets | arkts | get | Gets the value of the key.
@param key the key of the element to get
@returns the value of the key | public get(key: int): T | undefined {
return this.buckets.get(key);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier... | public get(key: int): T | undefined {
return this.buckets.get(key);
} | https://gitcode.com/iop123123/arkts-static-skills | 761856db6af4692fe3a4244562ef2d19dc324d50 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/AchievementStorageService.ets | arkts | resetAllAchievements | 重置所有成就(用于测试) | static async resetAllAchievements(): Promise<void> {
try {
await dataStorage.clear(AchievementStorageService.STORE_NAME);
console.log('[AchievementStorage] All achievements reset');
} catch (error) {
console.error('[AchievementStorage] Failed to reset achievements:', error);
throw erro... | 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 resetAllAchievements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | static async resetAllAchievements(): Promise<void> {
try {
await dataStorage.clear(AchievementStorageService.STORE_NAME);
console.log('[AchievementStorage] All achievements reset');
} catch (error) {
console.error('[AchievementStorage] Failed to reset achievements:', error);
throw erro... | https://github.com/the-wwyang/kids-learning-app | 96723da9e7f4b91204b48515220d6068dfaa4c51 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | switch_songs | 歌曲排序交换 // | switch_songs(index_a: number, index_b: number) {
// 防溢出检测 //
try {
this.play_list[index_a]
this.play_list[index_b]
} catch {return}
// 交换两个位置的歌曲 //
const tmp = this.play_list[index_a]
this.play_list[index_a] = this.play_list[index_b]
this.play_list[index_b] = tmp
// 指针修正... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switch_songs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index_a AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,... | switch_songs(index_a: number, index_b: number) {
// 防溢出检测 //
try {
this.play_list[index_a]
this.play_list[index_b]
} catch {return}
// 交换两个位置的歌曲 //
const tmp = this.play_list[index_a]
this.play_list[index_a] = this.play_list[index_b]
this.play_list[index_b] = tmp
// 指针修正... | https://github.com/Nekofox-POT/LinMusic | a60ea37a4bdbc85d20003887af767612ef33e88c | github |
openharmony/codelabs | ETSUI/SimpleCalculator/entry/src/main/ets/common/util/CalculateUtil.ets | arkts | parseExpression | Expression Processing.
@param expressions Expressions. | parseExpression(expressions: Array<string>): string {
if (CheckEmptyUtil.isEmpty(expressions)) {
return 'NaN';
}
let len = expressions.length;
let outputStack: string[] = [];
let outputQueue: string[] = [];
expressions.forEach((item: string, index: number) => {
// Handle % in the e... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parseExpression AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left expressions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST#ident... | parseExpression(expressions: Array<string>): string {
if (CheckEmptyUtil.isEmpty(expressions)) {
return 'NaN';
}
let len = expressions.length;
let outputStack: string[] = [];
let outputQueue: string[] = [];
expressions.forEach((item: string, index: number) => {
// Handle % in the e... | https://gitee.com/openharmony/codelabs.git | a0a9ea7b824779aa0e8b46012c54822370fbfdaa | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets | arkts | getUserAgent | 获取User-Agent | getUserAgent(context: WorkflowContext): string | null {
const capability = context.capabilities.get('userAgentRotation');
if (!capability) {
return null;
}
const config = capability as UserAgentRotationConfig;
return this.userAgentManager.getUserAgent(context.sourceId, config);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUserAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | getUserAgent(context: WorkflowContext): string | null {
const capability = context.capabilities.get('userAgentRotation');
if (!capability) {
return null;
}
const config = capability as UserAgentRotationConfig;
return this.userAgentManager.getUserAgent(context.sourceId, config);
} | https://github.com/DaLongZhuaZi/manxia | 960cabedcefc1680d5ee264844ec86f968c641e5 | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/calculator/UnitSunshineCalculator.ets | arkts | calculateAllUnits | 计算所有单元的日照数据(优化版本) | calculateAllUnits(
buildings: BuildingModel[],
targetBuilding: BuildingModel,
latitude: number,
longitude: number,
year: number = 2024,
timeZone: number = 8
): UnitSunshineData[] {
const results: UnitSunshineData[] = [];
const floorCount = targetBuilding.getFloorCount();
con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculateAllUnits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buildings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#iden... | calculateAllUnits(
buildings: BuildingModel[],
targetBuilding: BuildingModel,
latitude: number,
longitude: number,
year: number = 2024,
timeZone: number = 8
): UnitSunshineData[] {
const results: UnitSunshineData[] = [];
const floorCount = targetBuilding.getFloorCount();
con... | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 0db95cc7b33a785da2f2f18d8ce740fa0b6833b0 | github |
Cool_foolisher1/ArkTSRepository | RandomNumberSimulator/entry/src/main/ets/common/utils/PreferenceUtils.ets | arkts | delete | 删除数据
@param context 应用上下文
@param name 首选项文件名
@param key 键
@returns 异步删除 | public static async delete(context: Context = new UIContext().getHostContext() as Context, name: string,
key: string): Promise<void> {
const preferences = PreferenceUtils.getPreferences(context, name)
//如果不加上flush操作,只是在内存中删除,需要加上flush操作才能写入磁盘!
try {
preferences.deleteSync(key)
} catch (error... | 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#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#... | public static async delete(context: Context = new UIContext().getHostContext() as Context, name: string,
key: string): Promise<void> {
const preferences = PreferenceUtils.getPreferences(context, name)
//如果不加上flush操作,只是在内存中删除,需要加上flush操作才能写入磁盘!
try {
preferences.deleteSync(key)
} catch (error... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 789fea691386e576ae0a76c60d8ee4f1322f9a7b | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/LRU.ets | arkts | moveToFront | -------- private helper methods ---------- | private moveToFront(node: LRUNode<K, V>): void {
if (node === this.head) {
return;
}
this.removeNode(node);
this.addToFront(node);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left moveToFront AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | private moveToFront(node: LRUNode<K, V>): void {
if (node === this.head) {
return;
}
this.removeNode(node);
this.addToFront(node);
} | https://gitcode.com/iop123123/arkts-static-skills | 5be21594363fc8ddb36469c7bf0b58f4fe400888 | gitcode |
erosTeam/NextE | shared/src/main/ets/utils/BasicDataSource.ets | arkts | appendData | Append a page; use the same DataChangeListener family as reload (V2Next pattern). | appendData(items: T[]): void {
if (items.length === 0) {
return
}
const start: number = this.items.length
this.items = this.items.concat(items)
this.listeners.forEach((l: DataChangeListener) => {
l.onDataAdd(start)
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left appendData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left items AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#[#Left [ AST#[#Right AST#]#Left ]... | appendData(items: T[]): void {
if (items.length === 0) {
return
}
const start: number = this.items.length
this.items = this.items.concat(items)
this.listeners.forEach((l: DataChangeListener) => {
l.onDataAdd(start)
})
} | https://github.com/erosTeam/NextE | b45b7e1ca97c61b11cbeda38bb25034736c59a9a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets | arkts | hasValue | Check whether a value is in the TreeMap
@param key: the value to find in the TreeMap
@returns true if the value is in the TreeMap | hasValue(value: V): boolean {
if (this.rootEntry !== undefined) {
let entry = this.rootEntry;
while (entry!.left !== undefined) {
entry = entry!.left;
}
while (entry !== undefined) {
if (entry!.val === value) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left V AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ... | hasValue(value: V): boolean {
if (this.rootEntry !== undefined) {
let entry = this.rootEntry;
while (entry!.left !== undefined) {
entry = entry!.left;
}
while (entry !== undefined) {
if (entry!.val === value) {
... | https://gitcode.com/iop123123/arkts-static-skills | 5c1cdfd5154c25bec5d33b18dab829675ea9b223 | gitcode |
openharmony/applications_contacts | feature/call/src/main/ets/CallLogService.ets | arkts | mergeByContact | In the case of merging by contact, the post-processing
of the call record service data is optimized based on the original call record data.
@param {Array} callLogList
@return {Array} callLogList | private mergeByContact(callLogs: CallLog[]): MergedCallLog[] {
let resultList: MergedCallLog[] = [];
if (ArrayUtil.isEmpty(callLogs)) {
return resultList;
}
let contactTempMap: Map<string, string> = new Map();
let phoneNumberMap: Map<string, string> = new Map();
for (let i = 0; i < callLogs.length; i++)... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeByContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callLogs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | private mergeByContact(callLogs: CallLog[]): MergedCallLog[] {
let resultList: MergedCallLog[] = [];
if (ArrayUtil.isEmpty(callLogs)) {
return resultList;
}
let contactTempMap: Map<string, string> = new Map();
let phoneNumberMap: Map<string, string> = new Map();
for (let i = 0; i < callLogs.length; i++)... | https://gitee.com/openharmony/applications_contacts.git | 101be87894216fe68fccab37a2c940aaa242b7dc | gitee |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/TodayPlanFlow.ui.test.ets | arkts | returnToHome | Press back until HomeStartButton resolves so each test starts on
HomePage regardless of where a prior suite left the app. | async function returnToHome(driver: Driver): Promise<void> {
try {
for (let i: number = 0; i < 5; i++) {
const home: Component | null =
await driver.findComponent(ON.id('HomeStartButton'));
if (home !== null) {
return;
}
await driver.pressBack();
await driver.delayMs(... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left returnToHome AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#type... | async function returnToHome(driver: Driver): Promise<void> {
try {
for (let i: number = 0; i < 5; i++) {
const home: Component | null =
await driver.findComponent(ON.id('HomeStartButton'));
if (home !== null) {
return;
}
await driver.pressBack();
await driver.delayMs(... | https://github.com/terryma2024/happyword | 94b8d91e77ac6fd96a40ef53f4973aa1b1d2bb3f | github |
HarmonyOS_Samples/guide-snippets | Ability/ApplicationContextDemo/entry/src/main/ets/entrylifecycleability/EntryLifecycleAbility.ets | arkts | onAbilityForeground | 当UIAbility从后台转到前台时触发回调 | onAbilityForeground(uiAbility) {
hilog.info(DOMAIN_NUMBER, TAG, `onAbilityForeground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
}, | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAbilityForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uiAbility AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Righ... | onAbilityForeground(uiAbility) {
hilog.info(DOMAIN_NUMBER, TAG, `onAbilityForeground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`);
}, | https://gitcode.com/HarmonyOS_Samples/guide-snippets | a3ba4f7042a7321fb683fb1061cbfda8d943de71 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | constructor | Constructs a new Double instance from BigInt
@param { BigInt } value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(value: BigInt) {
this.value = value.doubleValue()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Big... | public constructor(value: BigInt) {
this.value = value.doubleValue()
} | https://gitcode.com/iop123123/arkts-static-skills | ab66c305199ce84769bd1d0a39f01c0c715565dd | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates a copy of BigInt64Array.
@param other data initializer | public constructor(other: BigInt64Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Big... | public constructor(other: BigInt64Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | df4f3e8e6e636b706797a204af68d9ab6adc3232 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LargeFileJSONParser.ets | arkts | parseFileStream | 从文件描述符流式解析 | private async parseFileStream(
file: fs.File,
totalSize: number,
result: ParseResult<T>
): Promise<void> {
const buffer = new ArrayBuffer(this.config.chunkSize);
let bytesRead = 0;
let offset = 0;
// 解析状态
let state = ParserState.INIT;
let objectBuffer = '';
let braceDept... | 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 parseFileStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left file AST#identifier#Right... | private async parseFileStream(
file: fs.File,
totalSize: number,
result: ParseResult<T>
): Promise<void> {
const buffer = new ArrayBuffer(this.config.chunkSize);
let bytesRead = 0;
let offset = 0;
// 解析状态
let state = ParserState.INIT;
let objectBuffer = '';
let braceDept... | https://github.com/DaLongZhuaZi/manxia | d91ee7395060148c05d5a290de49b91e552b79d1 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets | arkts | playRecording | ==================== 播放功能 ====================
播放录音 | async playRecording(recording: Recording, callback?: PlaybackCallback): Promise<boolean> {
try {
// 如果正在播放其他录音,先停止
if (this.playbackState !== PlaybackState.IDLE) {
await this.stopPlayback()
}
// 创建 AVPlayer
this.avPlayer = await media.createAVPlayer()
this.playbackCall... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left playRecording AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left recording AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async playRecording(recording: Recording, callback?: PlaybackCallback): Promise<boolean> {
try {
// 如果正在播放其他录音,先停止
if (this.playbackState !== PlaybackState.IDLE) {
await this.stopPlayback()
}
// 创建 AVPlayer
this.avPlayer = await media.createAVPlayer()
this.playbackCall... | https://gitcode.com/openharmony/codelabs | 685d1b1833df948f6e9d42d26e7b1aaccb85de59 | gitcode |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | products/pc/src/main/ets/components/presentation/progress/components/CircleProgress.ets | arkts | pauseDownload | Pauses the download | pauseDownload() {
this.currentState = DownloadState.PAUSED;
this.clearTimer();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pauseDownload 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... | pauseDownload() {
this.currentState = DownloadState.PAUSED;
this.clearTimer();
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 5608ba54f557cb2b93501cac4d6fffc5592358dc | gitcode |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | registerAVPlayerCallback | 注册内置播放器回调函数 | registerAVPlayerCallback(avPlayer: media.AVPlayer) {
// startRenderFrame首帧渲染回调函数
avPlayer.on('startRenderFrame', () => {
LogUtil.info('AVPlayer start render frame');
this.mPlayerStatus = PlayerStatus.PLAYING;
this.startReportProgress();
// 系统播放器 在这里注册播控中心
this.registerAVSession({... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerAVPlayerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left avPlayer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left m... | registerAVPlayerCallback(avPlayer: media.AVPlayer) {
// startRenderFrame首帧渲染回调函数
avPlayer.on('startRenderFrame', () => {
LogUtil.info('AVPlayer start render frame');
this.mPlayerStatus = PlayerStatus.PLAYING;
this.startReportProgress();
// 系统播放器 在这里注册播控中心
this.registerAVSession({... | https://github.com/fbinba3955/Flymby | 05be62f8b3fb5e2137e63e1876e0f440d4fbc166 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/ui/StyleDemo.ets | arkts | myExtend2 | @Extend 装饰的函数支持传递参数,只能在当前文件中使用
因为 @Extend 只能在全局定义,如果你想在事件中修改组件内的变量的话,就可以类似下面的参数 onClick: () => void 的方式实现 | @Extend(Text) function myExtend2(fontColor:Color, onClick: () => void) {
.myExtend1() // 通过此方式继承其他的 @Extend
.fontColor(fontColor)
.onClick(onClick)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text) function myExtend2(fontColor:Color, onClick: () => void) {
.myExtend1() // 通过此方式继承其他的 @Extend
.fontColor(fontColor)
.onClick(onClick)
} | https://github.com/webabcd/HarmonyDemo | af9280916609c3ae77dbd389d48ca08dea1b81d7 | github |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | getLevel | 获取当前日志级别
@returns 日志级别 | getLevel(): LogLevel {
return this.level
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLevel 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 LogLevel AST#identifier#Right AST#ERROR#Right AST#sta... | getLevel(): LogLevel {
return this.level
} | https://github.com/offlinecat-dev/OCNetORM | e7d608ed33d7fdf493e2fdfccb2b409b9b774738 | github |
the-wwyang/kids-learning-app | src/main/ets/services/DataBackupService.ets | arkts | getBackupFiles | 获取备份文件列表 | public async getBackupFiles(): Promise<string[]> {
if (!this.context) {
return [];
}
try {
const backupDir = `${this.context.filesDir}/backups`;
const files = fileIo.listFileSync(backupDir);
return files.filter(f => f.startsWith(DataBackupService.BACKUP_FILE_PREFIX));
} catch ... | 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 getBackupFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async getBackupFiles(): Promise<string[]> {
if (!this.context) {
return [];
}
try {
const backupDir = `${this.context.filesDir}/backups`;
const files = fileIo.listFileSync(backupDir);
return files.filter(f => f.startsWith(DataBackupService.BACKUP_FILE_PREFIX));
} catch ... | https://github.com/the-wwyang/kids-learning-app | a460928e84af530ef04ea21e24d3da0f945031df | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/TypeConverter.ets | arkts | objectToJson | 对象转换为 JSON 字符串
@param obj 要序列化的对象
@returns JSON 字符串 | static objectToJson(obj: object): string {
return JSON.stringify(obj)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left objectToJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left obje... | static objectToJson(obj: object): string {
return JSON.stringify(obj)
} | https://github.com/offlinecat-dev/OCNetORM | 6c6cb6b75ff85a3f5822a21fa5186eb63e831e51 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | includes | Checks if specified argument is in Float32Array
@param e search element
@returns true if e is in Float32Array, false otherwise | public includes(e: number): boolean {
return this.includes(e as double as int as float, 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST... | public includes(e: number): boolean {
return this.includes(e as double as int as float, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 525b3f6590bdf047dd264a05a8a0abf48bb3f061 | gitee |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/network/HttpClient.ets | arkts | setToken | 设置认证 Token | setToken(token: string): void {
this.authToken = token;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | setToken(token: string): void {
this.authToken = token;
} | https://github.com/Harrisonls2004/WaterFlow | d57fc20fafb4823cb5529b890af78212490044b6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | padRight | Creates a new string of a specified length in which
the end of this String is padded with a specified
character. `padEnd` is an alias of this method,
except the parameter order.
@param { char } pad to repeat
@param { int } count of characters in the resulting string
@returns { String } new string with padding at the en... | public padRight(pad: char, count: int): String {
return this.padEnd(count, pad)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pad AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left char AST... | public padRight(pad: char, count: int): String {
return this.padEnd(count, pad)
} | https://gitcode.com/iop123123/arkts-static-skills | 2ae26c75ed87aec3143f9acc73c6edf140b173af | gitcode |
fbinba3955/Flymby | main/src/main/ets/pages/player/EmbyPlayer.ets | arkts | doReportStop | 上报播放结束 | doReportStop(time: number) {
this.mPlaybackInfo && this.currentVideoParam.itemId &&
doReportStop(this.mPlaybackInfo, this.currentVideoParam.itemId, time)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doReportStop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ... | doReportStop(time: number) {
this.mPlaybackInfo && this.currentVideoParam.itemId &&
doReportStop(this.mPlaybackInfo, this.currentVideoParam.itemId, time)
} | https://github.com/fbinba3955/Flymby | b60296bbe5b984e034820572ec3c07fe2b1e19d5 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | fontsize | The fontsize() method creates a string that embeds a string in a <font> element (<font size="...">str</font>), which causes a string to be displayed in the specified font size. | public fontsize(size: number): String {
return this.CreateHTMLString("font", " size=\"" + size + "\"")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fontsize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | public fontsize(size: number): String {
return this.CreateHTMLString("font", " size=\"" + size + "\"")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a94901514e83f91520bec7c4c25d0d54eb31b7b6 | gitee |
OHPG/FinSdk | jellyfin/src/main/ets/api/PlayStateApi.ets | arkts | onPlaybackStart | onPlaybackStart
@summary Reports that a session has begun playing an item.
@param {PlayStateApiOnPlaybackStartRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof PlayStateApi | public async onPlaybackStart(requestParameters: PlayStateApiOnPlaybackStartRequest): Promise<void> {
this.assertParam(requestParameters.itemId)
return this.apiClient.post({path: `/PlayingItems/${requestParameters.itemId}`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left onPlaybackStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right A... | public async onPlaybackStart(requestParameters: PlayStateApiOnPlaybackStartRequest): Promise<void> {
this.assertParam(requestParameters.itemId)
return this.apiClient.post({path: `/PlayingItems/${requestParameters.itemId}`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 24c386cc3120e5d38762b3a23a278830257904fc | github |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/alerts/AlertsObserver.ets | arkts | getLastUpdateAlertTime | 返回上一次需要执行刷新操作的时刻 | public getLastUpdateAlertTime(): number {
return this.mLastUpdateAlertTime;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLastUpdateAlertTime 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 num... | public getLastUpdateAlertTime(): number {
return this.mLastUpdateAlertTime;
} | https://gitee.com/openharmony/applications_calendar_data.git | 804039fd6f13cda50e526ef873eb5a684c92d872 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | copyWithin | Makes a shallow copy of the Array part to another location in the same Array and returns it without modifying its length.
@param target index at which to copy the sequence
@returns this array after transformation | public copyWithin(target: number): Array<T> {
return this.copyWithin(target as int)
} | 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#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public copyWithin(target: number): Array<T> {
return this.copyWithin(target as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 950280cca059f4edf70b13082822fbc4f7d316d8 | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets | arkts | getInstance | 单例模式获取实例 | static getInstance(context?: common.Context): DataManager {
if (!DataManager.instance && context) {
DataManager.instance = new DataManager(context);
}
return DataManager.instance!;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static getInstance(context?: common.Context): DataManager {
if (!DataManager.instance && context) {
DataManager.instance = new DataManager(context);
}
return DataManager.instance!;
} | https://gitcode.com/openharmony/codelabs | 529d8ca4399ab7bfbd13e78ddb52f33697fbb246 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectField.ets | arkts | isProtected | Checks if the field has protected access permission.
@returns { boolean } Returns true if the field is protected; otherwise returns false. | public isProtected(): boolean {
return (this.accessMod == AccessModifier.PROTECTED)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isProtected 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#b... | public isProtected(): boolean {
return (this.accessMod == AccessModifier.PROTECTED)
} | https://gitcode.com/iop123123/arkts-static-skills | 6d39a9179e2461de6da08d87fd6c594c45e66c90 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | setBool | Sets a boolean.
@param byteOffset The byte offset.
@param value The value. | setBool(byteOffset: number, value: boolean): void {
this.dataView?.setInt8(byteOffset, value ? 1 : 0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Rig... | setBool(byteOffset: number, value: boolean): void {
this.dataView?.setInt8(byteOffset, value ? 1 : 0)
} | https://gitee.com/openharmony-sig/flutter_engine.git | 787b9a6fbdbedaad15b3e57294583ea2336380c2 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | updateTxtTocRule | 更新TXT目录规则 | async updateTxtTocRule(id: string, rule: TxtTocRule): Promise<void> {
const index = this.txtTocRules.findIndex((r: TxtTocRule) => r.id === id);
if (index !== -1) {
this.txtTocRules[index] = {
id: rule.id,
name: rule.name,
pattern: rule.pattern,
enabled: rule.enabled,
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateTxtTocRule AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async updateTxtTocRule(id: string, rule: TxtTocRule): Promise<void> {
const index = this.txtTocRules.findIndex((r: TxtTocRule) => r.id === id);
if (index !== -1) {
this.txtTocRules[index] = {
id: rule.id,
name: rule.name,
pattern: rule.pattern,
enabled: rule.enabled,
... | https://github.com/DaLongZhuaZi/manxia | 20a019dacfde3c1f52f5d5c9a88402164afec798 | github |
openharmony-sig/applications_filemanager | entry/src/main/ets/pages/ImagePreview.ets | arkts | onDeleteAccept | 点击删除弹窗确定事件 | onDeleteAccept() {
console.log(this.TAG+',onDeleteAccept this.image='+this.image)
console.log(this.TAG+',onDeleteAccept this.image='+this.title)
//let path=this.mediaTest.getPublicDirectory(this.image)
let deleteResult =this.mediaTest.deleteAsset(this.image)
deleteResult.then(() => ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDeleteAccept 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... | onDeleteAccept() {
console.log(this.TAG+',onDeleteAccept this.image='+this.image)
console.log(this.TAG+',onDeleteAccept this.image='+this.title)
//let path=this.mediaTest.getPublicDirectory(this.image)
let deleteResult =this.mediaTest.deleteAsset(this.image)
deleteResult.then(() => ... | https://gitee.com/openharmony-sig/applications_filemanager.git | 9c30af94f74308eeb5c7c78e74cbe0509f09872f | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | atView | 依附组件ID
@param id
@returns | atView(id: string): Builder {
this.attachViewId = id
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left atView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Righ... | atView(id: string): Builder {
this.attachViewId = id
return this
} | https://github.com/wuba/omni-ui | 36c654c73738b07090a87a582a50e4d41a4afd5c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/data/hospitalData.ets | arkts | getAllFloorPlans | 获取所有楼层平面图 | function getAllFloorPlans(): FloorPlan[] {
const plans: FloorPlan[] = [];
// 门诊大楼 B1-5层
for (let floor = -1; floor <= 5; floor++) {
plans.push(createFloorPlan('OUTPATIENT', floor));
}
// 住院部 1-15层(只创建前几层作为示例)
for (let floor = 1; floor <= 10; floor++) {
plans.push(createFloorPlan('INPATIENT', f... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getAllFloorPlans AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#array_type... | function getAllFloorPlans(): FloorPlan[] {
const plans: FloorPlan[] = [];
// 门诊大楼 B1-5层
for (let floor = -1; floor <= 5; floor++) {
plans.push(createFloorPlan('OUTPATIENT', floor));
}
// 住院部 1-15层(只创建前几层作为示例)
for (let floor = 1; floor <= 10; floor++) {
plans.push(createFloorPlan('INPATIENT', f... | https://github.com/LJ666-ui/harmony-health-care | c258a26fe732550b8fc10a0074fe178493caf12f | github |
openharmony/codelabs | GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets | arkts | setYLocationType | Get y locationType.
@param offsetY | public setYLocationType(offsetY: number) {
if (offsetY > this.offsetYBottom - CommonConstant.OFFSET_RANGE &&
offsetY < this.offsetYBottom + CommonConstant.OFFSET_RANGE) {
this.yLocationType = YLocationEnum.YBottom;
} else if (offsetY > this.offsetYTop - CommonConstant.OFFSET_RANGE &&
offsetY... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setYLocationType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetY AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public setYLocationType(offsetY: number) {
if (offsetY > this.offsetYBottom - CommonConstant.OFFSET_RANGE &&
offsetY < this.offsetYBottom + CommonConstant.OFFSET_RANGE) {
this.yLocationType = YLocationEnum.YBottom;
} else if (offsetY > this.offsetYTop - CommonConstant.OFFSET_RANGE &&
offsetY... | https://gitee.com/openharmony/codelabs.git | 66b92423d3cb30f21321459ea80cd305ec25385b | gitee |
tdcare/tdwebrtc | src/main/ets/VideoDecoderH264.ets | arkts | decodeFrame | 解码视频帧
## 重要说明
H264 硬件解码器直接输出到 Surface,解码即渲染,**不需要**手动调用 renderToSurface()。
renderAfterDecode 参数在本实现中被忽略,仅为了保持与 VP8 解码器接口一致。
@param encodedData H.264 NALU 数据 (Annex-B 格式)
@param timestamp 时间戳(微秒)
@param isKeyFrame 是否为关键帧
@param renderAfterDecode 此参数被忽略,H264 解码即自动渲染 | public async decodeFrame(
encodedData: ArrayBuffer,
timestamp: number,
isKeyFrame: boolean = false,
renderAfterDecode: boolean = true
): Promise<boolean> {
if (!this.isRunning || this.h264Decoder === null) {
return false;
}
this.decodeAttemptCount++;
try {
const uint8Ar... | 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 decodeFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left encodedData AST#identifier#Right AST#:#Left ... | public async decodeFrame(
encodedData: ArrayBuffer,
timestamp: number,
isKeyFrame: boolean = false,
renderAfterDecode: boolean = true
): Promise<boolean> {
if (!this.isRunning || this.h264Decoder === null) {
return false;
}
this.decodeAttemptCount++;
try {
const uint8Ar... | https://github.com/tdcare/tdwebrtc | c97cc44369606c77c913a62d0fc80f758873f658 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | assertObject | 类型断言辅助函数 - 对象
@param value - 要断言的值
@param context - 上下文信息
@returns 对象值
@throws 如果类型不匹配 | static assertObject(value: Object, context: string = 'value'): Record<string, Object> {
if (!TypeGuards.isObject(value)) {
const error = `${context} 必须是对象类型,实际类型: ${typeof value}`;
logger.error(TAG, error);
throw new Error(error);
}
return value as Record<string, Object>;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left assertObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ob... | static assertObject(value: Object, context: string = 'value'): Record<string, Object> {
if (!TypeGuards.isObject(value)) {
const error = `${context} 必须是对象类型,实际类型: ${typeof value}`;
logger.error(TAG, error);
throw new Error(error);
}
return value as Record<string, Object>;
} | https://github.com/DaLongZhuaZi/manxia | 4297aa28f9850ede0c9cf5165dac0579161b8dbd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | removeFormInfo | 移除卡片信息 | private async removeFormInfo(formId: string): Promise<void> {
try {
const pref = await preferences.getPreferences(this.context, FORM_STORAGE);
const formIdsStr = (await pref.get('formIds', '[]')) as string;
const ids: string[] = SafeUtils.parseObj(formIdsStr);
const index = ids.indexOf(fo... | 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 removeFormInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left... | private async removeFormInfo(formId: string): Promise<void> {
try {
const pref = await preferences.getPreferences(this.context, FORM_STORAGE);
const formIdsStr = (await pref.get('formIds', '[]')) as string;
const ids: string[] = SafeUtils.parseObj(formIdsStr);
const index = ids.indexOf(fo... | https://github.com/DaLongZhuaZi/manxia | 64aacd05c622e2841c0124fe9a3fdd83d61df35e | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | getCheckInRecords | 获取打卡记录列表 | async getCheckInRecords(params?: { startDate?: string; endDate?: string; page?: number; pageSize?: number }): Promise<ApiResponse<any>> {
return this.get<any>('/api/attendance/records', params)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCheckInRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type... | async getCheckInRecords(params?: { startDate?: string; endDate?: string; page?: number; pageSize?: number }): Promise<ApiResponse<any>> {
return this.get<any>('/api/attendance/records', params)
} | https://github.com/David8Idira/AI-OA | e3cd64b211a6cc50ee226be2e26babf588267b47 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/common/CustomComponentDemo.ets | arkts | onMeasureSize | 通过 onMeasureSize() 计算每个子组件的尺寸(注:先 onMeasureSize 再 onPlaceChildren)
selfLayoutInfo - 父组件的布局信息(一个 GeometryInfo 对象)
width, height, borderWidth, margin, padding
children - 子组件数组(一个 Measurable 对象数组)
measure() - 测量并返回指定的子组件的尺寸,测量后的结果可以在 onPlaceChildren() 中获取到
getMargin(), getPadding(), getBorderWidth() - 获取指定的子组件的 margin, pa... | onMeasureSize(selfLayoutInfo: GeometryInfo, children: Array<Measurable>, constraint: ConstraintSizeOptions) {
MyLog.d(`onMeasureSize selfLayoutInfo:${JSON.stringify(selfLayoutInfo)}`)
children.forEach((child, index) => {
// 通过 minWidth, maxWidth, minHeight, maxHeight 测量并返回 child 的尺寸
// 测量后,对应的子组件... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onMeasureSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selfLayoutInfo AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left GeometryInfo AST#identifier#Right... | onMeasureSize(selfLayoutInfo: GeometryInfo, children: Array<Measurable>, constraint: ConstraintSizeOptions) {
MyLog.d(`onMeasureSize selfLayoutInfo:${JSON.stringify(selfLayoutInfo)}`)
children.forEach((child, index) => {
// 通过 minWidth, maxWidth, minHeight, maxHeight 测量并返回 child 的尺寸
// 测量后,对应的子组件... | https://github.com/webabcd/HarmonyDemo | c545d8aa0707bb632374a000dcdcb8faee7387ea | github |
OHPG/FinMusic | entry/src/main/ets/player/LyricCache.ets | arkts | clearAll | 清理所有歌词缓存文件 | clearAll(): void {
FileTool.clearDir(this.lrcDir)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | clearAll(): void {
FileTool.clearDir(this.lrcDir)
} | https://github.com/OHPG/FinMusic | 93d38db29155ef01873968f7b85381ac0f94fa96 | github |
popsiclelmlm/Hey | entry/src/main/ets/features/runtime/RuntimeController.ets | arkts | allEntries | 核心日志、诊断日志、应用日志各自最新在前,合并后按时间倒序统一排列(最新在顶),上限 120 条。 | private allEntries(): Array<LogEntry> {
const merged = this.coreEntries.concat(this.diagnosticEntries).concat(this.logs);
merged.sort((a: LogEntry, b: LogEntry) => b.at - a.at);
return merged.slice(0, 120);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left allEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left A... | private allEntries(): Array<LogEntry> {
const merged = this.coreEntries.concat(this.diagnosticEntries).concat(this.logs);
merged.sort((a: LogEntry, b: LogEntry) => b.at - a.at);
return merged.slice(0, 120);
} | https://github.com/popsiclelmlm/Hey | a8609fc4e805c4ab4fa6a7b5e0adfe85d1b9d700 | github |
the-wwyang/kids-learning-app | src/main/ets/services/ScoreService.ets | arkts | getMathScore | 获取数学题目分数 | public getMathScore(difficulty: string): number {
switch (difficulty) {
case 'easy':
return ScoreConfig.MATH_CORRECT_EASY;
case 'medium':
return ScoreConfig.MATH_CORRECT_MEDIUM;
case 'hard':
return ScoreConfig.MATH_CORRECT_HARD;
default:
return ScoreConfig.M... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMathScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left difficulty AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public getMathScore(difficulty: string): number {
switch (difficulty) {
case 'easy':
return ScoreConfig.MATH_CORRECT_EASY;
case 'medium':
return ScoreConfig.MATH_CORRECT_MEDIUM;
case 'hard':
return ScoreConfig.MATH_CORRECT_HARD;
default:
return ScoreConfig.M... | https://github.com/the-wwyang/kids-learning-app | a1081b83870ee7262f0d585de69d1ec916e3db10 | github |
huaiminqin/TankWar-Master-with-Many-Tasks | game/src/main/ets/mission/MissionFactory.ets | arkts | createDecryptMission | 创建破译任务 - 在指定地点静止10秒破译密码 | static createDecryptMission(level: number): Mission {
const mission = new Mission(
`情报任务 ${level}`,
'前往敌方通讯站破译密码'
);
const decryptCount = Math.min(1 + Math.floor(level / 3), 3);
mission.addObjective({
type: MissionType.DECRYPT_CODE,
description: `破译 ${decryptCount} 个敌方密码`,... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDecryptMission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static createDecryptMission(level: number): Mission {
const mission = new Mission(
`情报任务 ${level}`,
'前往敌方通讯站破译密码'
);
const decryptCount = Math.min(1 + Math.floor(level / 3), 3);
mission.addObjective({
type: MissionType.DECRYPT_CODE,
description: `破译 ${decryptCount} 个敌方密码`,... | https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks | c482f04181da3e6d630840e061d1d2b427183fc8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TaskExecutor.ets | arkts | getTaskStatus | 获取任务状态 | getTaskStatus(taskId: string): TaskStatus | null {
const context = this.runningTasks.get(taskId);
return context?.status || null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTaskStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | getTaskStatus(taskId: string): TaskStatus | null {
const context = this.runningTasks.get(taskId);
return context?.status || null;
} | https://github.com/DaLongZhuaZi/manxia | 7c25d6d4bafb8b08a4438be8849ccb893dd9f5cc | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/managers/QemuVMManager.ets | arkts | initDeviceInfo | 初始化设备信息并传递给 Native 层 | private async initDeviceInfo() {
try {
// 获取设备类型
const deviceType = this.getDeviceTypeCode(deviceInfo.deviceType)
const model = deviceInfo.productModel || ''
console.info(`[QemuVMManager] 设备信息: type=${deviceInfo.deviceType}, model=${model}`)
// Worker 不可用时直接走 NAPI
... | 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 initDeviceInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async initDeviceInfo() {
try {
// 获取设备类型
const deviceType = this.getDeviceTypeCode(deviceInfo.deviceType)
const model = deviceInfo.productModel || ''
console.info(`[QemuVMManager] 设备信息: type=${deviceInfo.deviceType}, model=${model}`)
// Worker 不可用时直接走 NAPI
... | https://github.com/AetheriumSimulator/qemu-hmos | 191f6f977e01f6d7b7754b0616632178310cf489 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/pages/aiinsight/components/MarkdownRenderer.ets | arkts | parseInlineSegments | ---- 解析器 ----
解析行内 Markdown 语法(**加粗**、`代码`)为分段数组。 | function parseInlineSegments(text: string): MarkdownSegment[] {
const segments: MarkdownSegment[] = [];
let i = 0;
let buffer = '';
let inBold = false;
let inCode = false;
while (i < text.length) {
const ch = text.charAt(i);
// 内联代码
if (ch === '`' && !inBold) {
if (inCode) {
segm... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseInlineSegments AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function parseInlineSegments(text: string): MarkdownSegment[] {
const segments: MarkdownSegment[] = [];
let i = 0;
let buffer = '';
let inBold = false;
let inCode = false;
while (i < text.length) {
const ch = text.charAt(i);
// 内联代码
if (ch === '`' && !inBold) {
if (inCode) {
segm... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/components/MarkdownRenderer.ets#L40-L104 | 3e7ab330317659e966343812241f2a9479ba75c4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/JSONSourceParser.ets | arkts | createContext | 创建变量上下文 | private createContext(params: Record<string, Object | undefined>): VariableContext {
const context: VariableContext = {};
context['baseUrl'] = this.config.metadata.baseUrl;
// 手动复制params而不是使用展开运算符
const paramKeys = Object.keys(params);
for (const key of paramKeys) {
context[key] = params[ke... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation... | private createContext(params: Record<string, Object | undefined>): VariableContext {
const context: VariableContext = {};
context['baseUrl'] = this.config.metadata.baseUrl;
// 手动复制params而不是使用展开运算符
const paramKeys = Object.keys(params);
for (const key of paramKeys) {
context[key] = params[ke... | https://github.com/DaLongZhuaZi/manxia | 037026993470e63a9577bd42cc00e6900759ccd3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Process.ets | arkts | HandleUncaughtError | Thist is noreturn function.
Applies default or user-provided handler to an uncaught error and exits the program.
@param { Object } error Uncaught error | function HandleUncaughtError(error: Object): void {
errorHandler.handleUncaughtError(error);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left HandleUncaughtError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left error AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function HandleUncaughtError(error: Object): void {
errorHandler.handleUncaughtError(error);
} | https://gitcode.com/iop123123/arkts-static-skills | 89491a42abee53a2f7be43bc29ffe8a2cc5cd993 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/SessionView.ets | arkts | fitToScreen | Fit to screen | fitToScreen(): void {
if (this.viewWidth <= 0 || this.viewHeight <= 0) return;
const scaleX = this.viewWidth / this.desktopWidth;
const scaleY = this.viewHeight / this.desktopHeight;
this.viewScale = Math.min(scaleX, scaleY);
// Center the desktop
this.offsetX = (this.viewWidth - thi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fitToScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#propert... | fitToScreen(): void {
if (this.viewWidth <= 0 || this.viewHeight <= 0) return;
const scaleX = this.viewWidth / this.desktopWidth;
const scaleY = this.viewHeight / this.desktopHeight;
this.viewScale = Math.min(scaleX, scaleY);
// Center the desktop
this.offsetX = (this.viewWidth - thi... | https://github.com/tangwengang-del/freerdp-harmonyos | 34da2997240cd5bbaebf4e9112c6c039c1ba9439 | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/core/services/FocusTimerEngine.ets | arkts | getTodoName | 获取当前关联任务的名称(优先缓存,无缓存则查库) | async getTodoName(): Promise<string> {
try {
if (!this.hasTodo()) return '';
if (this.todoTitle.trim().length > 0) return this.todoTitle;
const todo = this.todoId <= 0 ? null : await this.getTodoRepository().findById(this.todoId);
const name = todo?.content || '';
this.todoTitle = na... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTodoName AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getTodoName(): Promise<string> {
try {
if (!this.hasTodo()) return '';
if (this.todoTitle.trim().length > 0) return this.todoTitle;
const todo = this.todoId <= 0 ? null : await this.getTodoRepository().findById(this.todoId);
const name = todo?.content || '';
this.todoTitle = na... | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L334-L345 | 932728ee2e171e79e635687f9ae0254d02b3940f | github |
apap6628114/nga_oh | entry/src/main/ets/service/NgaClient.ets | arkts | ngaRequest | NGA API 核心请求 | async function ngaRequest(path: string, method: http.RequestMethod,
params: Record<string, string>, body: string,
cookies: Cookies | undefined, baseUrl: string,
extraHeaders: Record<string, string> | undefined,
skipInchst?: boolean): Promise<object> {
if (!skipInchst && !params['__inchst']) {
params['__in... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left ngaRequest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_ann... | async function ngaRequest(path: string, method: http.RequestMethod,
params: Record<string, string>, body: string,
cookies: Cookies | undefined, baseUrl: string,
extraHeaders: Record<string, string> | undefined,
skipInchst?: boolean): Promise<object> {
if (!skipInchst && !params['__inchst']) {
params['__in... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/NgaClient.ets#L353-L402 | 34b7b3acaa952957a0971a910c44ee3400f61579 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/bookmarks/scripts/helpers.ets | arkts | encodeHtmlString | Escapes special characters to prevent HTML injection and structural breakage.
⚠️ CRITICAL: The ampersand (&) MUST be replaced first. If we replace '<' with '<'
first, the subsequent '&' replacement would corrupt it into '&lt;'.
@param text The raw string (bookmark name or URL).
@returns The safely escaped string... | function encodeHtmlString(text: string): string {
if (!text) return "";
let result = text;
result = result.replaceAll('&', '&');
result = result.replaceAll('<', '<');
result = result.replaceAll('>', '>');
result = result.replaceAll('"', '"'); // Double quotes must be escaped to avoid breaking... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left encodeHtmlString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function encodeHtmlString(text: string): string {
if (!text) return "";
let result = text;
result = result.replaceAll('&', '&');
result = result.replaceAll('<', '<');
result = result.replaceAll('>', '>');
result = result.replaceAll('"', '"'); // Double quotes must be escaped to avoid breaking... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 825616786b8526e58137bcabae1252f968a67f77 | github |
silence17/harmonydemo | entry/src/main/ets/util/BasicDataSource.ets | arkts | unregisterDataChangeListener | 注册数据改变的监听器
@param listener | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
Log.info('add listener')
//移除元素
this.listeners.splice(pos, 1)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
Log.info('add listener')
//移除元素
this.listeners.splice(pos, 1)
}
} | https://github.com/silence17/harmonydemo | 94f546a089d61bcaa479150d4c917f66b8d42567 | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | testByte_Short | 测试 i8 与 i16 | function testByte_Short() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc((5).toByte(), (42).toShort());
arktest.assertEQ(res, 5);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testByte_Short AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decl... | function testByte_Short() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc((5).toByte(), (42).toShort());
arktest.assertEQ(res, 5);
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | dfdf9524bfc92cb02556840346459fafd4c1383d | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getInterface | Returns ith direct superinterface of this class
@param {long} i index
@throws {TypeError} when i greater then num of interfaces
@returns {InterfaceType} type of ith superinterface
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getInterface(i: long): InterfaceType {
const iface = TypeAPI.getInterface(this.cls, i)
if (iface) {
return Type.resolve(iface.getDescriptor(), iface.getLinker()) as InterfaceType
}
throw new TypeError("no interface at " + i)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInterface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long A... | public getInterface(i: long): InterfaceType {
const iface = TypeAPI.getInterface(this.cls, i)
if (iface) {
return Type.resolve(iface.getDescriptor(), iface.getLinker()) as InterfaceType
}
throw new TypeError("no interface at " + i)
} | https://gitcode.com/iop123123/arkts-static-skills | ddd5f8be7039858a471d57df4dcc10c3c7c818b4 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/pages/StandardPageTemplate.ets | arkts | onBackPress | 返回键拦截
@returns true表示拦截,false表示默认处理 | onBackPress(): boolean {
console.info('[StandardPageTemplate] onBackPress');
// 可以在这里实现:未保存提示、双击退出等
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | onBackPress(): boolean {
console.info('[StandardPageTemplate] onBackPress');
// 可以在这里实现:未保存提示、双击退出等
return false;
} | https://github.com/LJ666-ui/harmony-health-care | b2a493024140252a6754d6d66708a1671532ec57 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleHealthCheck.ets | arkts | sendHealthCheck | -- Internal send -- | private async sendHealthCheck(): Promise<void> {
if (this.sent) return;
this.sent = true;
// Finalize consecutive backoff before serializing.
this.logConsecutiveBackoffEnd();
const base: Record<string, string> = this.core.requestBuilder.baseParams();
// Metrics contains only app version per d... | 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 sendHealthCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async sendHealthCheck(): Promise<void> {
if (this.sent) return;
this.sent = true;
// Finalize consecutive backoff before serializing.
this.logConsecutiveBackoffEnd();
const base: Record<string, string> = this.core.requestBuilder.baseParams();
// Metrics contains only app version per d... | https://github.com/Countly/countly-sdk-hos | 5f76bd5561ab585ff1cf2d80f6017507071dcf10 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/ContactListPresenter.ets | arkts | onShareDialogCancel | Share Cancel Button | onShareDialogCancel() {
HiLog.i(TAG, 'onShareDialogCancel !!! ');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onShareDialogCancel 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_bloc... | onShareDialogCancel() {
HiLog.i(TAG, 'onShareDialogCancel !!! ');
} | https://gitee.com/openharmony/applications_contacts.git | e2bec4fc52511c13d0dc603878dd333e3a7ec891 | gitee |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/http/AIStreamClient.ets | arkts | abortStream | 中止流式请求 | static abortStream(httpRequest: http.HttpRequest): void {
try {
httpRequest.off('dataReceive')
httpRequest.off('dataEnd')
httpRequest.destroy()
} catch (err) {
Logger.warn('Abort stream error: %{public}s', String(err))
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left abortStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left httpRequest AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | static abortStream(httpRequest: http.HttpRequest): void {
try {
httpRequest.off('dataReceive')
httpRequest.off('dataEnd')
httpRequest.destroy()
} catch (err) {
Logger.warn('Abort stream error: %{public}s', String(err))
}
} | https://github.com/encorexin/WordPressCMS | ca074a0d963933ee3e014808fa0bf15212c22a6b | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showBreakWord | 显示按词换行 Toast
@param {ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showBreakWord(message: string | ResourceStr): void {
IBestToast.show({
wordBreak: "break-word",
message: message
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showBreakWord 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#binary_expressi... | static showBreakWord(message: string | ResourceStr): void {
IBestToast.show({
wordBreak: "break-word",
message: message
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | cd439cdd44e2e8563bea9b972207e4f40ade33d1 | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | getNavStack | 获取默认栈名的路由栈,初次调用会创建一个实例,并入参到Navigation构造方法中
@param willShow 可选
@returns | public static getNavStack(willShow?: InterceptionShowCallback): NavPathStack {
return ZRouter.getRouterMgr().getNavStackByName(DEFAULT_STACK_NAME, willShow)
} | 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 getNavStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left willShow AST#identifier#Right AST#?#Left ? ... | public static getNavStack(willShow?: InterceptionShowCallback): NavPathStack {
return ZRouter.getRouterMgr().getNavStackByName(DEFAULT_STACK_NAME, willShow)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L244-L246 | 2e6b8679a9e4e6400467472619147e58bb7e0ebe | github |
OHPG/FinSdk | emby/src/main/ets/api/SystemApi.ets | arkts | shutdownApplication | shutdownApplication
@summary Shuts down the application.
@throws {RequiredError}
@memberof SystemApi | public async shutdownApplication(): Promise<void> {
return this.apiClient.post({ path: "/System/Shutdown" })
} | 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 shutdownApplication AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public async shutdownApplication(): Promise<void> {
return this.apiClient.post({ path: "/System/Shutdown" })
} | https://github.com/OHPG/FinSdk | 2db00bd2359fb644e631dbd0e0b21dc45059462d | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/Windows11Config.ets | arkts | enableSecureBoot | 启用/禁用 Secure Boot | static enableSecureBoot(vmName: string, enable: boolean): boolean {
try {
return qemu.enableSecureBoot(vmName, enable);
} catch (e) {
console.error(`[Windows11Config] Secure Boot 设置失败: ${e}`);
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enableSecureBoot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static enableSecureBoot(vmName: string, enable: boolean): boolean {
try {
return qemu.enableSecureBoot(vmName, enable);
} catch (e) {
console.error(`[Windows11Config] Secure Boot 设置失败: ${e}`);
return false;
}
} | https://github.com/AetheriumSimulator/qemu-hmos | 12b3e7ed50df5567b23086879ef6423a8d3d8e98 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | ecmaDayFromYear | Returns first day of a given year since epoch.
@param year
@returns day from year
@see ECMA-262, 21.4.1.3, DayFromYear | function ecmaDayFromYear(year: int): int {
return (365 * (year - 1970) +
floor((year - 1969) / 4.0) -
floor((year - 1901) / 100.0) +
floor((year - 1601) / 400.0)).toInt();
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaDayFromYear AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function ecmaDayFromYear(year: int): int {
return (365 * (year - 1970) +
floor((year - 1969) / 4.0) -
floor((year - 1901) / 100.0) +
floor((year - 1601) / 400.0)).toInt();
} | https://gitcode.com/iop123123/arkts-static-skills | 2bedd049f9318e74356a22130fc5ae791b8cef1c | gitcode |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | setWebpOptimizeDecoding | 设置默认解码是否使用优化webp图片解码
没有调用时,默认不启用
设置为true后,图片会优化Webp解码,以减小解码后的图片内存占用
如果Webp图片设置了图形变换,则不会应用该解码优化,仍然使用默认的解码方式
启用后,GetCacheImage接口可能获取到非RGBA像素的格式的pixelmap
@param enable 是否开启webp解码优化 | setWebpOptimizeDecoding(enable: boolean) {
nativeNode.setWebpOptimizeDecoding(enable);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setWebpOptimizeDecoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#ide... | setWebpOptimizeDecoding(enable: boolean) {
nativeNode.setWebpOptimizeDecoding(enable);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L386-L388 | 3b1e63d48b1d0d142fab070663e6b594af7395dd | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets | arkts | reject | Create a rejected promise
@param { Error } value value to reject promise with
@returns { Promise } rejected promise | static reject<U = never>(error: Error): Promise<Awaited<U>> {
let p = new Promise<Awaited<U>>();
p.rejectImpl(error, false);
return p;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left reject AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST#identifier#Left never AST#identifier#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameter... | static reject<U = never>(error: Error): Promise<Awaited<U>> {
let p = new Promise<Awaited<U>>();
p.rejectImpl(error, false);
return p;
} | https://gitcode.com/iop123123/arkts-static-skills | f8fb301f175a2f44dacb5078f3f5782cb3b4e4ea | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets | arkts | has | 检查是否在缓存中 | public has(pageId: string): boolean {
return this.cache.has(pageId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public has(pageId: string): boolean {
return this.cache.has(pageId);
} | https://github.com/DaLongZhuaZi/manxia | 2a1cc55bf8097d4f18cc8fec43631bd9449847c5 | github |
openharmony/arkui_ace_engine | examples/Image/entry/src/main/ets/pages/example/ImageSVG2Example.ets | arkts | getSvgFilter | 根据选择的特效返回对应的滤镜 | getSvgFilter(): string {
return this.getFilterByKey(this.selectedEffect);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSvgFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement... | getSvgFilter(): string {
return this.getFilterByKey(this.selectedEffect);
} | https://gitcode.com/openharmony/arkui_ace_engine | df37776a9de872b59f886515ed195983aff2c4e5 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getCurrentDate | 获取当前时间:yyyyMMdd
@returns | public static getCurrentDate(): string {
const now = new Date();
// 提取时间组件
const year = now.getFullYear().toString();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始需+1
const day = now.getDate().toString().padStart(2, '0');
return `${year}${month}${day}`;
} | 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 getCurrentDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getCurrentDate(): string {
const now = new Date();
// 提取时间组件
const year = now.getFullYear().toString();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始需+1
const day = now.getDate().toString().padStart(2, '0');
return `${year}${month}${day}`;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/DateUtils.ets#L11-L19 | c8148cf5f0d96379bdf358159bd5cd8f1a9f70d9 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | getAllBillTags | 获取所有账单标签关联(用于导出)
@param userId 用户ID
@returns 账单标签关联数组 | static async getAllBillTags(userId: number): Promise<BillTag[]> {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT bt.*
FROM bill_tags bt
INNER JOIN bills b ON bt.bill_id = b.bill_id
INNER JOIN accounts a ON b.account_id = a.account_id
WHERE a.user_id = ? AND b.... | 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 getAllBillTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ... | static async getAllBillTags(userId: number): Promise<BillTag[]> {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT bt.*
FROM bill_tags bt
INNER JOIN bills b ON bt.bill_id = b.bill_id
INNER JOIN accounts a ON b.account_id = a.account_id
WHERE a.user_id = ? AND b.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 4635bb946b1246ce9cf25d35737be98ef54d597e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts longs array to JSON format
@param d: FixedArray<long> - longs array to be converted to a JSON as an Array of Numbers
@returns String - JSON representation of longs array | public static stringify(d: FixedArray<long>): String {
let s = new StringBuilder('[')
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(d[i])
s.append(',')
}
if (d.length > 0) {
s.append(d[last_elem])
}
... | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: FixedArray<long>): String {
let s = new StringBuilder('[')
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append(d[i])
s.append(',')
}
if (d.length > 0) {
s.append(d[last_elem])
}
... | https://gitcode.com/iop123123/arkts-static-skills | 6409a70f13bdfeec1d24c8bd86c0320d19d1b14f | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | failingAssertion | Produce AssertionError unconditionally
@param {string} message Optional comment printed when the assertion fails.
@param {string} [description] description comment printed when the assertion fails.
@throws {AssertionError} Thrown when the condition is false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | function failingAssertion(message: string, description?: string): never {
throw new AssertionError((description ? description + "\n" : "") + message)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left failingAssertion AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function failingAssertion(message: string, description?: string): never {
throw new AssertionError((description ? description + "\n" : "") + message)
} | https://gitcode.com/iop123123/arkts-static-skills | a0fc30f192a3d0445579e8cedd48f9e6b74370d3 | gitcode |
zgzm78/VMALL | entry/src/main/ets/common/utils/SearchHistoryManager.ets | arkts | clearHistory | 清除搜索历史记录 | public async clearHistory(): Promise<void> {
this.searchHistory = [];
} | 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 clearHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async clearHistory(): Promise<void> {
this.searchHistory = [];
} | https://github.com/zgzm78/VMALL | c93dbd724b52e256d7297498278775626ce26994 | github |
Zhiyilang074811/enterprise-ai-assistant | harmony_app/entry/src/main/ets/services/ApiService.ets | arkts | parseSSE | 解析SSE响应 | private parseSSE(
data: string,
onChunk: (content: string, knowledgeHits?: KnowledgeHit[]) => void,
onComplete: () => void
): void {
const lines = data.split('\n');
let knowledgeHits: KnowledgeHit[] | undefined;
for (const line of lines) {
if (line.startsWith('data: ')) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left parseSSE AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R... | private parseSSE(
data: string,
onChunk: (content: string, knowledgeHits?: KnowledgeHit[]) => void,
onComplete: () => void
): void {
const lines = data.split('\n');
let knowledgeHits: KnowledgeHit[] | undefined;
for (const line of lines) {
if (line.startsWith('data: ')) {
... | https://github.com/Zhiyilang074811/enterprise-ai-assistant | 889d8932ff28e46c323c8cfa16d6b85fdad6c982 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/Rect.ets | arkts | exactCenterX | @return the exact horizontal center of the rectangle as a float. | public exactCenterX(): number {
return (this.left + this.right) * 0.5;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left exactCenterX 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 exactCenterX(): number {
return (this.left + this.right) * 0.5;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 14b6d85eb35b76a85f5f03687017505527e61906 | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | getConversations | ============ 会话管理 ============
获取会话列表
@param params 查询参数 | async getConversations(params?: {
type?: ConversationType
isPinned?: boolean
isMuted?: boolean
page?: number
pageSize?: number
}): Promise<ApiResponse<{ conversations: Conversation[]; total: number }>> {
return this.client.get<{ conversations: Conversation[]; total: number }>('/api/v1/im/con... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getConversations AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_... | async getConversations(params?: {
type?: ConversationType
isPinned?: boolean
isMuted?: boolean
page?: number
pageSize?: number
}): Promise<ApiResponse<{ conversations: Conversation[]; total: number }>> {
return this.client.get<{ conversations: Conversation[]; total: number }>('/api/v1/im/con... | https://github.com/David8Idira/AI-OA | 7da1aa66dd0cf843f8e027a3aec1e68d318b448a | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/pages/HabitDetailPage.ets | arkts | milestoneTitleStyle | 里程碑副标题样式 (如"累计里程碑") | @Extend(Text)
function milestoneTitleStyle() {
.fontSize(14)
.fontColor('#666')
.fontWeight(FontWeight.Bold)
.width('100%')
.margin({ bottom: 10, top: 5 })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | @Extend(Text)
function milestoneTitleStyle() {
.fontSize(14)
.fontColor('#666')
.fontWeight(FontWeight.Bold)
.width('100%')
.margin({ bottom: 10, top: 5 })
} | https://gitcode.com/openharmony/codelabs | b33accf13267d38b3e1257b8e1cc549cb70e8cce | gitcode |
Jack-TCN/richEditor | src/main/ets/controller/RichEditorController.ets | arkts | onDidChange | 编辑区域发生变化时调用方法
@param start
@param end | onDidChange(start: number | undefined, end: number | undefined){
if (start !== undefined && end !== undefined) {
if (end - start <= 0) {
return;
}
// 设置文本字体样式
const textStyle: TextStyle = new TextStyle({
fontWeight: this.currentBold ? FontWeight.Bold : FontWeight.Normal,
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDidChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left n... | onDidChange(start: number | undefined, end: number | undefined){
if (start !== undefined && end !== undefined) {
if (end - start <= 0) {
return;
}
// 设置文本字体样式
const textStyle: TextStyle = new TextStyle({
fontWeight: this.currentBold ? FontWeight.Bold : FontWeight.Normal,
... | https://github.com/Jack-TCN/richEditor | f76a4f5eca16d1a3c6ab361acdbbb98e3e474f57 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getChapterCachePath | 获取章节缓存目录路径
路径: suwayomi/chapters/{mangaTitle}/{chapterTitle}/ | public getChapterCachePath(mangaTitle: string, chapterTitle: string): string {
if (!DownloadDirManager.isReady()) {
throw new Error('Download目录未初始化');
}
const sanitizedManga = this.sanitizeName(mangaTitle);
const sanitizedChapter = this.sanitizeName(chapterTitle);
return DownloadDirManager.e... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getChapterCachePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | public getChapterCachePath(mangaTitle: string, chapterTitle: string): string {
if (!DownloadDirManager.isReady()) {
throw new Error('Download目录未初始化');
}
const sanitizedManga = this.sanitizeName(mangaTitle);
const sanitizedChapter = this.sanitizeName(chapterTitle);
return DownloadDirManager.e... | https://github.com/DaLongZhuaZi/manxia | 6736624bf1a5b5332bf9729d7e05b9516065414e | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/local/LocalFileStorage.ets | arkts | read | 读取文件内容
@param path 文件路径
@return Promise<ArrayBuffer> 文件内容
@throws 如果读取失败则抛出异常 | public async read(path: string): Promise<ArrayBuffer> {
return this.checkFilePermission(path, fileShare.OperationMode.READ_MODE).then((result) => {
return this.doRead(path);
});
} | 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 read AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right ... | public async read(path: string): Promise<ArrayBuffer> {
return this.checkFilePermission(path, fileShare.OperationMode.READ_MODE).then((result) => {
return this.doRead(path);
});
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L65-L69 | 640bd2ed8f3a4467095f2d1b55d277d41acb0a24 | github |
RoooyHe/toona-ohos | toona/src/main/ets/database/LocalDatabase.ets | arkts | saveUser | ── User CRUD ── | async saveUser(user: User): Promise<void> {
if (!this.userDao) {
throw new Error('Database not initialized');
}
try {
const entity = this.userToEntity(user);
await this.userDao.insert(entity);
} catch (error) {
LocalDatabase.logger.error('Failed to save user:', error);
c... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveUser AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left user AST#identifier#Right AST#type_a... | async saveUser(user: User): Promise<void> {
if (!this.userDao) {
throw new Error('Database not initialized');
}
try {
const entity = this.userToEntity(user);
await this.userDao.insert(entity);
} catch (error) {
LocalDatabase.logger.error('Failed to save user:', error);
c... | https://github.com/RoooyHe/toona-ohos | fcf501768a40dd5c709a277e7f9b176e337efdee | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts String to JSON format
@param d: String - byte to be converted to a JSON as a String
@returns String - JSON representation of byte | public static stringify(d: String): String {
const len = d.getLength()
if (len == 0) {
return '""'
}
let needsEscaping = false
let hasSurrogates = false
let finalSize = len + 2
for (let i = 0; i < len; i++) {
const code = d.charCodeA... | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: String): String {
const len = d.getLength()
if (len == 0) {
return '""'
}
let needsEscaping = false
let hasSurrogates = false
let finalSize = len + 2
for (let i = 0; i < len; i++) {
const code = d.charCodeA... | https://gitcode.com/iop123123/arkts-static-skills | 34caeaa40fa89b0e97ba581bf82cfbe08e69a8dd | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/NetworkBoostService.ets | arkts | reportInternal | ───── reportQoe ───── | private reportInternal(state: StreamQoeState): void {
if (!this.supported || this.lastState === state) {
return;
}
this.lastState = state;
const qoeType: netQuality.QoeType = state === 'good' ? 'good' : 'highLatency';
try {
const appQoe: netQuality.AppQoe = {
serviceType: STREA... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reportInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private reportInternal(state: StreamQoeState): void {
if (!this.supported || this.lastState === state) {
return;
}
this.lastState = state;
const qoeType: netQuality.QoeType = state === 'good' ? 'good' : 'highLatency';
try {
const appQoe: netQuality.AppQoe = {
serviceType: STREA... | https://github.com/AlkaidLab/moonlight-harmony | ae7c125d17538a4a566464064f447be5aa94c70f | github |
codelably/HCompass | entry/src/main/ets/entryability/AppInterceptors.ets | arkts | logResponse | 打印响应日志 | private logResponse(response: AxiosResponse): void {
const config: InternalAxiosRequestConfig = response.config as InternalAxiosRequestConfig;
const url: string = this.buildRequestUrl(config);
const status: string = String(response.status);
const data: string = this.safeStringify(response.data as Unkn... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left response AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private logResponse(response: AxiosResponse): void {
const config: InternalAxiosRequestConfig = response.config as InternalAxiosRequestConfig;
const url: string = this.buildRequestUrl(config);
const status: string = String(response.status);
const data: string = this.safeStringify(response.data as Unkn... | https://github.com/codelably/HCompass | 89e370d455d92dba282cfc421e4eeae3a17a0be3 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_sheen.ets | arkts | setSheenChannel | Adjust individual sheen channel values | setSheenChannel(idx: number, v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).sheen.factor;
if (idx === 0) { f.x = GAIN * v / RESO; }
if (idx === 1) { f.y = GAIN * v / RESO; }
if (idx === 2) { f.z = GAIN * v / RESO; }
if (idx === 3) { f.w... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSheenChannel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left idx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ... | setSheenChannel(idx: number, v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).sheen.factor;
if (idx === 0) { f.x = GAIN * v / RESO; }
if (idx === 1) { f.y = GAIN * v / RESO; }
if (idx === 2) { f.z = GAIN * v / RESO; }
if (idx === 3) { f.w... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | d06eee8f23d22317610d168ac5a51fd90620fd59 | gitcode |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_specular.ets | arkts | setSpecularIntensity | Adjust the overall specular intensity | setSpecularIntensity(v: number) {
if (this.material) {
const f = (this.material as MetallicRoughnessMaterial).specular.factor;
const w = 100 * v / RESO;
(this.material as MetallicRoughnessMaterial).specular.factor = { x: f.x, y: f.y, z: f.z, w: w };
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSpecularIntensity 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#R... | setSpecularIntensity(v: number) {
if (this.material) {
const f = (this.material as MetallicRoughnessMaterial).specular.factor;
const w = 100 * v / RESO;
(this.material as MetallicRoughnessMaterial).specular.factor = { x: f.x, y: f.y, z: f.z, w: w };
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 6d6dff8fdc30bc6ef293788953ea3a7ad6a361f0 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_minus/unary_minus_long.ets | arkts | main | ---
desc: check unary minus operation for long integer operand
--- | function main(): void {
const value: long = {{v.value}}
assert -(value) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const value: long = {{v.value}}
assert -(value) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9529f8b4663b3ef50aba2880b75783a95dbca024 | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleFeedback.ets | arkts | openExternalUrl | See ModuleContent.openExternalUrl, identical two-tier lookup. | private openExternalUrl(url: string): void {
const opener = this.externalUrlOpener;
if (opener !== null) {
try { opener(url); }
catch (err) { this.config.logger.e(`[ModuleFeedback] externalUrlOpener threw: ${err}`); }
return;
}
Utils.openExternalUrlViaContext(this.config.context, url... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openExternalUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private openExternalUrl(url: string): void {
const opener = this.externalUrlOpener;
if (opener !== null) {
try { opener(url); }
catch (err) { this.config.logger.e(`[ModuleFeedback] externalUrlOpener threw: ${err}`); }
return;
}
Utils.openExternalUrlViaContext(this.config.context, url... | https://github.com/Countly/countly-sdk-hos | 6b4eaec8875828cf75e97c05d64cc724aad30c01 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Double.ets | arkts | createFromJSONValue | Creates a Double instance based on JSONValue
@param json: JSONValue - a JSON representation
@throws JSONTypeError if json does not encode a valid double
@returns Double - double value decoded from JSON | static createFromJSONValue(json: JSONValue): Double {
if (json instanceof JSONNumber) {
return Double.valueOf((json as JSONNumber).value)
}
throw new JSONTypeError("Cannot create Double from JSON", json)
} | 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): Double {
if (json instanceof JSONNumber) {
return Double.valueOf((json as JSONNumber).value)
}
throw new JSONTypeError("Cannot create Double from JSON", json)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a1cfe6249cabac29d3f79338177686577cf81d98 | gitee |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets | arkts | getInstance | Get instance of treeListenerManager.
@return treeListenerManager instance.
@static
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Get instance of treeListenerManager.
@return treeListenerManager instance.
@static
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | static getInstance(): TreeListenerManager {
if (AppStorage.get<TreeListenerManager>('app_key_event_bus') === undefined) {
AppStorage.setOrCreate('app_key_event_bus', new TreeListenerManager())
}
return AppStorage.get<TreeListenerManager>('app_key_event_bus') as TreeListenerManager;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 TreeListen... | static getInstance(): TreeListenerManager {
if (AppStorage.get<TreeListenerManager>('app_key_event_bus') === undefined) {
AppStorage.setOrCreate('app_key_event_bus', new TreeListenerManager())
}
return AppStorage.get<TreeListenerManager>('app_key_event_bus') as TreeListenerManager;
} | https://gitcode.com/openharmony/arkui_ace_engine | 23cb0a18fd625617f4bbb145eb45588e8826645f | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DashboardPage.ets | arkts | getCurrentDate | 获取当前日期字符串 (YYYY-MM-DD) | getCurrentDate(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stateme... | getCurrentDate(): string {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
} | https://gitcode.com/openharmony/codelabs | 1837302fec6f3ffabdf88a83401cac8bf960b07a | gitcode |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/OrderRepository.ets | arkts | refundOrder | 申请订单退款
@param params 退款请求参数
@returns 是否成功 | async refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.refundOrder(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refundOrder 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 : A... | async refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.refundOrder(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7d913aa0a140d0d36c8ef47a5920dfbe6f9890bb | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.