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 |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorBitwiseNot | Performs bitwise NOT operation on the BigInt.
@returns { BigInt } The result of the bitwise NOT.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorBitwiseNot(): BigInt {
let len = this.length() + 1
let res: ValueArray<int> = new ValueArray<int>(len)
for (let i = 0; i<len; i++) {
res[i] = i < this.length() ? this.bytes[i] : 0
}
if (this.negative()) {
res = BigInt.to2sComplement(res... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorBitwiseNot 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 Big... | public operatorBitwiseNot(): BigInt {
let len = this.length() + 1
let res: ValueArray<int> = new ValueArray<int>(len)
for (let i = 0; i<len; i++) {
res[i] = i < this.length() ? this.bytes[i] : 0
}
if (this.negative()) {
res = BigInt.to2sComplement(res... | https://gitcode.com/iop123123/arkts-static-skills | f6a6102bc304e8e3a91d4ebece4b1e86f538ba72 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getCurrentTheme | 获取当前主题(异步,确保完全初始化) | public async getCurrentTheme(): Promise<ThemeType> {
await this.ensureInitialized();
return this.currentTheme;
} | 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 getCurrentTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async getCurrentTheme(): Promise<ThemeType> {
await this.ensureInitialized();
return this.currentTheme;
} | https://github.com/DaLongZhuaZi/manxia | c20f3ab3e9ed430300a24c2f40481cdf556b053a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | searchBySeries | 通过系列ID搜索作品列表
@param seriesId 系列ID
@param page 页码
@returns 搜索结果 | async searchBySeries(seriesId: string, page: number = 1): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法执行系列搜索');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_NOT_LOADED,
'配置未加载'
);
}
const startTime = Date.now();
log... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left searchBySeries AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left seriesId AST#identifier#Right ... | async searchBySeries(seriesId: string, page: number = 1): Promise<EngineResult<SearchResult>> {
if (!this.config) {
logger.error(TAG, '配置未加载,无法执行系列搜索');
throw new MangaSourceError(
MangaSourceErrorCode.CONFIG_NOT_LOADED,
'配置未加载'
);
}
const startTime = Date.now();
log... | https://github.com/DaLongZhuaZi/manxia | 04ba31c84592a95df0e05a625ee191c5daa7b049 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Either.ets | arkts | isLeft | Checks if Either is Left
@returns { boolean } If Either is Left
@syscap SystemCapability.Utils.Lang
@final
@FaAndStageModel | public final isLeft(): boolean {
return this.isLeft_
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left isLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ... | public final isLeft(): boolean {
return this.isLeft_
} | https://gitcode.com/iop123123/arkts-static-skills | e2ed2ced6cab8bfc83a7b2aa0803d6f943e84b8c | gitcode |
openharmony-sig/ohos_circle_indicator | library/src/main/ets/components/MagicScrollTabsIndicator.ets | arkts | computeWidth1 | 计算指示器宽度 | computeWidth1(index: number): number {
let width = 0
if (this.model.getDividerWidthMode() == DividerWidthMode.MODE_EXACTLY) {
width = this.model.getDividerWidth()
} else {
if (this.model.getSelectedTextSize()) {
width = (this.model.getTextModel().getTextWidthList()[index]
- thi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left computeWidth1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ... | computeWidth1(index: number): number {
let width = 0
if (this.model.getDividerWidthMode() == DividerWidthMode.MODE_EXACTLY) {
width = this.model.getDividerWidth()
} else {
if (this.model.getSelectedTextSize()) {
width = (this.model.getTextModel().getTextWidthList()[index]
- thi... | https://gitee.com/openharmony-sig/ohos_circle_indicator.git | 739953d1a36452c09bb96312d90e4da8746455d0 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/StringUtils.ets | arkts | removeStart | 移除字符串开头的指定字符串
@param str
@param start
@returns | public static removeStart(str: string, start: string): string {
if (!str || !start) {
return str;
}
return str.startsWith(start) ? str.substring(start.length) : str;
} | 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 removeStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:... | public static removeStart(str: string, start: string): string {
if (!str || !start) {
return str;
}
return str.startsWith(start) ? str.substring(start.length) : str;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/StringUtils.ets#L13-L18 | 0275139dbc58bb4bd4ce0dccce937cb648695bd7 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentSourceViewModel.ets | arkts | registerDataChangeListener | 注册数据变化监听器
@param dataChangeListeners DataChangeListener | public registerDataChangeListener(dataChangeListeners: DataChangeListener): void {
if (this.dataChangeListeners.indexOf(dataChangeListeners) < 0) {
this.dataChangeListeners.push(dataChangeListeners)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataChangeListeners AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identi... | public registerDataChangeListener(dataChangeListeners: DataChangeListener): void {
if (this.dataChangeListeners.indexOf(dataChangeListeners) < 0) {
this.dataChangeListeners.push(dataChangeListeners)
}
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | e3366e2d2a22d454d6d3694c5feafbd5796be5cf | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | map | Creates a new Float32Array using fn(arr[i]) over all elements of current Float32Array.
@param { function } fn - a function to apply for each element of current Float32Array
@returns { Float32Array } - a new Float32Array where for each element from current Float32Array fn was applied
@syscap SystemCapability.Utils.Lang
... | public map(fn: (val: number, index: int, array: Float32Array) => number): Float32Array {
let resBuf = new ArrayBuffer(this.lengthInt * Float32Array.BYTES_PER_ELEMENT)
let res = new Float32Array(resBuf, 0, (resBuf.getByteLength() / Float32Array.BYTES_PER_ELEMENT).toInt())
for (let i = 0; i < ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right... | public map(fn: (val: number, index: int, array: Float32Array) => number): Float32Array {
let resBuf = new ArrayBuffer(this.lengthInt * Float32Array.BYTES_PER_ELEMENT)
let res = new Float32Array(resBuf, 0, (resBuf.getByteLength() / Float32Array.BYTES_PER_ELEMENT).toInt())
for (let i = 0; i < ... | https://gitcode.com/iop123123/arkts-static-skills | 650399346edf9608bbc4c1cc57b528c608634b63 | gitcode |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/model/repository/RecordRepository.ets | arkts | createRecord | =================================================================
1. 基础增删改查
=================================================================
新增记录 (支持心情和心得) | createRecord(habitId: number, mood: number = 1, note: string = ''): Promise<number> {
const store = RdbHelper.getRdbStore();
if (!store) {
return Promise.reject('DB not initialized');
}
const valueBucket: relationalStore.ValuesBucket = {
habitId: habitId,
createTime: new Date().getT... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left createRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left habitId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | createRecord(habitId: number, mood: number = 1, note: string = ''): Promise<number> {
const store = RdbHelper.getRdbStore();
if (!store) {
return Promise.reject('DB not initialized');
}
const valueBucket: relationalStore.ValuesBucket = {
habitId: habitId,
createTime: new Date().getT... | https://gitcode.com/openharmony/codelabs | 84cfaaf1ba36d7f4add0fe62df0b08342ff0e6e0 | gitcode |
ZestBox-18/kitebook-frontend | features/reports/src/main/ets/utils/ReportDataHelper.ets | arkts | loadCategoryReport | 加载分类报表数据,仅统计支出类流水并复用分类表中的系统图标。 | static async loadCategoryReport(timeDimension: TimeDimensionEnum): Promise<CategoryStatBean[]> {
const range: TimeRange = ReportDataHelper.buildCurrentRange(timeDimension);
const expenseBills: BillBean[] =
await BillManager.getBillsByRange(range.startTime, range.endTime, BillTypeEnum.EXPENSE);
const... | 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 loadCategoryReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeDimension AST#identifier#Right AS... | static async loadCategoryReport(timeDimension: TimeDimensionEnum): Promise<CategoryStatBean[]> {
const range: TimeRange = ReportDataHelper.buildCurrentRange(timeDimension);
const expenseBills: BillBean[] =
await BillManager.getBillsByRange(range.startTime, range.endTime, BillTypeEnum.EXPENSE);
const... | https://github.com/ZestBox-18/kitebook-frontend | 6821c6ace47f62d0e34ed1b6ea95c4ac361e0770 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/avPlayerManager.ets | arkts | changePlay | 核心修改:切歌逻辑 | async changePlay() {
if (!this.avPlayer) return
await this.avPlayer.reset()
this.GlobalMusic.time = 0
this.GlobalMusic.duration = 0
const song = this.GlobalMusic.songList[this.GlobalMusic.currentMusic]
// 1. 更新全局元数据
this.GlobalMusic.currentID = song.id // 确保 ID 被同步,用于子组件判断
this.Glo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left changePlay AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Rig... | async changePlay() {
if (!this.avPlayer) return
await this.avPlayer.reset()
this.GlobalMusic.time = 0
this.GlobalMusic.duration = 0
const song = this.GlobalMusic.songList[this.GlobalMusic.currentMusic]
// 1. 更新全局元数据
this.GlobalMusic.currentID = song.id // 确保 ID 被同步,用于子组件判断
this.Glo... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/avPlayerManager.ets#L83-L107 | caa435d6bcf4294c754fce9f6a4187a0d277da61 | github |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVPlayer/entry/src/main/ets/model/DataModel.ets | arkts | pushData | Add data. | public pushData(data: VideoData): void {
this.dataArray.push(data);
this.notifyDataAdd(this.dataArray.length - 1);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left VideoDa... | public pushData(data: VideoData): void {
this.dataArray.push(data);
this.notifyDataAdd(this.dataArray.length - 1);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | c9d81b8aafee3f08f2408630681f2911fd8da67f | gitcode |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/ShopExportImportManager.ets | arkts | validateShareData | 验证分享数据格式 | private validateShareData(data: ShopShareData): boolean {
if (!data || typeof data !== 'object') return false;
if (!Array.isArray(data.shops)) return false;
if (data.version !== 1) return false;
for (let i = 0; i < data.shops.length; i++) {
const shop = data.shops[i];
if (!shop.shopName |... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateShareData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private validateShareData(data: ShopShareData): boolean {
if (!data || typeof data !== 'object') return false;
if (!Array.isArray(data.shops)) return false;
if (data.version !== 1) return false;
for (let i = 0; i < data.shops.length; i++) {
const shop = data.shops[i];
if (!shop.shopName |... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 6f2927f3dbad969e78247e8412a9ba55587b6fb6 | github |
dingzhilin1990/zhilinclaw | src/plugins/PluginManager.ets | arkts | unregister | 卸载插件
@param name 插件名称 | public async unregister(name: string): Promise<void> {
const wrapper = this.plugins.get(name);
if (!wrapper) {
throw new Error(`插件不存在:${name}`);
}
// 先禁用
if (wrapper.enabled) {
await this.disable(name);
}
// 调用插件卸载钩子
if (wrapper.plugin.onUnload) {
await wrapper.plug... | 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 unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#... | public async unregister(name: string): Promise<void> {
const wrapper = this.plugins.get(name);
if (!wrapper) {
throw new Error(`插件不存在:${name}`);
}
// 先禁用
if (wrapper.enabled) {
await this.disable(name);
}
// 调用插件卸载钩子
if (wrapper.plugin.onUnload) {
await wrapper.plug... | https://github.com/dingzhilin1990/zhilinclaw | 096e073fb71ccdf2e9ecb617c65f352641c4d483 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | mapMouseButton | 将 HarmonyOS MouseButton 映射到 MoonBridge 鼠标按钮常量 | private mapMouseButton(button: MouseButton): number {
switch (button) {
case MouseButton.Left: return BUTTON_LEFT; // 0x01
case MouseButton.Middle: return BUTTON_MIDDLE; // 0x02
case MouseButton.Right: return BUTTON_RIGHT; // 0x03
case MouseButton.Back:
return this.view... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapMouseButton AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left button AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private mapMouseButton(button: MouseButton): number {
switch (button) {
case MouseButton.Left: return BUTTON_LEFT; // 0x01
case MouseButton.Middle: return BUTTON_MIDDLE; // 0x02
case MouseButton.Right: return BUTTON_RIGHT; // 0x03
case MouseButton.Back:
return this.view... | https://github.com/AlkaidLab/moonlight-harmony | 5b3aa0be2eb6b153947a980b4bc697d5b34eaa47 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets | arkts | clearAllCookies | 清除所有Cookie | async clearAllCookies(): Promise<void> {
this.cookies.clear();
await this.saveCookies();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearAllCookies AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Righ... | async clearAllCookies(): Promise<void> {
this.cookies.clear();
await this.saveCookies();
} | https://github.com/DaLongZhuaZi/manxia | b382e7f8819d0897d1602d13245bc4e93955c340 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | handleTabChanged | 切换 Tab 时更新索引并处理动画
@param {number} index - 选中的索引
@returns {void} 无返回值 | handleTabChanged(index: number): void {
this.updateCurrentPage(index);
this.playSelectedAnimation(index);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleTabChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left... | handleTabChanged(index: number): void {
this.updateCurrentPage(index);
this.playSelectedAnimation(index);
} | https://github.com/Joker-x-dev/CoolMallArkTS | bc5b4375aa2902c243107a1fbe9ece575ac8ecb0 | github |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageDestroy | 窗口销毁时调用
释放窗口资源
@returns {void} 无返回值 | onWindowStageDestroy(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expre... | onWindowStageDestroy(): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS | ac5ed1c9a9361b21313383ec9b77d9d137406486 | github |
openharmony/arkui_ace_engine | examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets | arkts | Test006 | E2E_006: LayeredDrawableDescriptor release() -> getMask() 抛出 111002 | Test006() {
const id = 'E2E_006'
try {
let drawable = new LayeredDrawableDescriptor()
drawable.release()
try {
drawable.getMask()
this.Fail(id, '预期抛出 111002 但未抛出')
} catch (e) {
let code = this.GetErrorCode(e as Object)
if (code === 111002) {
t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Test006 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#... | Test006() {
const id = 'E2E_006'
try {
let drawable = new LayeredDrawableDescriptor()
drawable.release()
try {
drawable.getMask()
this.Fail(id, '预期抛出 111002 但未抛出')
} catch (e) {
let code = this.GetErrorCode(e as Object)
if (code === 111002) {
t... | https://gitcode.com/openharmony/arkui_ace_engine | 7a024b3591db3666d18f02917b4c900167c817e2 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | UTC | Returns the number of milliseconds elapsed since the epoch,
which is defined as the midnight at the beginning of January 1, 1970, UTC.
@param year to be converted to milliseconds.
@param month to be converted to milliseconds.
@param day to be converted to milliseconds.
@param hours to be converted to milliseconds.
@par... | public static UTC(year: long, month: long, day: long, hours: long, minutes: long, seconds: long, ms: long): long {
return ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, ms))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left UTC AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#ide... | public static UTC(year: long, month: long, day: long, hours: long, minutes: long, seconds: long, ms: long): long {
return ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, ms))
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6e0358a715b7f069a065ce525cd6af793188de9d | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets | arkts | set | Puts a pair of key and value into the Map
@param key the key to put into the Map
@param val the value to put into the Map | set(key: K, val: V): this {
// rehash
if (this.numEntries * 4 >= this.cap * 3) {
this.rehash(Map.computeCapacityForGrow(this.cap, this.sizeVal, this.numEntries))
}
// check bucket
let bucketIdx = this.getBucketIndex(key)
let bucket = this.getBucketByIdx(b... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#i... | set(key: K, val: V): this {
// rehash
if (this.numEntries * 4 >= this.cap * 3) {
this.rehash(Map.computeCapacityForGrow(this.cap, this.sizeVal, this.numEntries))
}
// check bucket
let bucketIdx = this.getBucketIndex(key)
let bucket = this.getBucketByIdx(b... | https://gitcode.com/iop123123/arkts-static-skills | e1723367729a99824cb050c742e9b72dccdb8377 | gitcode |
huangyuanlove/HelloArkUI | entry/src/main/ets/pages/playground/take_photo/TakePhotoPage.ets | arkts | getAllSupportSizeStr | 展示在弹窗中的列表 | getAllSupportSizeStr(profileArray: camera.Profile[]): string[] {
let result: string[] = []
for (let i = 0; i < profileArray.length; i++) {
result.push(this.getSupportSizeStr(profileArray[i]))
}
return result
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAllSupportSizeStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#subscript_expression#Left AST#member_expression#Left AST#identifier#Left profileArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | getAllSupportSizeStr(profileArray: camera.Profile[]): string[] {
let result: string[] = []
for (let i = 0; i < profileArray.length; i++) {
result.push(this.getSupportSizeStr(profileArray[i]))
}
return result
} | https://github.com/huangyuanlove/HelloArkUI | 63ab6d399f27602c89ccb92bcaccd03f0eeb841e | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGRoot.ets | arkts | setXMLNS | 设置SVG文件的命名空间
@param xmlns SVG文件的命名空间 | public setXMLNS(xmlns: string): void {
this.attributesObj[XMLConstants.XMLNS_PREFIX] = xmlns;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setXMLNS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xmlns AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | public setXMLNS(xmlns: string): void {
this.attributesObj[XMLConstants.XMLNS_PREFIX] = xmlns;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | f672222bf528773410b231b390f3d49ea1902776 | gitee |
openharmony-sig/shimmer-ohos | library/src/main/ets/components/MainPage/Shimmer.ets | arkts | setClipToChildren | Sets whether the shimmer will clip to the childrens' contents, or if it will opaquely draw on
top of the children. | setClipToChildren(status: boolean): Shimmer {
this.clipToChildren = status;
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setClipToChildren AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#L... | setClipToChildren(status: boolean): Shimmer {
this.clipToChildren = status;
return this
} | https://gitee.com/openharmony-sig/shimmer-ohos.git | 902f48a513b48865bb1cc920fabfc8ae6e5b8354 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/FTP/FTPNativeClient.ets | arkts | destroy | 销毁客户端 | destroy(): void {
if (nativeModule?.ftpDestroy) {
nativeModule.ftpDestroy();
}
this.initialized = false;
logger.info(TAG, 'FTP客户端已销毁');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AS... | destroy(): void {
if (nativeModule?.ftpDestroy) {
nativeModule.ftpDestroy();
}
this.initialized = false;
logger.info(TAG, 'FTP客户端已销毁');
} | https://github.com/DaLongZhuaZi/manxia | 73287fdee6d48f3fa9914b83c41f35ae49d8df73 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/addition/addition_uint.ets | arkts | main | ---
desc: check addition of two unsigned integers
--- | function main(): void {
const a: uint = {{v.left}}
const b: uint = {{v.right}}
assert (a + b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: uint = {{v.left}}
const b: uint = {{v.right}}
assert (a + b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6253cf2c4725a69f6a08f4c59ce1eb3ea8ed1bbb | gitee |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets | arkts | elapsedBreakSeconds | Returns total break seconds that have elapsed before the given clock second,
handling cross-midnight wrap. | public elapsedBreakSeconds(beforeClockSecond: number): number {
const sorted: BreakScheduleEntry[] = [...this.breaks].sort(
(a: BreakScheduleEntry, b: BreakScheduleEntry) => a.startMinutes - b.startMinutes
)
const beforeMinute: number = Math.floor(beforeClockSecond / 60)
let total: number = 0
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left elapsedBreakSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left beforeClockSecond AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left num... | public elapsedBreakSeconds(beforeClockSecond: number): number {
const sorted: BreakScheduleEntry[] = [...this.breaks].sort(
(a: BreakScheduleEntry, b: BreakScheduleEntry) => a.startMinutes - b.startMinutes
)
const beforeMinute: number = Math.floor(beforeClockSecond / 60)
let total: number = 0
... | https://github.com/OMGCA/sakipay | f9f8ce0c1ec00d2858e0f474f4b32da048baaf03 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | getFirst | Returns the current head element without removing it.
Returns undefined when the queue is empty.
@returns { T | undefined } The current head element when the queue is not empty,
else undefined when the queue is empty.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getFirst(): T | undefined {
ConcurrencyHelpers.mutexLock(this.pushMutex);
ConcurrencyHelpers.mutexLock(this.popMutex);
try {
let element = this.head.next?.element;
return element;
} finally {
ConcurrencyHelper... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFirst AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_st... | public getFirst(): T | undefined {
ConcurrencyHelpers.mutexLock(this.pushMutex);
ConcurrencyHelpers.mutexLock(this.popMutex);
try {
let element = this.head.next?.element;
return element;
} finally {
ConcurrencyHelper... | https://gitcode.com/iop123123/arkts-static-skills | 33783b1eb5147701003c42f616d0206b0b2a2525 | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/RectF.ets | arkts | getCenterX | 获取矩形中心点X轴坐标
@returns x坐标 | public getCenterX(): number {
this.check(this.left, this.top, this.right, this.bottom);
return this.left + (this.right - this.left) / 2;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCenterX 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#numb... | public getCenterX(): number {
this.check(this.left, this.top, this.right, this.bottom);
return this.left + (this.right - this.left) / 2;
} | https://github.com/wuba/omni-ui | fadca4d98434999bc28d3ea7d4ed610f69ef1226 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CloudWishlistService.ets | arkts | requestRedemption | Submit a redemption request and persist a local pending entry so the
overlay survives navigation. Returns the requestId on success or
empty string on failure (item inactive, network error, or unbound). | async requestRedemption(itemId: string, displayName: string, costCoins: number): Promise<string> {
const snap: CloudCredentialsSnapshot = await this.credentials.load();
if (!snap.isBound() || snap.deviceToken.length === 0) {
return '';
}
const baseReq: string = CloudWishlistService.trim(this.res... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestRedemption AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left itemId AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async requestRedemption(itemId: string, displayName: string, costCoins: number): Promise<string> {
const snap: CloudCredentialsSnapshot = await this.credentials.load();
if (!snap.isBound() || snap.deviceToken.length === 0) {
return '';
}
const baseReq: string = CloudWishlistService.trim(this.res... | https://github.com/terryma2024/happyword | 6ee260e3038c075696d8bad6aa2b3ce0b8d8d81c | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | writeFloat32 | Writes the next float.
@param value The value.
@param littleEndian If the value is little endian. | writeFloat32(value: number, littleEndian?: boolean): void {
this.checkWriteCapacity(4)
this.setFloat32(this.mByteOffset, value, littleEndian)
this.mByteOffset += 4
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeFloat32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , A... | writeFloat32(value: number, littleEndian?: boolean): void {
this.checkWriteCapacity(4)
this.setFloat32(this.mByteOffset, value, littleEndian)
this.mByteOffset += 4
} | https://gitee.com/openharmony-sig/flutter_engine.git | acc5578de2cf7097ba7adf8d110eeb331994403f | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/LifecycleObserver.ets | arkts | synthesiseForegroundIfNeeded | Cold-boot fg synthesis for the late-create case. HMOS lifecycle events
fire on transitions only, so when `Countly.createInstance('name', cfg)`
runs while the host UIAbility is already in foreground, the cold-boot
`applicationStateChange` foreground transition already fired and our
observer (subscribed by `register()` l... | public async synthesiseForegroundIfNeeded(): Promise<void> {
if (this.dispatchedFg) return;
if (this.appContext === null) return;
try {
const infos: appManager.ProcessInformation[] = await this.appContext.getRunningProcessInformation();
let foreground: boolean = false;
for (let i = 0; i ... | 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 synthesiseForegroundIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi... | public async synthesiseForegroundIfNeeded(): Promise<void> {
if (this.dispatchedFg) return;
if (this.appContext === null) return;
try {
const infos: appManager.ProcessInformation[] = await this.appContext.getRunningProcessInformation();
let foreground: boolean = false;
for (let i = 0; i ... | https://github.com/Countly/countly-sdk-hos | ade9cb4a26adc1d1d58f0dc987422e5861527a66 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | reload | 重新加载请求,忽略已过期、已加载成功的请求。不能用于预加载请求的重试
@param requestId 图片加载请求的ID信息,通过ImageInfo.requestId获取 | reload(requestId: string): void {
nativeNode.reload(requestId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Right... | reload(requestId: string): void {
nativeNode.reload(requestId);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L145-L147 | 6cfa5ee1c9c216aae9a0dfc8d6cdc11f82464b90 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_or/bitwise_or_uint.ets | arkts | main | ---
desc: check bitwise OR of two unsigned integers
--- | function main(): void {
const a: uint = {{v.left}}
const b: uint = {{v.right}}
assert (a | b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: uint = {{v.left}}
const b: uint = {{v.right}}
assert (a | b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 60a15b2ce9ea3c80a4ee2576d34bff5dcd47e9f6 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartBudgetPlan.ets | arkts | linearRegression | 线性回归预测 | static linearRegression(data: number[]): LinearRegressionResult {
const n = data.length;
if (n === 0) {
const empty: LinearRegressionResult = {
slope: 0,
intercept: 0
};
return empty;
}
let sumX = 0;
let sumY = 0;
let sumXY = 0;
let sumX2 = 0;
for (l... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left linearRegression AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre... | static linearRegression(data: number[]): LinearRegressionResult {
const n = data.length;
if (n === 0) {
const empty: LinearRegressionResult = {
slope: 0,
intercept: 0
};
return empty;
}
let sumX = 0;
let sumY = 0;
let sumXY = 0;
let sumX2 = 0;
for (l... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a5de905db26003af6cfa9fa4188aa4c20fb344ec | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/FootprintViewModel.ets | arkts | aboutToAppear | 页面显示时回调
@returns {void} 无返回值 | aboutToAppear(): void {
this.loadFootprints();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.loadFootprints();
} | https://github.com/Joker-x-dev/CoolMallArkTS | b3e7d17351be9c8a9f9faba11ce0fd2dfa2e5d63 | github |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/database/RdbHelper.ets | arkts | initRdbStore | 初始化数据库
创建两张表:用户表 和 账号记录表 | public initRdbStore(callback: Function): void {
if (this.rdbStore) {
callback(true);
return;
}
relationalStore.getRdbStore(this.context, RdbHelper.STORE_CONFIG, (err, store) => {
if (err) {
console.error(`[RdbHelper] Get RdbStore failed: ${err.message}`);
callback(false)... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public initRdbStore(callback: Function): void {
if (this.rdbStore) {
callback(true);
return;
}
relationalStore.getRdbStore(this.context, RdbHelper.STORE_CONFIG, (err, store) => {
if (err) {
console.error(`[RdbHelper] Get RdbStore failed: ${err.message}`);
callback(false)... | https://gitcode.com/openharmony/codelabs | 32d84d86399d526403926a7b763d0d935f5cf006 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates an Uint32Array with respect to buf.
@param buf data initializer | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / Uint32Array.BYTES_PER_ELEMENT)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#R... | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / Uint32Array.BYTES_PER_ELEMENT)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b424239a98befb343bb0e09115f668efd20d8b93 | gitee |
erosTeam/NextE | feature/reader/src/main/ets/viewmodel/ReaderViewModel.ets | arkts | ensureSequential | Sequential fallback (perPage unknown): extend one preview page at a time until past `index`. | private async ensureSequential(index: number): Promise<void> {
while (!this.exhausted && !this.hasPreviewAt(index)) {
const before: number = this.previewMapUpperBound()
await this.loadMore()
if (this.previewMapUpperBound() === before) {
break
}
}
} | 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 ensureSequential AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Lef... | private async ensureSequential(index: number): Promise<void> {
while (!this.exhausted && !this.hasPreviewAt(index)) {
const before: number = this.previewMapUpperBound()
await this.loadMore()
if (this.previewMapUpperBound() === before) {
break
}
}
} | https://github.com/erosTeam/NextE | 4a29dfabf14f77a3df5176351f6c923f51bb1906 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets | arkts | initSystemConfig | Initialize system configuration to AppStorage
@param config System configuration | private static initSystemConfig(config: AbilityConfiguration): void {
try {
// 设置系统颜色模式到 AppStorage
AppStorage.setOrCreate('currentColorMode', config.colorMode);
hilog.info(0x0000, 'ContextProvider', 'System colorMode initialized: %{public}d', config.colorMode);
// 设置系统语言到 AppStorage
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left initSystemConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#L... | private static initSystemConfig(config: AbilityConfiguration): void {
try {
// 设置系统颜色模式到 AppStorage
AppStorage.setOrCreate('currentColorMode', config.colorMode);
hilog.info(0x0000, 'ContextProvider', 'System colorMode initialized: %{public}d', config.colorMode);
// 设置系统语言到 AppStorage
... | https://github.com/Tencent-RTC/TUIKit_Harmony | 7bf4a096af63486034f1a48bc288b3da90daaad2 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/navigation/GoodsGraph.ets | arkts | register | 注册商品模块导航路由 | register(): void {
RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav));
RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav));
RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav));
RouteBuild.register(GoodsRoutes.Category, wrapBuilder(GoodsCategoryNav)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | register(): void {
RouteBuild.register(GoodsRoutes.Detail, wrapBuilder(GoodsDetailNav));
RouteBuild.register(GoodsRoutes.Search, wrapBuilder(GoodsSearchNav));
RouteBuild.register(GoodsRoutes.Comment, wrapBuilder(GoodsCommentNav));
RouteBuild.register(GoodsRoutes.Category, wrapBuilder(GoodsCategoryNav)... | https://github.com/Joker-x-dev/CoolMallArkTS | 4d7412fe54ada17a9dc4eceb9a76c2c6f37c3868 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/AppColors.ets | arkts | coverCornerRadius | 获取封面图片圆角大小 | static get coverCornerRadius(): number {
try {
const themeManager = ThemeManager.getInstance();
return themeManager.getUserCoverCornerRadius();
} catch {
return 12;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left coverCornerRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | static get coverCornerRadius(): number {
try {
const themeManager = ThemeManager.getInstance();
return themeManager.getUserCoverCornerRadius();
} catch {
return 12;
}
} | https://github.com/DaLongZhuaZi/manxia | c50ed8afdc45d064d419dcb9dbf8f251cfc2aae2 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/model/Reminder.ets | arkts | getTimingText | 获取提醒时机的显示文本 | getTimingText(): string {
switch (this.timing) {
case ReminderTiming.ON_TIME:
return '准时提醒'
case ReminderTiming.MINUTES_5:
return '提前5分钟'
case ReminderTiming.MINUTES_10:
return '提前10分钟'
case ReminderTiming.MINUTES_15:
return '提前15分钟'
case ReminderTimin... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTimingText 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#statemen... | getTimingText(): string {
switch (this.timing) {
case ReminderTiming.ON_TIME:
return '准时提醒'
case ReminderTiming.MINUTES_5:
return '提前5分钟'
case ReminderTiming.MINUTES_10:
return '提前10分钟'
case ReminderTiming.MINUTES_15:
return '提前15分钟'
case ReminderTimin... | https://gitcode.com/openharmony/codelabs | d8ce6b339bddcc0b1e90c24fbfcad07cc771bb82 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/25.bitwise_and_logical_expressions/02.boolean_logical_operators/logical_bitwise_boolean.ets | arkts | main | ---
desc: Bitwise logical operations (Boolean)
params: {{i.xorigin}} {{i.op}} {{i.yorigin}} == {{i.dest}}
--- | function main(): void {
let x: Boolean = {{i.xorigin}};
let y: Boolean = {{i.yorigin}};
let dest: Boolean = {{i.dest}};
assert((x {{i.op}} y) == dest); | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let x: Boolean = {{i.xorigin}};
let y: Boolean = {{i.yorigin}};
let dest: Boolean = {{i.dest}};
assert((x {{i.op}} y) == dest); | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7521b2afb2317759775a16e6632ff6d0baa1877f | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | includes | Checks if specified argument is in Int8Array
@param e search element
@param fromIndex start index to search from
@returns true if e is in Int8Array, false otherwise | public includes(e: number, fromIndex: number): boolean {
return this.includes(e as double as int as byte, fromIndex as int)
} | 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, fromIndex: number): boolean {
return this.includes(e as double as int as byte, fromIndex as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b67471c6c4248550f109e115f63a42d44b9d5667 | gitee |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/features/login/src/main/ets/pages/LoginPage.ets | arkts | handleHWLogin | Use the Account Kit to log in to the API to obtain data such as UnionID and OpenID. | handleHWLogin() {
let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
loginRequest.forceLogin = true;
loginRequest.state = util.generateRandomUUID();
// Executing login request.
try {
let controller = new authentication.AuthenticationController(getConte... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleHWLogin 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... | handleHWLogin() {
let loginRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest();
loginRequest.forceLogin = true;
loginRequest.state = util.generateRandomUUID();
// Executing login request.
try {
let controller = new authentication.AuthenticationController(getConte... | https://gitcode.com/HarmonyOS_Samples/hmosworld | cefc1d4e43c4980d4a9b12a05c09416feaad4938 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableStringArray.ets | arkts | popBack | Pops a value from the end of the List
@returns { UndefinableString } Popped value
@throws { RangeError } When the array is empty
@syscap SystemCapability.Utils.Lang | public popBack(): UndefinableString {
if (this.curSize === 0) {
throw new RangeError("No data to popBack from UndefinableStringArray!")
}
--this.curSize
return this.data[this.curSize]
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left popBack 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 UndefinableStr... | public popBack(): UndefinableString {
if (this.curSize === 0) {
throw new RangeError("No data to popBack from UndefinableStringArray!")
}
--this.curSize
return this.data[this.curSize]
} | https://gitcode.com/iop123123/arkts-static-skills | 8e0039616d07762a8e508e1904beb79ec8e12a06 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | timeZoneString | TODO Until TZ support implemented, the time is calculated in UTC+0 and TZ string is hardcoded | private timeZoneString(): String {
let sb = new StringBuilder();
sb.append("GMT");
let offset = -this.TZOffset;
let hours = offset / 60;
if (hours < 0) {
sb.append("-");
} else {
sb.append("+")
}
if (abs(hours) < 10) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left timeZoneString 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 Stri... | private timeZoneString(): String {
let sb = new StringBuilder();
sb.append("GMT");
let offset = -this.TZOffset;
let hours = offset / 60;
if (hours < 0) {
sb.append("-");
} else {
sb.append("+")
}
if (abs(hours) < 10) {
... | https://gitcode.com/iop123123/arkts-static-skills | 0983eb80da6651f5e4da4e1a2132da5ab1da3d3d | gitcode |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/widget2/pages/Widget2Card.ets | arkts | onShow | 生命周期:卡片显示时打印当前数据 | onShow(): void {
console.info(`[Widget2Card] onShow: shop1=${this.shop1}, count1=${this.count1}, shop2=${this.shop2}, count2=${this.count2}`)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left ... | onShow(): void {
console.info(`[Widget2Card] onShow: shop1=${this.shop1}, count1=${this.count1}, shop2=${this.shop2}, count2=${this.count2}`)
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 6bb0ece6a675d36e0ea32a13f8d9260160efb1ae | github |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | getErrnoToString | 获取系统错误码对应的详细信息
@param errno 错误码
@returns | static getErrnoToString(errno: number): string {
return util.errnoToString(errno);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getErrnoToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left errno AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static getErrnoToString(errno: number): string {
return util.errnoToString(errno);
} | https://github.com/tdcare/tdwebrtc | 578ed8abc5a67e5825d823039d4f35573eab265a | github |
popsiclelmlm/Hey | entry/src/main/ets/features/assets/AssetsController.ets | arkts | getFileStatus | 获取本地 dat 文件大小和修改日期 | getFileStatus(context: common.Context, fileName: string, language: AppLanguage): string {
const path = `${context.filesDir}/${fileName}`;
try {
if (fs.accessSync(path)) {
const stat = fs.statSync(path);
const sizeMb = (stat.size / (1024 * 1024)).toFixed(2);
const date = new Date(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFileStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common AST#i... | getFileStatus(context: common.Context, fileName: string, language: AppLanguage): string {
const path = `${context.filesDir}/${fileName}`;
try {
if (fs.accessSync(path)) {
const stat = fs.statSync(path);
const sizeMb = (stat.size / (1024 * 1024)).toFixed(2);
const date = new Date(... | https://github.com/popsiclelmlm/Hey | 530a7d94e9442e2552fce0ff7632ac45ecbf1da2 | github |
arkui-x/samples | CodeLab/Cases/feature/customkeyboardtoh5/src/main/ets/components/TitleBar.ets | arkts | registerFunc | 注册方法到h5的js中 | registerFunc(browser: Browser) {
if (!browser.isRegistered) {
browser.webController.registerJavaScriptProxy(this.webKeyboardObj, 'etsObj',
['login', 'openDialog'])
browser.isRegistered = true;
browser.webController.refresh();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerFunc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left browser AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Browser AST#identifier#Ri... | registerFunc(browser: Browser) {
if (!browser.isRegistered) {
browser.webController.registerJavaScriptProxy(this.webKeyboardObj, 'etsObj',
['login', 'openDialog'])
browser.isRegistered = true;
browser.webController.refresh();
}
} | https://gitcode.com/arkui-x/samples | c135c3393b9fdd26d9cf19a253b067218aeaf4ec | gitcode |
openharmony-sig/ohos_checksum | library/src/main/ets/md5.ets | arkts | safe_add | Add integers, wrapping at 2^32. This uses 16-bit operations internally
to work around bugs in some JS interpreters. | safe_add(x: number, y: number) :number {
let lsw = (x & 0xFFFF) + (y & 0xFFFF);
let msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left safe_add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Rig... | safe_add(x: number, y: number) :number {
let lsw = (x & 0xFFFF) + (y & 0xFFFF);
let msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
} | https://gitee.com/openharmony-sig/ohos_checksum.git | 5d0ca8944ab5f39b52266c875fe22a4b9476595f | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | subarray | Creates a Int32Array with the same ArrayBuffer
@returns new Int32Array with the same ArrayBuffer | public subarray(): Int32Array {
return this.subarray(0, this.length)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray 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 Int32Array AS... | public subarray(): Int32Array {
return this.subarray(0, this.length)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bfa8a1b41b12285889b1085d23c11ba0bc4674e4 | gitee |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | connectInner | 连接蓝牙设备 | private connectInner(gattClientDevice: ble.GattClientDevice): boolean {
Log.showInfo(TAG, `connectInner`);
try {
if (!gattClientDevice) {
Log.showWarn(TAG, `connectInner: mGattClientDevice is null`);
return false;
}
// 订阅连接状态改变消息
this.onBLEConnectionStateChange();
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left connectInner AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left gattClientDevice AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Rig... | private connectInner(gattClientDevice: ble.GattClientDevice): boolean {
Log.showInfo(TAG, `connectInner`);
try {
if (!gattClientDevice) {
Log.showWarn(TAG, `connectInner: mGattClientDevice is null`);
return false;
}
// 订阅连接状态改变消息
this.onBLEConnectionStateChange();
... | https://gitcode.com/arkui-x/samples | fb2842b289f6ed3d5248335ca8b247c89f7570c5 | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/NetworkManager.ets | arkts | getDefaultPortForwardings | 获取默认端口转发配置 | private getDefaultPortForwardings(): PortForwarding[] {
return [
{
name: 'RDP',
hostPort: 3390,
guestPort: 3389,
protocol: 'tcp',
description: 'Windows 远程桌面'
},
{
name: 'SSH',
hostPort: 2222,
guestPort: 22,
protocol: 'tcp',
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDefaultPortForwardings 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#identifie... | private getDefaultPortForwardings(): PortForwarding[] {
return [
{
name: 'RDP',
hostPort: 3390,
guestPort: 3389,
protocol: 'tcp',
description: 'Windows 远程桌面'
},
{
name: 'SSH',
hostPort: 2222,
guestPort: 22,
protocol: 'tcp',
... | https://github.com/AetheriumSimulator/qemu-hmos | 3da83ad74141bfeba5cda86fd852285353d611f4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an Uint32Array with respect to data, byteOffset and length.
@param { ArrayBuffer } buf - data initializer
@param { Number | undefined } byteOffset - byte offset from begin of the buf
@param { Number | undefined } length - size of elements of type long in newly created Uint32Array
@throws { RangeError } - Input ... | public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) {
let intByteOffset: int = 0
if (byteOffset != undefined) {
intByteOffset = byteOffset.toInt()
if (intByteOffset < 0) {
throw new RangeError("Range Error: byteOffs... | 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 buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array... | public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) {
let intByteOffset: int = 0
if (byteOffset != undefined) {
intByteOffset = byteOffset.toInt()
if (intByteOffset < 0) {
throw new RangeError("Range Error: byteOffs... | https://gitcode.com/iop123123/arkts-static-skills | 2d58f5f3533890243b4df60e92514ed842d1a0cb | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getDataSetIndexForIndex | Returns the index of the DataSet this x-index belongs to.
@param xIndex
@return | public getDataSetIndexForIndex(xIndex: number): number {
if (!this.mData) {
return -1;
}
let dataSets: JArrayList<IPieDataSet> = this.mData.getDataSets();
for (let i: number = 0; i < dataSets.size(); i++) {
if (dataSets.get(i).getEntryForXValue(xIndex, Number.NaN) != null)
return... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSetIndexForIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xIndex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public getDataSetIndexForIndex(xIndex: number): number {
if (!this.mData) {
return -1;
}
let dataSets: JArrayList<IPieDataSet> = this.mData.getDataSets();
for (let i: number = 0; i < dataSets.size(); i++) {
if (dataSets.get(i).getEntryForXValue(xIndex, Number.NaN) != null)
return... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e449567d50435dcf8e934b689e5d789cdceb5829 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets | arkts | constructor | Creates a new empty instance of SparseArray.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.buffer = new Map<int, T>()
this.maxLength = 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.buffer = new Map<int, T>()
this.maxLength = 0
} | https://gitcode.com/iop123123/arkts-static-skills | 18e4bed7e051dca76350ca097bc0336cec4780ee | gitcode |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/pages/Apps.ets | arkts | executeRDPCommand | 通过 RDP 执行命令
使用键盘输入模拟:Win+R -> 输入命令 -> Enter | private async executeRDPCommand(command: string): Promise<void> {
// 简化实现:仅记录日志,实际键盘输入需要 Native 支持
console.info(`[Apps] executeRDPCommand: ${command}`);
// 模拟执行延迟
await new Promise<void>(resolve => setTimeout(resolve, 500));
/* 原 Native 实现(需要 qemu 模块支持 rdpSendKeyEvent)
try {
//... | 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 executeRDPCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left command AST#identifier#Right AST#ERROR#Left AST#:#... | private async executeRDPCommand(command: string): Promise<void> {
// 简化实现:仅记录日志,实际键盘输入需要 Native 支持
console.info(`[Apps] executeRDPCommand: ${command}`);
// 模拟执行延迟
await new Promise<void>(resolve => setTimeout(resolve, 500));
/* 原 Native 实现(需要 qemu 模块支持 rdpSendKeyEvent)
try {
//... | https://github.com/AetheriumSimulator/qemu-hmos | fbb3fb213dd4bef75a60cfa3f7e3ee9fa82272d4 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | createEventFromBill | ==================== 核心模型集成方法 ====================
从Bill对象创建创建事件
@param bill 账单对象 | static createEventFromBill(bill: Bill): DomainEvent {
const billJson = JSON.stringify(bill.toJSON());
return EventSourcingUtils.createBillCreatedEvent(
bill.userId,
bill.billId,
billJson
);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEventFromBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bill AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static createEventFromBill(bill: Bill): DomainEvent {
const billJson = JSON.stringify(bill.toJSON());
return EventSourcingUtils.createBillCreatedEvent(
bill.userId,
bill.billId,
billJson
);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3e6371a1750b199350b23209ee21ff44e2e2b36b | github |
xblLab/HarmonyProjectTemplate | commons/lib_account/src/main/ets/services/AccountApi.ets | arkts | getUserAgreeInfo | 查询用户协议内容
@returns | public getUserAgreeInfo() {
return ProtocolData.userProtocol;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUserAgreeInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Lef... | public getUserAgreeInfo() {
return ProtocolData.userProtocol;
} | https://github.com/xblLab/HarmonyProjectTemplate | a154b25f1e8fe5ad39cef99796b7f974050d8614 | github |
YDYm233/EasyRandom_HarmonyNextApp | product/wearable/src/main/ets/utils/WearScreenUtil.ets | arkts | isRoundScreen | ==================== 形状检测 ====================
是否为圆形屏
基于 display.ScreenShape 检测(API 18+)
低于 API 18 或检测失败 → 默认方形屏 | static isRoundScreen(): boolean {
if (!WearScreenUtil._shapeDetected) {
WearScreenUtil._detectShape();
}
return WearScreenUtil._isRound === true;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isRoundScreen 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... | static isRoundScreen(): boolean {
if (!WearScreenUtil._shapeDetected) {
WearScreenUtil._detectShape();
}
return WearScreenUtil._isRound === true;
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | f29c47337f33f164b55be10a0f07970d35c7470a | github |
lidaixian999/Smart_Car | entry/src/main/ets/model/Ai_online.ets | arkts | processStreamResponse | 处理流式响应数据
@param responseStr - 响应字符串
@param callback - 回调函数 | function processStreamResponse(responseStr: string, callback?: (response: ChatResponse) => void): void {
try {
// 按行分割数据
const lines = responseStr.split('\n');
let fullContent = '';
lines.forEach((line, index) => {
if (line.trim()) {
console.info('响应行 ' + index + ': ' + ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left processStreamResponse AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left responseStr AST#identifier#Right AST#type_annotation#Left AST#:#... | function processStreamResponse(responseStr: string, callback?: (response: ChatResponse) => void): void {
try {
// 按行分割数据
const lines = responseStr.split('\n');
let fullContent = '';
lines.forEach((line, index) => {
if (line.trim()) {
console.info('响应行 ' + index + ': ' + ... | https://github.com/lidaixian999/Smart_Car | 38689d8456091c0148e664fcb4384a92ac2e6c61 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | isLocalCoverPath | 清理文件名中的非法字符(用于文件路径构建) | private isLocalCoverPath(path: string): boolean {
if (!path) {
return false;
}
if (path.startsWith('file://')) {
return true;
}
if (path.startsWith('/')) {
return true;
}
return /^[a-zA-Z]:[\\/]/.test(path);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isLocalCoverPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private isLocalCoverPath(path: string): boolean {
if (!path) {
return false;
}
if (path.startsWith('file://')) {
return true;
}
if (path.startsWith('/')) {
return true;
}
return /^[a-zA-Z]:[\\/]/.test(path);
} | https://github.com/DaLongZhuaZi/manxia | cefa40fbc51a7e4d8dad4fb6bb613df06c5cbf4c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSearchPage.ets | arkts | showSourceSelectorDialog | 显示书源选择弹窗 | showSourceSelectorDialog(): void {
// 获取已启用的可搜索书源
this.allAvailableSources = this.sourceManager.getEnabledSources()
.filter(s => s.searchable)
.sort((a, b) => {
// 置顶的排在前面
if (a.isTop && !b.isTop) return -1;
if (!a.isTop && b.isTop) return 1;
// 按名称排序
return... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showSourceSelectorDialog 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#sta... | showSourceSelectorDialog(): void {
// 获取已启用的可搜索书源
this.allAvailableSources = this.sourceManager.getEnabledSources()
.filter(s => s.searchable)
.sort((a, b) => {
// 置顶的排在前面
if (a.isTop && !b.isTop) return -1;
if (!a.isTop && b.isTop) return 1;
// 按名称排序
return... | https://github.com/DaLongZhuaZi/manxia | 8b9e0dc64271e172ef8ba80a46907228a8b009fd | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitInt64 | 访问 int64 字段
Wire type: 0 (varint) | visitInt64(value: bigint, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).int64(value)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitInt64 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 bigint AST#identifier#Right AST#,#Left , AST... | visitInt64(value: bigint, fieldNumber: number): void {
this.writer.tag(fieldNumber, 0).int64(value)
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | d8c3e098ca9754c699f8480d39df991c3be7db24 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitMapInt64Message | 访问 map<int64, message> 字段 | visitMapInt64Message(value: Map<bigint, Message>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 0).int64(k)
const nestedVisitor = new BinaryEncodingVisitor()
nestedVisitor.recursionDepth = this.recursionDepth + 1
if ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt64Message AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifi... | visitMapInt64Message(value: Map<bigint, Message>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 0).int64(k)
const nestedVisitor = new BinaryEncodingVisitor()
nestedVisitor.recursionDepth = this.recursionDepth + 1
if ... | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 5195a6eedc231c2f1d0e8378a2b1c89a5b0c4066 | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/AttendanceService.ets | arkts | parseAttendanceTable | ===== 解析考勤数据表 HTML ===== | private parseAttendanceTable(html: string, courseInfos: CourseInfo[]): ClassAttendance[] {
const results: ClassAttendance[] = [];
const tbodyRe: RegExp = /<tbody[^>]*>([\s\S]*?)<\/tbody>/;
const tbodyMatch = html.match(tbodyRe);
if (tbodyMatch === null) {
console.info(TAG, 'parseAttendanceTable... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseAttendanceTable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private parseAttendanceTable(html: string, courseInfos: CourseInfo[]): ClassAttendance[] {
const results: ClassAttendance[] = [];
const tbodyRe: RegExp = /<tbody[^>]*>([\s\S]*?)<\/tbody>/;
const tbodyMatch = html.match(tbodyRe);
if (tbodyMatch === null) {
console.info(TAG, 'parseAttendanceTable... | https://github.com/PollenWang6/HiXD | c4a2f2cc30e9445b6920a2d045eabb714233bdd9 | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/theme/SystemColorModeUtil.ets | arkts | applySystemColorMode | 立即应用系统颜色模式,mode 支持 dark、light、auto。
setColorMode 可能抛出系统异常,启动流程等关键调用方需要自行捕获并记录。 | static applySystemColorMode(context: common.UIAbilityContext, mode: string): void {
context.getApplicationContext().setColorMode(SystemColorModeUtil.getSystemColorMode(mode));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applySystemColorMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_e... | static applySystemColorMode(context: common.UIAbilityContext, mode: string): void {
context.getApplicationContext().setColorMode(SystemColorModeUtil.getSystemColorMode(mode));
} | https://github.com/ZestBox-18/kitebook-frontend | 049e29d0b35f080f1478af382019d8fc1c659165 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/ApiClient.ets | arkts | getCategoryTopics | 获取分类下的话题列表 | async getCategoryTopics(slug: string, id: number, page: number = 0): Promise<TopicListResponse> {
return await this.getFilteredTopics('latest', page, null, null, null, slug, id, null, null);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCategoryTopics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left slug AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getCategoryTopics(slug: string, id: number, page: number = 0): Promise<TopicListResponse> {
return await this.getFilteredTopics('latest', page, null, null, null, slug, id, null, null);
} | https://github.com/Amaz1ny/HarmonyDO-public | ec013c2e0fe5b1a1a68c16affc844045b9725b9f | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/utils/ToolKits.ets | arkts | getTimeStringAutoShort2 | 仿照微信中的消息时间显示逻辑,将时间戳(单位:毫秒)转换为友好的显示格式.
1)7天之内的日期显示逻辑是:今天、昨天(-1d)、前天(-2d)、星期?(只显示总计7天之内的星期数,即<=-4d);
2)7天之外(即>7天)的逻辑:直接显示完整日期时间。
@param timestamp 时间戳(单位:毫秒),形如:1550789954260
@param mustIncludeTime true表示输出的格式里一定会包含“时间:分钟”
,否则不包含(参考微信,不包含时分的情况,用于首页“消息”中显示时)
@param timeWithSegmentStr 本参数仅在mustIncludeTime=true时有生效,表示在时间字符串前... | static getTimeStringAutoShort2(timestamp: number, mustIncludeTime: boolean, timeWithSegmentStr: boolean): string {
// 当前时间
let currentDate: Date = new Date();
// 目标判断时间
let srcDate: Date = new Date(timestamp);
let currentYear: number = currentDate.getFullYear();
let currentMonth: number = (cu... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTimeStringAutoShort2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | static getTimeStringAutoShort2(timestamp: number, mustIncludeTime: boolean, timeWithSegmentStr: boolean): string {
// 当前时间
let currentDate: Date = new Date();
// 目标判断时间
let srcDate: Date = new Date(timestamp);
let currentYear: number = currentDate.getFullYear();
let currentMonth: number = (cu... | https://github.com/JackJiang2011/harmonychat | dba65df674945a8a3610cd7e41c9e6c2ed1cd6c3 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | getUTCMinutes | Returns the minutes in the specified date according to universal time.
@returns the minutes in the specified date according to universal time. | public getUTCMinutes(): byte {
return ecmaMinFromTime(this.ms);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCMinutes 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 byte AST... | public getUTCMinutes(): byte {
return ecmaMinFromTime(this.ms);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e8681fb886e4f09edb12f885cda4f514e7b0edb5 | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionGenerator.ets | arkts | getFillBlankMaxNum | 获取填空题最大数值
@param difficulty 难度等级
@returns 最大数值 | private static getFillBlankMaxNum(difficulty: Difficulty): number {
const maxNums: Record<Difficulty, number> = {
[Difficulty.EASY]: 10,
[Difficulty.MEDIUM]: 30,
[Difficulty.HARD]: 50
};
return maxNums[difficulty];
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getFillBlankMaxNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right A... | private static getFillBlankMaxNum(difficulty: Difficulty): number {
const maxNums: Record<Difficulty, number> = {
[Difficulty.EASY]: 10,
[Difficulty.MEDIUM]: 30,
[Difficulty.HARD]: 50
};
return maxNums[difficulty];
} | https://github.com/the-wwyang/kids-learning-app | d376ccaa903f8e770337ca3bc3e7f30f65db78ab | github |
openharmony/codelabs | Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets | arkts | switchPlayMode | Toggle playback mode. | switchPlayMode() {
this.playBarModel.playMode = (this.playBarModel.playMode + 1) % CommonConstants.MODE_QUANTITY;
if (this.playBarModel.playMode === PlayMode.LIST_LOOP) {
this.playBarModel.playModeIcon = $r('app.media.ic_list_mode');
} else if (this.playBarModel.playMode === PlayMode.SINGLE_LOOP) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switchPlayMode 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... | switchPlayMode() {
this.playBarModel.playMode = (this.playBarModel.playMode + 1) % CommonConstants.MODE_QUANTITY;
if (this.playBarModel.playMode === PlayMode.LIST_LOOP) {
this.playBarModel.playModeIcon = $r('app.media.ic_list_mode');
} else if (this.playBarModel.playMode === PlayMode.SINGLE_LOOP) {
... | https://gitee.com/openharmony/codelabs.git | 1d5b2b010a86b343010ea966640633c848a7d6df | gitee |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ReplyManager.ets | arkts | buildContent | 获取完整正文: 引用楼层时 content = quotePrefix + userText,否则 = userText | buildContent(userText: string): string {
if (this.ctx.quotePrefix && this.ctx.type === ReplyType.FLOOR) {
return this.ctx.quotePrefix + userText
}
return userText
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#... | buildContent(userText: string): string {
if (this.ctx.quotePrefix && this.ctx.type === ReplyType.FLOOR) {
return this.ctx.quotePrefix + userText
}
return userText
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ReplyManager.ets#L200-L205 | da2c1e685b132f3eea34d2bf5626dc32952bec02 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | innerHTML | 获取 innerHTML | get innerHTML(): string {
let html = '';
for (const child of this.childNodes) {
if (child.nodeType === NodeType.TEXT_NODE) {
html += (child as TextNode).rawText;
} else if (child.nodeType === NodeType.ELEMENT_NODE) {
html += (child as HTMLElement).outerHTML;
} else if (child.... | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left innerHTML 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 A... | get innerHTML(): string {
let html = '';
for (const child of this.childNodes) {
if (child.nodeType === NodeType.TEXT_NODE) {
html += (child as TextNode).rawText;
} else if (child.nodeType === NodeType.ELEMENT_NODE) {
html += (child as HTMLElement).outerHTML;
} else if (child.... | https://github.com/DaLongZhuaZi/manxia | ea593645eadf5d452027e38539cedcf3f8c0ad3a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/ReminderDAO.ets | arkts | insert | 插入提醒记录 | static async insert(reminder: Reminder): Promise<number> {
if (!reminder.validate()) {
throw new Error('[ReminderDAO] 插入失败,数据验证不通过');
}
const now = DAOHelper.now();
reminder.createdAt = now;
reminder.updatedAt = now;
const store = DatabaseManager.getDatabase();
const valueBucket: r... | 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 insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reminder AST#identifier#Right AST#:#Left : AST#:#... | static async insert(reminder: Reminder): Promise<number> {
if (!reminder.validate()) {
throw new Error('[ReminderDAO] 插入失败,数据验证不通过');
}
const now = DAOHelper.now();
reminder.createdAt = now;
reminder.updatedAt = now;
const store = DatabaseManager.getDatabase();
const valueBucket: r... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 88465f0c7cacc2be213b34f1aa2ad9d194100bf4 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | softDelete | 软删除标签 - 使用 DAOHelper 统一方法
注意:TagDAO 的软删除需要同时检查 user_id,所以保留自定义实现
@param userId 用户ID
@param tagId 标签ID | static async softDelete(userId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `UPDATE tags SET is_deleted = 1, updated_at = ? WHERE tag_id = ? AND user_id = ?`;
try {
await store.executeSql(sql, [now, tagId,... | 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 softDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#... | static async softDelete(userId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `UPDATE tags SET is_deleted = 1, updated_at = ? WHERE tag_id = ? AND user_id = ?`;
try {
await store.executeSql(sql, [now, tagId,... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5ce14aaa07760a7c87b6256a1d4464d0960b2d54 | github |
tdcare/tdwebrtc | example/MediaStreamAdvancedExample.ets | arkts | start | 启动媒体流 | public async start(): Promise<void> {
if (!this.mediaStream) {
return;
}
await this.mediaStream.startVideoCapture();
await this.mediaStream.startVideoDecoder();
await this.mediaStream.startAudioSending();
await this.mediaStream.startAudioReceiving();
console.log('[MediaStreamExample]... | 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 start AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A... | public async start(): Promise<void> {
if (!this.mediaStream) {
return;
}
await this.mediaStream.startVideoCapture();
await this.mediaStream.startVideoDecoder();
await this.mediaStream.startAudioSending();
await this.mediaStream.startAudioReceiving();
console.log('[MediaStreamExample]... | https://github.com/tdcare/tdwebrtc | 2d05da7c8e5880cb6ad55294e09793f146f84df2 | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/image/ImageUtil.ets | arkts | base64ToPixelMap | base64转PixelMap
@param {string} base64 图片base64字符串
@returns {Promise<image.PixelMap>} 返回图像的PixelMap对象 | static async base64ToPixelMap(base64: string): Promise<image.PixelMap> {
const reg: RegExp = new RegExp('data:image/\\w+;base64,');
const base64Str: string = base64.replace(reg, '');
const base64Helper: util.Base64Helper = new util.Base64Helper();
const uint8Array: Uint8Array = base64Helper.decodeSync... | 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 base64ToPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base64 AST#identifier#Right AST#:#Left ... | static async base64ToPixelMap(base64: string): Promise<image.PixelMap> {
const reg: RegExp = new RegExp('data:image/\\w+;base64,');
const base64Str: string = base64.replace(reg, '');
const base64Helper: util.Base64Helper = new util.Base64Helper();
const uint8Array: Uint8Array = base64Helper.decodeSync... | https://github.com/Joker-x-dev/CoolMallArkTS | bc47af959076f83be91e91a922975413d1ca9001 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | normalizeTrigger | 归一化扳机值到 0~255
虚拟手柄: 0~255, 物理手柄: -32768~32767 | private static normalizeTrigger(value: number): number {
if (value >= 0 && value <= 255) return value;
return Math.floor((value + 32768) / 256);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left normalizeTrigger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Le... | private static normalizeTrigger(value: number): number {
if (value >= 0 && value <= 255) return value;
return Math.floor((value + 32768) / 256);
} | https://github.com/AlkaidLab/moonlight-harmony | 57af42a87982b1c0b2f59f46130ba54ed370b9c4 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/parts/Bookmarks/BookmarksColumn.ets | arkts | receiveDrop | Things to do after receiving a unified drop event on this column.
@param records The unifiedRecords.
@returns True if succeeded, false if failed. | receiveDrop(records: unifiedDataChannel.UnifiedRecord[]) {
console.log(' ');
meow(`onDrop: [${records.length}]`, `BookmarksColumn][onDrop][${this.folder.title}`, meowLevel.WARN);
// GOAL: verify that this is a drop of meowBookmarkItemUnifiedType.
// So as long as we find one meowBookmarkItemUnifiedTy... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left receiveDrop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#member_expre... | receiveDrop(records: unifiedDataChannel.UnifiedRecord[]) {
console.log(' ');
meow(`onDrop: [${records.length}]`, `BookmarksColumn][onDrop][${this.folder.title}`, meowLevel.WARN);
// GOAL: verify that this is a drop of meowBookmarkItemUnifiedType.
// So as long as we find one meowBookmarkItemUnifiedTy... | https://github.com/awaLiny2333/LinysBrowser_NEXT | e5400ef6c111c27cf30342b3e40b82b564ed155e | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/NoUnusedVars/ets/default.ets | arkts | fact | Unused recursive functions also cause warnings. | function fact(n) {
if (n*z < 2) return 1;
return n * fact(n - 1);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fact AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#required_parameter#Right AST#)#Left ) AST#)#Right AST#... | function fact(n) {
if (n*z < 2) return 1;
return n * fact(n - 1);
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 5c7696a91ae93b19fe2cb1b0b5510eba77489f14 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Game24Logic.ets | arkts | dealFourCards | 随机抽取4张不重复的牌
@returns 4张随机牌的数组 | static dealFourCards(): Card[] {
const deck = Game24Logic.createDeck();
const cards: Card[] = [];
// Fisher-Yates 洗牌算法,随机抽取4张牌
for (let i = 0; i < 4; i++) {
const randomIndex = Math.floor(Math.random() * (deck.length - i));
cards.push(deck[randomIndex]);
// 将选中的牌与末尾的牌交换,确保不重复
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left dealFourCards 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 Card AST... | static dealFourCards(): Card[] {
const deck = Game24Logic.createDeck();
const cards: Card[] = [];
// Fisher-Yates 洗牌算法,随机抽取4张牌
for (let i = 0; i < 4; i++) {
const randomIndex = Math.floor(Math.random() * (deck.length - i));
cards.push(deck[randomIndex]);
// 将选中的牌与末尾的牌交换,确保不重复
... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | ab062508ed38a972b9365c2ddb81e78150b6eeb3 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RAApiClient.ets | arkts | clearCaches | 清除所有内存缓存
对齐 Android: logout 时清除所有缓存数据 | clearCaches(): void {
this.hashCache.clear();
this.gameDataCache.clear();
this.hashCacheLoaded = false;
this.gameDataCacheLoaded = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearCaches 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#... | clearCaches(): void {
this.hashCache.clear();
this.gameDataCache.clear();
this.hashCacheLoaded = false;
this.gameDataCacheLoaded = false;
} | https://github.com/richshaw2015/nds | 02f742b4b683fddfa71174ae9e729043cde89031 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test40_original_index.ets | arkts | testWordFrequency | --- Word frequency counting with Map --- | function testWordFrequency(): string {
let items: string[] = ['apple', 'banana', 'apple', 'cherry', 'banana', 'apple'];
let counts: Map<string, number> = new Map();
for (let i: number = 0; i < items.length; i++) {
let item: string = items[i];
let current: number | undefined = counts.get(item);
if (cur... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testWordFrequency 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#predefine... | function testWordFrequency(): string {
let items: string[] = ['apple', 'banana', 'apple', 'cherry', 'banana', 'apple'];
let counts: Map<string, number> = new Map();
for (let i: number = 0; i < items.length; i++) {
let item: string = items[i];
let current: number | undefined = counts.get(item);
if (cur... | https://github.com/miaochiahao/ark-ghidra | 9fa7c09a1b7979ec0c7af397eab6222374148693 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test33_original_index.ets | arkts | testArraySlice | --- Array slice and splice (manual) --- | function testArraySlice(): string {
let arr: number[] = [10, 20, 30, 40, 50];
let s1: number[] = arr.slice(1, 4);
let s2: number[] = arr.slice(2);
return String(s1.length) + ',' + String(s1[0]) + ',' + String(s2.length);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArraySlice 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_t... | function testArraySlice(): string {
let arr: number[] = [10, 20, 30, 40, 50];
let s1: number[] = arr.slice(1, 4);
let s2: number[] = arr.slice(2);
return String(s1.length) + ',' + String(s1[0]) + ',' + String(s2.length);
} | https://github.com/miaochiahao/ark-ghidra | 65777e01e34c93dc9360496ed50a610cd71d8306 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onForeground | Ability切换到前台时的回调 | onForeground(): void {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground 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... | onForeground(): void {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 01833c22dad1dbdf610e4adf4de8a33ca6c1d32e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_than/less_than_long.ets | arkts | main | ---
desc: check less than operation for long integer
--- | function main(): void {
const a: long = {{v.left}}
const b: long = {{v.right}}
assert (a < b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: long = {{v.left}}
const b: long = {{v.right}}
assert (a < b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2ade5d46f45efa4f8c32ee714ba9874d3e32a9dd | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an object of FixedArray<int>.
@param { FixedArray<int> } arr - An instance of the FixedArray type to convert to an array.
@returns { Uint8Array } - A new Uint8Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<int>): Uint8Array {
let result = new Uint8Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: FixedArray<int>): Uint8Array {
let result = new Uint8Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 8e5a84b778f214b3d1362bbd65b5cb34544b27b2 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | asArray | Gets an array value from an object by key.
@param {string} key - The key to look up
@returns {Array<JsonElement>} The array value
@throws {JsonTypeError} If the value is not an array or if this element is not an object
@throws {RangeError} If the key is not found | asArray(): Array<JsonElement> {
if (this.jsonType != JsonType.JsonArray) {
throw new JsonTypeError("This value's ValueKind is not Array.")
}
return this.maybeArrayValues!
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left asArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AS... | asArray(): Array<JsonElement> {
if (this.jsonType != JsonType.JsonArray) {
throw new JsonTypeError("This value's ValueKind is not Array.")
}
return this.maybeArrayValues!
} | https://gitcode.com/iop123123/arkts-static-skills | 4732f56adc10529d9bc4a8d87919e4361f52cf46 | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets | arkts | getGoodsTypeList | 查询商品分类列表
@returns 商品分类列表响应 | async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> {
const resp: AxiosResponse<NetworkResponse<Category[]>> =
await NetworkClient.http.post("goods/type/list");
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsTypeList 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#gen... | async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> {
const resp: AxiosResponse<NetworkResponse<Category[]>> =
await NetworkClient.http.post("goods/type/list");
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 6f7d45cb860a90061bd2d18c8f0ea75b261aa761 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | videoCrop | 视频裁剪(crop + 硬编码)
注意:crop 滤镜在 CPU 执行,但解码和编码使用硬件加速
@param input 输入视频路径
@param output 输出视频路径
@param width 裁剪宽度
@param height 裁剪高度
@param x 裁剪起始 X 坐标(默认 0)
@param y 裁剪起始 Y 坐标(默认 0)
@param bitrate 可选码率参数,如 '1M', '500k'。不设置则使用编码器默认质量
@example
// 从 (100, 50) 位置裁剪 1280x720 区域
FFmpegFactory.videoCrop(input, output, 1280, 720, 1... | public static videoCrop(
input: string,
output: string,
width: number,
height: number,
x: number = 0,
y: number = 0,
bitrate?: string
): string[] {
const cmd: string[] = [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:${x}:${y}`,
'-c:v', FFmpegFactory... | 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 videoCrop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:... | public static videoCrop(
input: string,
output: string,
width: number,
height: number,
x: number = 0,
y: number = 0,
bitrate?: string
): string[] {
const cmd: string[] = [
'ffmpeg',
'-i', input,
'-vf', `crop=${width}:${height}:${x}:${y}`,
'-c:v', FFmpegFactory... | https://github.com/jjjjjjava/ffmpeg_tools | 55c9f5b50c23311cce05a829b1cb510d18dc3757 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/database/RecurringBillDatabase.ets | arkts | insertConfig | 插入定期配置 | async insertConfig(config: RecurringBillConfig): Promise<number> {
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valueBucket: relationalStore.ValuesBucket = {
'amount': config.amount,
'type': config.type,
'category': config.category,
'note': config.note,
'r... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#... | async insertConfig(config: RecurringBillConfig): Promise<number> {
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valueBucket: relationalStore.ValuesBucket = {
'amount': config.amount,
'type': config.type,
'category': config.category,
'note': config.note,
'r... | https://github.com/qiuhaotc/HarmonyOSPlayground | 8960887cf4d3cd59e9d9e1389dcf619d37943d0f | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | centerViewTo | This will move the center of the current viewport to the specified
x and y value.
This also refreshes the chart by calling invalidate().
@param xValue
@param yValue
@param axis - which axis should be used as a reference for the y axis | public centerViewTo(xValue: number, yValue: number, axis: AxisDependency): void {
const xAxis = this.getXAxis();
const transformer = this.getTransformer(axis)
if (xAxis && transformer) {
let yInView: number = this.getAxisRange(axis) / this.mViewPortHandler.getScaleY();
let xInView: number = xA... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left centerViewTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | public centerViewTo(xValue: number, yValue: number, axis: AxisDependency): void {
const xAxis = this.getXAxis();
const transformer = this.getTransformer(axis)
if (xAxis && transformer) {
let yInView: number = this.getAxisRange(axis) / this.mViewPortHandler.getScaleY();
let xInView: number = xA... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7a05ece36ef101066012c29bae3b88f9156540b7 | gitee |
openharmony/arkui_advanced_ui_component | atomicservicenavigation/source/atomicservicenavigation.ets | arkts | unregisterListener | 取消注册监听 | public unregisterListener(): void {
this.listener = undefined;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp... | public unregisterListener(): void {
this.listener = undefined;
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | b48286d8ce2eac70d9e0ba91fd19834666585f58 | gitee |
killetom/ktretrofit | entry/src/main/ets/example/RetrofitConfigExample.ets | arkts | constructor | Constructor to initialize the configuration | constructor() {
this.userServiceConfig = this.createUserServiceConfig();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.userServiceConfig = this.createUserServiceConfig();
} | https://github.com/killetom/ktretrofit | a318b24c9d3f01a364980b172c874080cf829e06 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | getBooksByGroup | 获取指定分组的书籍 | async getBooksByGroup(groupName: string): Promise<NovelBook[]> {
const store = this.getStore();
const rs = await store.querySql(
'SELECT * FROM novel_book WHERE isFavorite = 1 AND groupName = ? ORDER BY sortOrder ASC, lastReadTime DESC',
[groupName]
);
return this.parseBookResults(rs);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBooksByGroup AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left groupName AST#identifier#Right AST#type_annotation#Left AST#:#L... | async getBooksByGroup(groupName: string): Promise<NovelBook[]> {
const store = this.getStore();
const rs = await store.querySql(
'SELECT * FROM novel_book WHERE isFavorite = 1 AND groupName = ? ORDER BY sortOrder ASC, lastReadTime DESC',
[groupName]
);
return this.parseBookResults(rs);
} | https://github.com/DaLongZhuaZi/manxia | 9bda5fc8c0099889f247d29132efc4c358cfad9d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getNSFWComics | [新增] 获取NSFW漫画列表(本地漫画)
@returns Promise<ComicInfo[]> NSFW漫画列表 | public async getNSFWComics(): Promise<ComicInfo[]> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'isNSFW = ?',
[1],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条NSFW本地漫画`);
return records.map(... | 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 getNSFWComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public async getNSFWComics(): Promise<ComicInfo[]> {
try {
const records = await this.databaseManager.query(
'comic_info',
undefined,
'isNSFW = ?',
[1],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} 条NSFW本地漫画`);
return records.map(... | https://github.com/DaLongZhuaZi/manxia | a323d021e244f3a1ec80c9c2a761a9cde784cf24 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.