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/Date.ets | arkts | ecmaMsFromTime | @see ECMA-262, 21.4.1.13
@returns Milliseconds component of a given time. | function ecmaMsFromTime(time: long): short {
let timeInDay = ecmaTimeInDayFromTime(time);
return (timeInDay % msPerSecond).toShort();
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaMsFromTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function ecmaMsFromTime(time: long): short {
let timeInDay = ecmaTimeInDayFromTime(time);
return (timeInDay % msPerSecond).toShort();
} | https://gitcode.com/iop123123/arkts-static-skills | 5265d094dfc1894c4ec4e10740f079c4d8a4512b | gitcode |
openharmony/applications_photos | common/src/main/ets/default/view/Histogram.ets | arkts | statusReady | worker统计完毕后,触发页面更新,开始绘制 | statusReady() {
if (this.status !== HistogramStatus.READY) {
Log.info(TAG, 'status changed, but not ready');
return;
}
Log.info(TAG, 'statusReady, start draw histogram');
HistogramManager.getInstance()
.setWidth(this.listCardWidth - Constants.COLUMN_PADDING * Constants.NUMBER_2)
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left statusReady 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... | statusReady() {
if (this.status !== HistogramStatus.READY) {
Log.info(TAG, 'status changed, but not ready');
return;
}
Log.info(TAG, 'statusReady, start draw histogram');
HistogramManager.getInstance()
.setWidth(this.listCardWidth - Constants.COLUMN_PADDING * Constants.NUMBER_2)
... | https://gitee.com/openharmony/applications_photos.git | 69067e8571a28548bd10f53b3858b27178d5fb12 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | hasAttribute | 检查是否有属性 | hasAttribute(name: string): boolean {
return this._attrs.has(name);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAttribute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS... | hasAttribute(name: string): boolean {
return this._attrs.has(name);
} | https://github.com/DaLongZhuaZi/manxia | 7e6615cd9be912aba0ccf69e70d6697405d15635 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | setLineInlayHints | ==================== InlayHint / PhantomText ==================== | setLineInlayHints(lineOrData: number | ArrayBuffer,
hintsOrSize: InlayHint[] | number): EditorActionResult | null {
if (lineOrData instanceof ArrayBuffer) {
return CoreProtocol.decodeEditorActionResult(
native.editorSetLineInlayHints(this.handle, lineOrData, lineOrData.byteLength... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left setLineInlayHints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left lineOrData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right... | setLineInlayHints(lineOrData: number | ArrayBuffer,
hintsOrSize: InlayHint[] | number): EditorActionResult | null {
if (lineOrData instanceof ArrayBuffer) {
return CoreProtocol.decodeEditorActionResult(
native.editorSetLineInlayHints(this.handle, lineOrData, lineOrData.byteLength... | https://github.com/FinalScave/SweetEditor | 81625236b45f3899c4fef347fcc105614bd8a752 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/CacheManager.ets | arkts | clear | 清除缓存(支持模式匹配)
@param pattern 可选的正则表达式模式,如果不提供则清除所有缓存
@returns 清除的缓存数量
使用示例:
- CacheManager.clear() // 清除所有缓存
- CacheManager.clear(/^category:/) // 清除所有以 "category:" 开头的缓存
- CacheManager.clear(/user:123/) // 清除包含 "user:123" 的缓存 | static clear(pattern?: RegExp): number {
if (!pattern) {
// 清除所有缓存
const count = CacheManager.cache.size;
CacheManager.cache.clear();
console.log(`[CacheManager] 已清除所有缓存,共 ${count} 条`);
return count;
}
// 按模式清除缓存
let count = 0;
const keysToDelete: string[] = [];
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pattern AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#... | static clear(pattern?: RegExp): number {
if (!pattern) {
// 清除所有缓存
const count = CacheManager.cache.size;
CacheManager.cache.clear();
console.log(`[CacheManager] 已清除所有缓存,共 ${count} 条`);
return count;
}
// 按模式清除缓存
let count = 0;
const keysToDelete: string[] = [];
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | de2c7fa77681d2780d7796b99a010c6c4fd4253a | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/pages/Index.ets | arkts | addBookmark | Add a new bookmark | addBookmark(bookmark: BookmarkBase): void {
bookmark.id = Date.now();
this.bookmarks.push(bookmark);
this.saveBookmarks();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addBookmark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookmark AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BookmarkBase AST#identifier#Right AST#)#... | addBookmark(bookmark: BookmarkBase): void {
bookmark.id = Date.now();
this.bookmarks.push(bookmark);
this.saveBookmarks();
} | https://github.com/tangwengang-del/freerdp-harmonyos | 0a9294b875e0d60326e0f82980e1d8d91b887859 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/TypeShelfManager.ets | arkts | getShelvesForContentType | 获取可以接受指定内容类型的书架列表 | getShelvesForContentType(contentType: ContentType): TypeShelf[] {
const shelfContentType = this.contentTypeToShelfContentType(contentType);
return this.getShelves().filter(shelf =>
!shelf.isSystem && shelf.contentTypes.includes(shelfContentType)
);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getShelvesForContentType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contentType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContentTy... | getShelvesForContentType(contentType: ContentType): TypeShelf[] {
const shelfContentType = this.contentTypeToShelfContentType(contentType);
return this.getShelves().filter(shelf =>
!shelf.isSystem && shelf.contentTypes.includes(shelfContentType)
);
} | https://github.com/DaLongZhuaZi/manxia | 17ee7fb45dc3e092cc895e5706d61e9154562c30 | github |
erosTeam/NextE | shared/src/main/ets/state/UserTagStore.ets | arkts | lookup | Look up a list tag by namespace + text (eros_fe: try "ns:tag" first, then plain "tag"). | lookup(namespace: string, tag: string): EhUsertag | undefined {
const fromMyTags: EhUsertag | undefined = UserTagStore.lookupIn(this.index, namespace, tag)
if (fromMyTags !== undefined) {
return fromMyTags
}
return UserTagStore.lookupIn(this.inlineIndex, namespace, tag)
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left lookup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left namespace AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ... | lookup(namespace: string, tag: string): EhUsertag | undefined {
const fromMyTags: EhUsertag | undefined = UserTagStore.lookupIn(this.index, namespace, tag)
if (fromMyTags !== undefined) {
return fromMyTags
}
return UserTagStore.lookupIn(this.inlineIndex, namespace, tag)
} | https://github.com/erosTeam/NextE | b4c8435881b8510440624b66e3a208ec32528299 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | addToCart | 加入购物车
@param {SelectedGoods} selectedGoods - 已选商品信息 | async addToCart(selectedGoods: SelectedGoods): Promise<void> {
const cartRepository = new CartRepository();
// 检查购物车中是否已存在该商品
const existingCart = await cartRepository.getCartByGoodsId(selectedGoods.goodsId);
if (existingCart && selectedGoods.spec) {
// 商品已存在,检查是否有相同规格
const existingSpec... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addToCart AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left selectedGoods AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async addToCart(selectedGoods: SelectedGoods): Promise<void> {
const cartRepository = new CartRepository();
// 检查购物车中是否已存在该商品
const existingCart = await cartRepository.getCartByGoodsId(selectedGoods.goodsId);
if (existingCart && selectedGoods.spec) {
// 商品已存在,检查是否有相同规格
const existingSpec... | https://github.com/Joker-x-dev/CoolMallArkTS | 9da672e823848989983f922475088759f3e31695 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getLimitLines | Returns the LimitLines of this axis.
@return | public getLimitLines(): JArrayList<LimitLine> {
return this.mLimitLines;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLimitLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressi... | public getLimitLines(): JArrayList<LimitLine> {
return this.mLimitLines;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f11c2f7235aac079284a33e920dcaee5bd000d33 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | constructor | Copy constructor (deep copy)
Creates a new JSON element by copying the values from another JSON element.
@param {JsonElement} other - The JSON element to copy from | constructor(other: JsonElement) {
this._deepCopy(other)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left JsonElement AST#identifier#R... | constructor(other: JsonElement) {
this._deepCopy(other)
} | https://gitcode.com/iop123123/arkts-static-skills | 4b07f2d193e6ae263d9358b241068a73293dc7bd | gitcode |
LZZLHY/hlib | entry/src/main/ets/storage/AuthStore.ets | arkts | listAccounts | 对外 API:返回明文 SavedAccount[](已解密)。 | static async listAccounts(): Promise<SavedAccount[]> {
const list: SavedAccount[] = await AuthStore.listAccountsRaw();
const out: SavedAccount[] = [];
for (let i = 0; i < list.length; i++) {
const a: SavedAccount = list[i];
const userId: string = await SecretStore.decrypt(a.userId);
cons... | 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 listAccounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async listAccounts(): Promise<SavedAccount[]> {
const list: SavedAccount[] = await AuthStore.listAccountsRaw();
const out: SavedAccount[] = [];
for (let i = 0; i < list.length; i++) {
const a: SavedAccount = list[i];
const userId: string = await SecretStore.decrypt(a.userId);
cons... | https://github.com/LZZLHY/hlib | 4ae5edbdc542c9cbfd6b5697d19c5912084152a6 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | fragment | Gets the fragment portion of the URI
@returns { string | null } | get fragment(): string | null {
let s: string = this.uriEntry.getFragment();
return s == '' ? null : decodeURIComponent(s);
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left fragment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#L... | get fragment(): string | null {
let s: string = this.uriEntry.getFragment();
return s == '' ? null : decodeURIComponent(s);
} | https://gitcode.com/iop123123/arkts-static-skills | 79ab4cd434de1642f0a230638ee759269f40d277 | gitcode |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | replaceAll | 替换字符串中所有匹配的正则为给定的字符串
@param str 待替换的字符串
@param pattern 要匹配的内容正则或字符串
@param replaceValue 替换的内容
@returns 返回替换后的字符串 | static replaceAll(str: string, pattern: RegExp | string, replaceValue: string = ''): string {
return str.replaceAll(pattern, replaceValue);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left replaceAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string... | static replaceAll(str: string, pattern: RegExp | string, replaceValue: string = ''): string {
return str.replaceAll(pattern, replaceValue);
} | https://github.com/tdcare/tdwebrtc | 033a5281c98563ec1eac9393e77aaa9919aaa940 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/DigitPanelModel.ets | arkts | getScienceLists | get science calculator button lists
@return Array<Array<PhysicsButtonInfo>> ScienceLists | public getScienceLists(): Array<Array<PhysicsButtonInfo>> {
return this.scienceList;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getScienceLists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | public getScienceLists(): Array<Array<PhysicsButtonInfo>> {
return this.scienceList;
} | https://gitee.com/openharmony-sig/applications_calculator.git | 61e909b219f023e98afe36c2a8bad0bab35202fc | gitee |
tdcare/tdwebrtc | src/main/ets/AudioCapture.ets | arkts | getFrameByteSize | 获取每帧字节数
16-bit PCM: sampleRate * channels * 2 bytes * frameDurationMs / 1000 | public getFrameByteSize(): number {
return Math.floor(this.sampleRate * this.channels * 2 * this.frameDurationMs / 1000);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFrameByteSize 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 AS... | public getFrameByteSize(): number {
return Math.floor(this.sampleRate * this.channels * 2 * this.frameDurationMs / 1000);
} | https://github.com/tdcare/tdwebrtc | 6fcd254d83292877275d988b941643d6286a9748 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | getThresholds | 获取性能阈值 | public getThresholds(): PerformanceThresholds {
return {
minFPS: this.thresholds.minFPS,
maxFrameTime: this.thresholds.maxFrameTime,
maxMemory: this.thresholds.maxMemory,
maxSystemTime: this.thresholds.maxSystemTime,
maxCPUUsage: this.thresholds.maxCPUUsage
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getThresholds 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 Performa... | public getThresholds(): PerformanceThresholds {
return {
minFPS: this.thresholds.minFPS,
maxFrameTime: this.thresholds.maxFrameTime,
maxMemory: this.thresholds.maxMemory,
maxSystemTime: this.thresholds.maxSystemTime,
maxCPUUsage: this.thresholds.maxCPUUsage
};
} | https://github.com/DaLongZhuaZi/manxia | 69622338677b6c07f3fa390d68f3eac194080434 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/trackmanager/TrackManager.ets | arkts | getChildFrameNode | Get the actual child click node.
@param node
@returns | public getChildFrameNode(node: FrameNode): FrameNode | null {
if (node?.getCustomProperty(TRACK_KEY)) {
return node;
}
for (let i = 0; i < node?.getChildrenCount(); i++) {
const child = node?.getChild(i) as FrameNode;
if (child) {
const result = this.getChildFrameNode(child);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getChildFrameNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public getChildFrameNode(node: FrameNode): FrameNode | null {
if (node?.getCustomProperty(TRACK_KEY)) {
return node;
}
for (let i = 0; i < node?.getChildrenCount(); i++) {
const child = node?.getChild(i) as FrameNode;
if (child) {
const result = this.getChildFrameNode(child);
... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 1810070ee1272096db029f0f152787c2ae787639 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Int8Array using range [begin, this.length).
@param begin start index to be taken into slice
@returns a new Int8Array with elements of current Int8Array[begin, this.length) | public slice(begin: number): Int8Array {
return this.slice(begin as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number): Int8Array {
return this.slice(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f42d8be8631a66c88b2cf6664e3d90c81839f94c | gitee |
openharmony/arkui_ace_engine | advanced_ui_component/treeview/source/treeview.ets | arkts | modifyNode | Modify the node name.
Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node.
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Modify the node name.
Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node.
@syscap Syst... | public modifyNode(): void {
let clickNodeId: number = this.listNodeDataSource.getClickNodeId();
this.listNodeDataSource.setItemVisibilityOnEdit(clickNodeId, MenuOperation.MODIFY_NODE);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left modifyNode 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_... | public modifyNode(): void {
let clickNodeId: number = this.listNodeDataSource.getClickNodeId();
this.listNodeDataSource.setItemVisibilityOnEdit(clickNodeId, MenuOperation.MODIFY_NODE);
} | https://gitee.com/openharmony/arkui_ace_engine.git | 8cc30ebe62a600721205fc1413281878f1f7499e | gitee |
openharmony/applications_app_samples | code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getLocationBol | Persistent geographical location, re-enter to determine if the switch is turned on | getLocationBol(bol: boolean) {
this.settingDataObj.locationBol = bol;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLocationBol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bol AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Righ... | getLocationBol(bol: boolean) {
this.settingDataObj.locationBol = bol;
} | https://github.com/openharmony/applications_app_samples | c65e426310ec333c13398964b51177fb40d1908e | github |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | toUpper | 将整个字符串转换为大写
@param str 要转换的字符串
@returns 返回小写的字符串 | static toUpper(str: string = ''): string {
return str.toUpperCase();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toUpper AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Lef... | static toUpper(str: string = ''): string {
return str.toUpperCase();
} | https://github.com/tdcare/tdwebrtc | 3a816e4ccde8c4abfa5c5e741d6937b52e6860a7 | github |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/manager/WorldClockManager.ets | arkts | getDisplayCityName | getDisplayCityName
@param cityIndex cityIndex | getDisplayCityName(cityIndex: string): string {
const locale = new Intl.Locale(i18n.System.getSystemLanguage());
const city: string = i18n.TimeZone.getCityDisplayName(cityIndex, locale.toString());
LogUtil.info("TAG", 'worldClockList index = ' + cityIndex + "; local = " + locale.toString() + "; city = " +... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayCityName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cityIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )... | getDisplayCityName(cityIndex: string): string {
const locale = new Intl.Locale(i18n.System.getSystemLanguage());
const city: string = i18n.TimeZone.getCityDisplayName(cityIndex, locale.toString());
LogUtil.info("TAG", 'worldClockList index = ' + cityIndex + "; local = " + locale.toString() + "; city = " +... | https://gitee.com/openharmony-sig/applications_clock.git | e5ba53cc1110e608e9a11158b315caf1d70e28f4 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | showDeleteEBookDialog | 显示删除电子书确认对话框 | private showDeleteEBookDialog(ebookId: string): void {
const ebook = this.getEBookById(ebookId);
if (!ebook) {
logger.error(TAG, `未找到电子书ID为 ${ebookId} 的电子书`);
this.resetEBookSwipeState();
return;
}
logger.info(TAG, `显示删除电子书确认对话框: ${ebook.metadata.title} (ID: ${ebookId})`);
this... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showDeleteEBookDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ebookId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A... | private showDeleteEBookDialog(ebookId: string): void {
const ebook = this.getEBookById(ebookId);
if (!ebook) {
logger.error(TAG, `未找到电子书ID为 ${ebookId} 的电子书`);
this.resetEBookSwipeState();
return;
}
logger.info(TAG, `显示删除电子书确认对话框: ${ebook.metadata.title} (ID: ${ebookId})`);
this... | https://github.com/DaLongZhuaZi/manxia | f348b5df075a0d44d67288627172935be981bf69 | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/data/UserRdb.ets | arkts | updateUserInfo | ========== 扩展方法:更新完整用户信息(移除 id) ========== | async updateUserInfo(userInfo: UserInfo): Promise<number> {
// 关键:如果未初始化且有上下文,先初始化数据库
if (!this.rdbStore && !this.isMock && this.context) {
await this.getRdbStore(this.context);
}
if (this.isMock) {
this.mockData = {
avatar: userInfo.avatar,
nickname: userInfo.nickname,
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateUserInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userInfo AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async updateUserInfo(userInfo: UserInfo): Promise<number> {
// 关键:如果未初始化且有上下文,先初始化数据库
if (!this.rdbStore && !this.isMock && this.context) {
await this.getRdbStore(this.context);
}
if (this.isMock) {
this.mockData = {
avatar: userInfo.avatar,
nickname: userInfo.nickname,
... | https://gitcode.com/openharmony/codelabs | 3e4b4d7ed13e7c9c0194e39a623c6486e08ead43 | gitcode |
codelably/HCompass | packages/auth/src/main/ets/AuthModule.ets | arkts | requiresLogin | 判断路由是否需要登录
@param {string} routeName - 路由名称
@returns {boolean} true表示需要登录 | private requiresLogin(routeName: string): boolean {
return this.protectedRoutes.includes(routeName);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left requiresLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routeName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | private requiresLogin(routeName: string): boolean {
return this.protectedRoutes.includes(routeName);
} | https://github.com/codelably/HCompass | b03a6a35099501485d739b2d3292e97a341c1b0a | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | discardPendingAIMessage | 丢弃指定待持久化 AI 消息(用于 stop 后清理空占位) | discardPendingAIMessage(messageId: string): void {
this.clearPendingAIMessageIfMatches(messageId)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left discardPendingAIMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left messageId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#L... | discardPendingAIMessage(messageId: string): void {
this.clearPendingAIMessageIfMatches(messageId)
} | https://github.com/LongLiveY96/chatcube | 0eb43df032f070560b4eb2fc775e8d3a0bc19ad4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets | arkts | init | 初始化Cookie存储 | async init(context: Context): Promise<void> {
if (this.initialized) return;
try {
this.context = context;
this.dataPreferences = await preferences.getPreferences(context, PREFERENCES_NAME);
await this.loadCookies();
this.initialized = true;
logger.info(TAG, 'Cookie存储初始化成功');... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#i... | async init(context: Context): Promise<void> {
if (this.initialized) return;
try {
this.context = context;
this.dataPreferences = await preferences.getPreferences(context, PREFERENCES_NAME);
await this.loadCookies();
this.initialized = true;
logger.info(TAG, 'Cookie存储初始化成功');... | https://github.com/DaLongZhuaZi/manxia | 0972c8e2e671d189dceae030b2afadfcc6e2e2eb | github |
cduestc-course/ArkLearn | entry/src/main/ets/pages/05/5.4-comments/components/HmCommentItem.ets | arkts | build | 初始值 只是为了语法不报错 | build() {
Row({ space: 10 }) {
// Image($r("app.media.profile"))
Image(this.item.avatar)
.width(40)
.height(40)
.borderRadius(20)
Column({ space: 10 }) {
// Text("DogeDan")
Text(this.item.author)
.fontColor("#303a43")
.fontSize(18)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Row({ space: 10 }) {
// Image($r("app.media.profile"))
Image(this.item.avatar)
.width(40)
.height(40)
.borderRadius(20)
Column({ space: 10 }) {
// Text("DogeDan")
Text(this.item.author)
.fontColor("#303a43")
.fontSize(18)
... | https://github.com/cduestc-course/ArkLearn | 446d273e1a34b414fbf934fd8c5a2624a4d44322 | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/clog/Clog.ets | arkts | getFilePath | 根据日志级别返回对应的文件路径
未配置保存目录时返回 undefined | private static getFilePath(level: 'info' | 'warn' | 'error'): string | undefined {
if (!Clog.SAVE_DIR) {
return undefined;
}
return `${Clog.SAVE_DIR}/clog_${level}.json`;
} | 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 getFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : ... | private static getFilePath(level: 'info' | 'warn' | 'error'): string | undefined {
if (!Clog.SAVE_DIR) {
return undefined;
}
return `${Clog.SAVE_DIR}/clog_${level}.json`;
} | https://github.com/ZestBox-18/kitebook-frontend | b0175bf85b93db1d24d415d978fb5d7c32b3e1ed | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | remove | 删除实体
如果实体启用了软删除,则执行软删除(设置 deleted_at 字段)
否则执行物理删除
在数据库操作前执行 beforeDelete 钩子
@param entityData 实体数据
@returns Promise<DeleteResult> | async remove(entityData: EntityData): Promise<DeleteResult> {
this.ensureWritePathAllowed('REMOVE')
return await this.withSessionStore(async (repo) => {
const result = await repo.deleteOperations.remove(entityData)
return repo.ensureDeleteResultSuccess(result, 'REMOVE')
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left remove AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entityData ... | async remove(entityData: EntityData): Promise<DeleteResult> {
this.ensureWritePathAllowed('REMOVE')
return await this.withSessionStore(async (repo) => {
const result = await repo.deleteOperations.remove(entityData)
return repo.ensureDeleteResultSuccess(result, 'REMOVE')
})
} | https://github.com/offlinecat-dev/OCNetORM | b2c1488e6992e29dd99c60b0f0a54f59722a4f3e | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/calendar/TnCalendar.ets | arkts | getFirstDayOfWeek | 获取某月第一天是星期几
@param year 年
@param month 月(1-12)
@returns 0-6(周日-周六) | function getFirstDayOfWeek(year: number, month: number): number {
return new Date(year, month - 1, 1).getDay();
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getFirstDayOfWeek AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function getFirstDayOfWeek(year: number, month: number): number {
return new Date(year, month - 1, 1).getDay();
} | https://github.com/codelably/tuniao-ui | 903e26664440f5366b6e9b4a1818ce7d47e8c620 | github |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/security/CryptoUtil.ets | arkts | encrypt | Encode plain text (reversible) | static encrypt(plainText: string): EncryptedData {
const encoder = new util.TextEncoder()
const bytes: Uint8Array = encoder.encode(plainText)
// Encode bytes to string safely
const encoded: string = CryptoUtil.bytesToString(bytes)
return {
cipherText: encoded,
iv: 'N/A',
algori... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left encrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left plainText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right... | static encrypt(plainText: string): EncryptedData {
const encoder = new util.TextEncoder()
const bytes: Uint8Array = encoder.encode(plainText)
// Encode bytes to string safely
const encoded: string = CryptoUtil.bytesToString(bytes)
return {
cipherText: encoded,
iv: 'N/A',
algori... | https://gitcode.com/openharmony/codelabs | b7a2587354324618771ebc85132b120adc922d82 | gitcode |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | getMapOriginValue | / 获取一个 Map 里面 的 原始值,可能是空 undefined,支持 aaa/bbb/ccc 多级取值 | public static getMapOriginValue(map: Map<Object, Object> | undefined, key: string): Object | undefined {
// map 无数据
if (map === undefined || map === null) {
return undefined;
}
// map 有数据
if (key.match('/')) {
const keyList = key.split('/');
return WebViewJavascriptBridgeTools._m... | 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 getMapOriginValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left :... | public static getMapOriginValue(map: Map<Object, Object> | undefined, key: string): Object | undefined {
// map 无数据
if (map === undefined || map === null) {
return undefined;
}
// map 有数据
if (key.match('/')) {
const keyList = key.split('/');
return WebViewJavascriptBridgeTools._m... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | f70a9ba1a5833004693d850de39e48a0e414324e | github |
offlinecat-dev/OCNetORM | example/UsageExample.ets | arkts | basicQueryExamples | ============================================
第四步:查询构建器示例
============================================
基础查询示例 | async function basicQueryExamples(): Promise<void> {
const repository = new Repository('ArticleEntity')
// 1. 简单条件查询
const publishedArticles = repository.createQueryBuilder()
.where('isPublished', ConditionOperator.EQUAL, true)
.orderBy('createdAt', 'DESC')
.limit(10)
const executor1 = new QueryEx... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left basicQueryExamples AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ... | async function basicQueryExamples(): Promise<void> {
const repository = new Repository('ArticleEntity')
// 1. 简单条件查询
const publishedArticles = repository.createQueryBuilder()
.where('isPublished', ConditionOperator.EQUAL, true)
.orderBy('createdAt', 'DESC')
.limit(10)
const executor1 = new QueryEx... | https://github.com/offlinecat-dev/OCNetORM | 1aa4b17141350f6ca8198d94d670f8525080f906 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | putString | 通用的保存偏好设置方法
@param key 键
@param value 值 | async putString(key: string, value: string): Promise<void> {
try {
await this.dao.put(key, value);
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to put preference: ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left putString AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async putString(key: string, value: string): Promise<void> {
try {
await this.dao.put(key, value);
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to put preference: ${JSON.stringify(err)}`);
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | 139dc97aa49e277491d4dbced48d2c99338f31ba | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | setLineDiagnostics | ==================== Diagnostic Decorations ==================== | setLineDiagnostics(lineOrData: number | ArrayBuffer,
itemsOrSize: Diagnostic[] | number): EditorActionResult | null {
if (lineOrData instanceof ArrayBuffer) {
return CoreProtocol.decodeEditorActionResult(
native.editorSetLineDiagnostics(this.handle, lineOrData, lineOrData.byteLe... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left setLineDiagnostics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left lineOrData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ... | setLineDiagnostics(lineOrData: number | ArrayBuffer,
itemsOrSize: Diagnostic[] | number): EditorActionResult | null {
if (lineOrData instanceof ArrayBuffer) {
return CoreProtocol.decodeEditorActionResult(
native.editorSetLineDiagnostics(this.handle, lineOrData, lineOrData.byteLe... | https://github.com/FinalScave/SweetEditor | f8a3a6dc5879523927f908747b7d53f3a7911202 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SharedLedgerService.ets | arkts | getLedgerStatistics | ==================== 统计数据 ====================
获取账本统计 | static async getLedgerStatistics(ledgerId: number): Promise<SharedBillStatistics> {
try {
return await SharedBillDAO.getStatistics(ledgerId);
} catch (error) {
console.error('[SharedLedgerService] 获取账本统计失败:', error);
throw error instanceof Error ? error : new Error(String(error));
}
} | 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 getLedgerStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#... | static async getLedgerStatistics(ledgerId: number): Promise<SharedBillStatistics> {
try {
return await SharedBillDAO.getStatistics(ledgerId);
} catch (error) {
console.error('[SharedLedgerService] 获取账本统计失败:', error);
throw error instanceof Error ? error : new Error(String(error));
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 8a59dec0d9b68d5cd336ceb61421d8624bcf833a | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | getById | 根据ID获取异常记录 | static async getById(anomalyId: number): Promise<AnomalyRecord | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AnomalyRecord.tableName);
predicates.equalTo('anomaly_id', ... | 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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left anomalyId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async getById(anomalyId: number): Promise<AnomalyRecord | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AnomalyRecord.tableName);
predicates.equalTo('anomaly_id', ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9c795203141ce99496cddf19bdf53b4955b5efe9 | github |
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | products/watch/src/main/ets/watchability/WatchAbility.ets | arkts | onHallSensor | Listening to the Hall status | onHallSensor(): void {
try {
Logger.info(TAG, 'registerHallSensor');
sensor.on(sensor.SensorId.HALL, (data: sensor.HallResponse) => {
if (data === null) {
return;
}
Logger.info(TAG, `Hall state changed, status = ${data.status}`);
DeviceService.hallStatus = dat... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onHallSensor 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... | onHallSensor(): void {
try {
Logger.info(TAG, 'registerHallSensor');
sensor.on(sensor.SensorId.HALL, (data: sensor.HallResponse) => {
if (data === null) {
return;
}
Logger.info(TAG, `Hall state changed, status = ${data.status}`);
DeviceService.hallStatus = dat... | https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts | e9cce43a3ed913507ce52a1d35aacac2e00c3687 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/05.generics/01.generic_declarations/generic_functions/generic_function_wrong_constraint.ets | arkts | foo | ---
desc: wrong constraints for type variable
tags: [compile-only, negative]
params: >
{{wc}}
--- | function foo<X extends {{wc}}>(): void {}; | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left X AST#type_identifier#Right AST#constraint#Left AST#extends#Left extends AST#extend... | function foo<X extends {{wc}}>(): void {}; | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 507b2c4d655424b03e6166a72c37e2498e200930 | gitee |
openharmony-tpc/ImageKnife | library/src/main/ets/model/ImageKnifeRequest.ets | arkts | addHeaderMap | 全局调用header对应的方法,包含RequestOption的形式 | addHeaderMap(map: Map<string, Object>) {
map.forEach((value, key) => {
if (!this.headers.has(key)) {
this.addHeader(key, value);
}
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addHeaderMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#... | addHeaderMap(map: Map<string, Object>) {
map.forEach((value, key) => {
if (!this.headers.has(key)) {
this.addHeader(key, value);
}
})
} | https://gitee.com/openharmony-tpc/ImageKnife.git | a12df024c84874d34dbace45b214cb3447251abe | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | getHilogLevelIndex | 获取当前hilog输出等级的索引
@returns 日志等级索引 (0=关闭, 1=DEBUG, 2=INFO, 3=WARN, 4=ERROR, 5=FATAL) | public getHilogLevelIndex(): number {
return LOG_LEVEL_VALUES.indexOf(this.hilogOutputLevel);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHilogLevelIndex 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 ... | public getHilogLevelIndex(): number {
return LOG_LEVEL_VALUES.indexOf(this.hilogOutputLevel);
} | https://github.com/DaLongZhuaZi/manxia | 49a3b8c1b454548841900531437d15e6338514b6 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/FootprintRepository.ets | arkts | clearAllFootprints | 清空所有足迹记录
@returns {Promise<void>} Promise<void> | clearAllFootprints(): Promise<void> {
return this.dataSource.clearAllFootprints();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left clearAllFootprints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right... | clearAllFootprints(): Promise<void> {
return this.dataSource.clearAllFootprints();
} | https://github.com/Joker-x-dev/CoolMallArkTS | ca73a190837537926af322299bb2a5da2ec3247d | github |
tdcare/tdwebrtc | example/MediaStreamAdvancedExample.ets | arkts | switchCamera | 切换前后摄像头 | public async switchCamera(): Promise<void> {
if (!this.mediaStream) {
return;
}
const success = await this.mediaStream.switchCamera();
console.log(`[MediaStreamExample] 切换摄像头 ${success ? '成功' : '失败'}`);
} | 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 switchCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async switchCamera(): Promise<void> {
if (!this.mediaStream) {
return;
}
const success = await this.mediaStream.switchCamera();
console.log(`[MediaStreamExample] 切换摄像头 ${success ? '成功' : '失败'}`);
} | https://github.com/tdcare/tdwebrtc | b6a888a70abfde7f7ef43689769ebce13937544a | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/File.ets | arkts | delFile | 删除一个文件 | static delFile(filePath: string) {
if (filePath) {
fileIo.unlinkSync(filePath)
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left delFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right ... | static delFile(filePath: string) {
if (filePath) {
fileIo.unlinkSync(filePath)
}
} | https://github.com/SMAT-Lab/PhantomRendering | 98b52eb0ca4c99bec64865a5dc5d818f2d6f5f2a | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | computeEffectiveUpstream | The resolver(s) actually used: in auto mode the live system/router DNS, with
the manual list as the fallback when none are usable. | private computeEffectiveUpstream(underlyingDns: string[]): string {
if (!this.upstreamAuto) {
return this.upstreamManual;
}
const fromSystem: string = this.upstreamFromUnderlyingDns(underlyingDns);
return fromSystem.length > 0 ? fromSystem : this.upstreamManual;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left computeEffectiveUpstream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left underlyingDns AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left... | private computeEffectiveUpstream(underlyingDns: string[]): string {
if (!this.upstreamAuto) {
return this.upstreamManual;
}
const fromSystem: string = this.upstreamFromUnderlyingDns(underlyingDns);
return fromSystem.length > 0 ? fromSystem : this.upstreamManual;
} | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1288-L1294 | 3a6da9391901a05e93877e10d19180f419211a44 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int8Array with respect to buf.
@param { ArrayLike<Number> | ArrayBuffer } buf - data initializer
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLength = (buf as ArrayBuffer).getByteLength()
if (this.byteLength % Int8Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength should be ... | 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#binary_expression#Lef... | public constructor(buf: ArrayLike<Number> | ArrayBuffer) {
if (buf instanceof ArrayBuffer) {
this.byteLength = (buf as ArrayBuffer).getByteLength()
if (this.byteLength % Int8Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength should be ... | https://gitcode.com/iop123123/arkts-static-skills | 6d89515e2353413684908b4621841577c66d7fc3 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Int.ets | arkts | createFromJSONValue | Creates a Int instance based on JSONValue
@param json: JSONValue - a JSON representation
@throws JSONTypeError if json does not encode a valid int
@returns Int - int value decoded from JSON | static createFromJSONValue(json: JSONValue): Int {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
if (Double.isInteger(num) && Int.MIN_VALUE <= num && num <= Int.MAX_VALUE) {
return Int.valueOf(num as int)
}
}
throw ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFromJSONValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static createFromJSONValue(json: JSONValue): Int {
if (json instanceof JSONNumber) {
let num = (json as JSONNumber).value
if (Double.isInteger(num) && Int.MIN_VALUE <= num && num <= Int.MAX_VALUE) {
return Int.valueOf(num as int)
}
}
throw ... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a83b9241ab76996a3966ed894c02b8cd60138a2f | gitee |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | setToken | 设置token
@param token 认证令牌 | async setToken(token: string): Promise<void> {
this.token = token;
await StorageUtil.saveToken(token);
this.httpUtil.setToken(token);
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tok... | async setToken(token: string): Promise<void> {
this.token = token;
await StorageUtil.saveToken(token);
this.httpUtil.setToken(token);
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 36746461664dedeccacf553057259565735d4690 | github |
apap6628114/nga_oh | entry/src/main/ets/common/managers/PaginationManager.ets | arkts | getGeneration | 获取当前 generation 值,用于响应到达时校验是否过期。
@returns 当前 generation | getGeneration(): number {
return this.generation
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGeneration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statemen... | getGeneration(): number {
return this.generation
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L41-L43 | af93543ef3c3ab557b758fadb3c8b67cb1df51a7 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamWindowManager.ets | arkts | setStreamResolution | 设置串流分辨率 | setStreamResolution(width: number, height: number): void {
this.streamWidth = width;
this.streamHeight = height;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setStreamResolution AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#L... | setStreamResolution(width: number, height: number): void {
this.streamWidth = width;
this.streamHeight = height;
} | https://github.com/AlkaidLab/moonlight-harmony | e6446d2a39f60b8c1a02437188564da4ff9c94d8 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets | arkts | addListener | MARK: - Listener Management
Adds a surface lifecycle listener | public addListener(listener: ISurfaceManagerListener): void {
if (this._nativeListenerMap.has(listener)) {
// Same listener registered twice; ignore to keep map in sync.
return;
}
this._listeners.push(listener);
const nativeWrapper = new NativeSurfaceListenerWrapper(
(surfaceId: str... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public addListener(listener: ISurfaceManagerListener): void {
if (this._nativeListenerMap.has(listener)) {
// Same listener registered twice; ignore to keep map in sync.
return;
}
this._listeners.push(listener);
const nativeWrapper = new NativeSurfaceListenerWrapper(
(surfaceId: str... | https://github.com/AGenUI/AGenUI | 685276d041892b3fa18750a2e64aa1a1b6d62c39 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | goBackUni | The universal go back action on this window.
@param source The source of the go back action.
@returns Whether ANY action was performed. | goBackUni(source: meowUiGoBackSource, uiContext: UIContext) {
// Close dialogs.
const myDialog = AppStorageV2.connect(meowDialogManager, `meowDialogManager_${this.windowId}`)!;
if (!myDialog.isEmpty()) {
myDialog.requestCloseTop();
return true;
}
// Back in web.
if (source == meo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left goBackUni AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left meowUiGoBackSource AST#identi... | goBackUni(source: meowUiGoBackSource, uiContext: UIContext) {
// Close dialogs.
const myDialog = AppStorageV2.connect(meowDialogManager, `meowDialogManager_${this.windowId}`)!;
if (!myDialog.isEmpty()) {
myDialog.requestCloseTop();
return true;
}
// Back in web.
if (source == meo... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 897e7845c09760ecb71c9dc8d1466cfffdddd86f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts float to JSON format
@param d: float - float to be converted to a JSON as a Number
@returns String - JSON representation of float | public static stringify(d: float): String {
if (Float.isFinite(d)) {
return StringBuilder.toString(d)
} else {
return 'null'
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: float): String {
if (Float.isFinite(d)) {
return StringBuilder.toString(d)
} else {
return 'null'
}
} | https://gitcode.com/iop123123/arkts-static-skills | 3f264729b6201babe78e451248c3ea805b9755f2 | gitcode |
SakuraNeko/Deepseek-Harmony | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleDeepLink | 解析并处理Deep Link URL
支持的URL格式:https://chat.deepseek.com/share/... | private handleDeepLink(want: Want): void {
const uri = want?.uri;
if (!uri) {
return;
}
hilog.info(DOMAIN, TAG, 'Received DeepLink URI: %{public}s', uri);
try {
const urlObject = url.URL.parseURL(uri);
const host = urlObject.hostname;
const path = urlObject.pathname;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleDeepLink AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private handleDeepLink(want: Want): void {
const uri = want?.uri;
if (!uri) {
return;
}
hilog.info(DOMAIN, TAG, 'Received DeepLink URI: %{public}s', uri);
try {
const urlObject = url.URL.parseURL(uri);
const host = urlObject.hostname;
const path = urlObject.pathname;
... | https://github.com/SakuraNeko/Deepseek-Harmony | 22c4ee5dc9930ffa6e44e0a910a8ffc76d5cbeab | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/JSRuntime.ets | arkts | setPropertyBoolean | ===================
setProperty<TYPE>()
=================== | public static setPropertyBoolean(object: JSValue, name: String, value: boolean): void {
JSRuntime.checkIntrinsicMethod();
} | 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 setPropertyBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left object AST#identifier#Right AST#:#Le... | public static setPropertyBoolean(object: JSValue, name: String, value: boolean): void {
JSRuntime.checkIntrinsicMethod();
} | https://gitcode.com/iop123123/arkts-static-skills | f5327c63f8e4614b4aa8c763eb66b3e1ac1caa26 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/ui/weight/WaveAnimWeight.ets | arkts | constructor | 波浪控件
@param speed 波浪速度。取值:0-1,默认:0.5
@param waveHeight 波浪高度百分比。取值:0-1,默认:0.8
@param waveColor 波浪颜色。默认半透明白色:#66ffffff
@param waveOffset 波浪偏差值。起始位置。默认:0.0 | constructor(
speed: number = 0.5,
waveHeightPercent: number = 0.8,
waveColor: string | CanvasGradient | CanvasPattern = "#66ffffff",
waveOffset: number = 0.0
) {
super()
this.speed = speed
this.waveHeightPercent = waveHeightPercent
this.waveColor = waveColor
this.waveOffset = wav... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left speed AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Le... | constructor(
speed: number = 0.5,
waveHeightPercent: number = 0.8,
waveColor: string | CanvasGradient | CanvasPattern = "#66ffffff",
waveOffset: number = 0.0
) {
super()
this.speed = speed
this.waveHeightPercent = waveHeightPercent
this.waveColor = waveColor
this.waveOffset = wav... | https://github.com/RedRackham-R/WanAndroidHarmoney | 50d7d9f78b30dbf086c71eb9c9a0158b6e66f349 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test11_original_index.ets | arkts | testForIn | --- for-in loop over Record keys --- | function testForIn(): string {
let obj: Record<string, number> = {};
obj['apple'] = 3;
obj['banana'] = 5;
obj['cherry'] = 7;
let result: string = '';
let keys: string[] = Object.keys(obj);
for (let i: number = 0; i < keys.length; i++) {
let key: string = keys[i];
result = result + key + ':' + Stri... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testForIn 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#L... | function testForIn(): string {
let obj: Record<string, number> = {};
obj['apple'] = 3;
obj['banana'] = 5;
obj['cherry'] = 7;
let result: string = '';
let keys: string[] = Object.keys(obj);
for (let i: number = 0; i < keys.length; i++) {
let key: string = keys[i];
result = result + key + ':' + Stri... | https://github.com/miaochiahao/ark-ghidra | d0b34b1c07bb4b5150a51c66323e25e509a43a49 | github |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | logNodeItemDebug | 观测节点池状态 | private logNodeItemDebug() {
Logger.info(tag, `nodePool length:${this.nodePool.length}`);
this.nodePool.forEach((nodeArray, type) => {
Logger.info(tag, `nodeArray length:${nodeArray?.length}`);
nodeArray?.forEach((item: NodeItem, index: number) => {
Logger.info(tag, `item type:${item.type}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logNodeItemDebug 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#{#... | private logNodeItemDebug() {
Logger.info(tag, `nodePool length:${this.nodePool.length}`);
this.nodePool.forEach((nodeArray, type) => {
Logger.info(tag, `nodeArray length:${nodeArray?.length}`);
nodeArray?.forEach((item: NodeItem, index: number) => {
Logger.info(tag, `item type:${item.type}... | https://gitee.com/openharmony-sig/node_pool.git | f9f3d975f14351811e8475dd63699e5b616510c5 | gitee |
bhengubv/aether-protocol | harmonyos/teal/entry/src/main/ets/service/NearLinkTransportService.ets | arkts | probeAvailability | ── Availability probe ─────────────────────────────────────────────────── | async probeAvailability(): Promise<boolean> {
const atManager = abilityAccessCtrl.createAtManager();
let permissionGranted = false;
try {
const tokenId = this._context.applicationInfo.accessTokenId;
const status = await atManager.checkAccessToken(tokenId, NEARLINK_PERMISSION);
if (status... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left probeAvailability 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#ge... | async probeAvailability(): Promise<boolean> {
const atManager = abilityAccessCtrl.createAtManager();
let permissionGranted = false;
try {
const tokenId = this._context.applicationInfo.accessTokenId;
const status = await atManager.checkAccessToken(tokenId, NEARLINK_PERMISSION);
if (status... | https://github.com/bhengubv/aether-protocol | 6e0ae10f01cb20f15fe55cd2d3a216f6d12c76b4 | github |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | getMapNumberValue | / 获取一个 Map 里面 number 类型的值 | public static getMapNumberValue(map: Map<Object, Object> | undefined, key: string, def?: number): number {
let value = WebViewJavascriptBridgeTools.getMapOriginValue(map, key)
if (value === undefined || value === null) {
return def ?? 0;
} else {
return WebViewJavascriptBridgeTools.objToNum(va... | 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 getMapNumberValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left :... | public static getMapNumberValue(map: Map<Object, Object> | undefined, key: string, def?: number): number {
let value = WebViewJavascriptBridgeTools.getMapOriginValue(map, key)
if (value === undefined || value === null) {
return def ?? 0;
} else {
return WebViewJavascriptBridgeTools.objToNum(va... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | 6a04f0d07dedd4555f9a5169138eed784341bd72 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/Highlight.ets | arkts | getX | returns the x-value of the highlighted value
@return | public getX(): number {
return this.mX;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getX AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public getX(): number {
return this.mX;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 2530dc33b580abd6b05fff04a06dd120875d3bc0 | gitee |
OHPG/FinVideo | entry/src/main/ets/player/AppPlayerManager.ets | arkts | playAll | 播放列表
@param items 播放列表
@param index 起始索引
@returns true=可以跳转播放页,false=当前繁忙 | public playAll(items: Array<FinItem>, index: number = 0): boolean {
let args: PlayAllArgs = { items: items, index: index }
return this.dispatchPlay(args)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expressio... | public playAll(items: Array<FinItem>, index: number = 0): boolean {
let args: PlayAllArgs = { items: items, index: index }
return this.dispatchPlay(args)
} | https://github.com/OHPG/FinVideo | a12f06ac50e1531a232f26c93501aadf8d7c3074 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | cacheDefinition | ==================== DEFINITION CACHE OPERATIONS ====================
Cache a word definition | async cacheDefinition(word: string, definition: WordDefinition): Promise<void> {
this.ensureInitialized();
const normalizedWord = word.toLowerCase().trim();
const bucket: relationalStore.ValuesBucket = {
'word': normalizedWord,
'definition': definition.toJSON(),
'source': definition.sou... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left cacheDefinition AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left wo... | async cacheDefinition(word: string, definition: WordDefinition): Promise<void> {
this.ensureInitialized();
const normalizedWord = word.toLowerCase().trim();
const bucket: relationalStore.ValuesBucket = {
'word': normalizedWord,
'definition': definition.toJSON(),
'source': definition.sou... | https://github.com/CLMC2025/Vignette | ca265182b0b145b5ae9095ae3bc61bb47f75eee1 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/ChatService.ets | arkts | getSessions | 获取会话列表 | getSessions(): ChatSession[] {
return Array.from(this.sessions.values())
.sort((a, b) => b.updatedAt - a.updatedAt);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getSessions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS... | getSessions(): ChatSession[] {
return Array.from(this.sessions.values())
.sort((a, b) => b.updatedAt - a.updatedAt);
} | https://github.com/LJ666-ui/harmony-health-care | d38a3e504f61b83942f8828fbde38e95ebd6b43b | github |
erosTeam/NextE | shared/src/main/ets/settings/AccountListSettings.ets | arkts | bundleOf | The cookie bundle for a saved account (used to switch into it). '' if absent. | static async bundleOf(context: common.UIAbilityContext, memberId: string): Promise<string> {
try {
const records: AccountRecord[] = await AccountListSettings.read(context)
for (const r of records) {
if (r.memberId === memberId) {
return r.bundle
}
}
} catch (error) ... | 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 bundleOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:... | static async bundleOf(context: common.UIAbilityContext, memberId: string): Promise<string> {
try {
const records: AccountRecord[] = await AccountListSettings.read(context)
for (const r of records) {
if (r.memberId === memberId) {
return r.bundle
}
}
} catch (error) ... | https://github.com/erosTeam/NextE | a11c51d285125e3e5d54a0333beb2c50f91a3bc6 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleWindowStatusChange | 处理窗口状态变化 | private handleWindowStatusChange(statusType: window.WindowStatusType): void {
// FLOATING = 自由多窗模式 → 隐藏系统标题栏,显示自定义标题栏
// FULL_SCREEN = 全屏模式 → 不显示自定义标题栏
// SPLIT_SCREEN = 分屏模式 → 显示自定义标题栏
switch (statusType) {
case window.WindowStatusType.FLOATING:
// 自由多窗模式 - 隐藏系统标题栏,显示自定义标题栏
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleWindowStatusChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left statusType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | private handleWindowStatusChange(statusType: window.WindowStatusType): void {
// FLOATING = 自由多窗模式 → 隐藏系统标题栏,显示自定义标题栏
// FULL_SCREEN = 全屏模式 → 不显示自定义标题栏
// SPLIT_SCREEN = 分屏模式 → 显示自定义标题栏
switch (statusType) {
case window.WindowStatusType.FLOATING:
// 自由多窗模式 - 隐藏系统标题栏,显示自定义标题栏
... | https://github.com/AetheriumSimulator/qemu-hmos | b360eb84cc0f030d34a195aea6813641c9f7160f | github |
openharmony-sig/ohos_axios | entry/src/main/ets/pages/Index.ets | arkts | settingClientCert_psw | 设置双向证书校验(有密码) | settingClientCert_psw() {
this.clear()
this.showUrl = this.clientCert_hasPsw
this.startTime = new Date().getTime();
let path_ca = ''; // 根证书路径
let path_client = ''; // 客户端证书路径
let path_key = ''; // 客户端密码路径
// 获取根证书、客户端证书、客户端密码沙箱路径
try {
let context: Context = getContext(this);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left settingClientCert_psw 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_bl... | settingClientCert_psw() {
this.clear()
this.showUrl = this.clientCert_hasPsw
this.startTime = new Date().getTime();
let path_ca = ''; // 根证书路径
let path_client = ''; // 客户端证书路径
let path_key = ''; // 客户端密码路径
// 获取根证书、客户端证书、客户端密码沙箱路径
try {
let context: Context = getContext(this);
... | https://gitee.com/openharmony-sig/ohos_axios.git | 77b39cc47d87ceb9149c8959bb6cd38e36af9e70 | gitee |
honjow/Next2V | shared/src/main/ets/parser/V2exTabParser.ets | arkts | hasNextPage | Whether the list page has a page AFTER the current one — read from the pagination footer
(page_current + the highest ?p=N), NOT from a per-page item count. The favorites page
(/my/topics) returns fewer items per page than a tab feed's 20, so a `count >= 20` heuristic
wrongly stops after page 1. Mirrors V2exNodeParser.e... | static hasNextPage(html: string): boolean {
const clean = V2exTabParser.stripNonContent(html || '')
const currentMatch = clean.match(/<a[^>]*class=['"][^'"]*page_current[^'"]*['"][^>]*>(\d+)<\/a>/i)
if (currentMatch && currentMatch[1]) {
const current = parseInt(currentMatch[1], 10)
const page... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasNextPage 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#identifier#Left stri... | static hasNextPage(html: string): boolean {
const clean = V2exTabParser.stripNonContent(html || '')
const currentMatch = clean.match(/<a[^>]*class=['"][^'"]*page_current[^'"]*['"][^>]*>(\d+)<\/a>/i)
if (currentMatch && currentMatch[1]) {
const current = parseInt(currentMatch[1], 10)
const page... | https://github.com/honjow/Next2V | d7c3eb1b444b6a8cb649c397a888478222590de9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | getNextBatchToLoad | 批量获取下一批要加载的任务
@param count 需要获取的任务数量
@returns 任务列表 | getNextBatchToLoad(count: number): PreloadTaskItem[] {
if (this.queue.size === 0 || count <= 0) {
return [];
}
// 按优先级排序
const sorted: PreloadItem[] = Array.from(this.queue.values()).sort((a: PreloadItem, b: PreloadItem): number => {
if (a.priority !== b.priority) {
return b.prior... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNextBatchToLoad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Le... | getNextBatchToLoad(count: number): PreloadTaskItem[] {
if (this.queue.size === 0 || count <= 0) {
return [];
}
// 按优先级排序
const sorted: PreloadItem[] = Array.from(this.queue.values()).sort((a: PreloadItem, b: PreloadItem): number => {
if (a.priority !== b.priority) {
return b.prior... | https://github.com/DaLongZhuaZi/manxia | af5f16d45e4260e0aaa322b64aa404ce71aad5ed | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | removeAllErrorGroups | 移除书源的所有错误分组,并添加"工作正常"分组 | private async removeAllErrorGroups(source: LegadoBookSource): Promise<void> {
try {
const currentGroups = source.bookSourceGroup ? source.bookSourceGroup.split(',').map(g => g.trim()) : [];
const knownErrorGroups = Object.values(ERROR_GROUP_NAMES);
// 移除所有错误分组
let cleanedGroups = currentGr... | 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 removeAllErrorGroups AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#... | private async removeAllErrorGroups(source: LegadoBookSource): Promise<void> {
try {
const currentGroups = source.bookSourceGroup ? source.bookSourceGroup.split(',').map(g => g.trim()) : [];
const knownErrorGroups = Object.values(ERROR_GROUP_NAMES);
// 移除所有错误分组
let cleanedGroups = currentGr... | https://github.com/DaLongZhuaZi/manxia | 79cd835c53313447dcd559f98f6bb9d0632a1761 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/pages/cacender.ets | arkts | updateMonthStats | 更新月统计 | updateMonthStats(records: CoffeeRecord[]) {
const now = new Date()
const currentMonth = now.getMonth() + 1
const days: number[] = []
records.forEach(record => {
const date = new Date(record.createTime)
if (date.getFullYear() === now.getFullYear() && date.getMonth() + 1 === currentMonth) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateMonthStats 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#identif... | updateMonthStats(records: CoffeeRecord[]) {
const now = new Date()
const currentMonth = now.getMonth() + 1
const days: number[] = []
records.forEach(record => {
const date = new Date(record.createTime)
if (date.getFullYear() === now.getFullYear() && date.getMonth() + 1 === currentMonth) {
... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 7798beb85c6e1916681902efa7364ae41adea1cc | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | add | @params attributes to be added | add(attrs: int): void throws {
if ((attrs & this.allowed) != attrs) {
throw new TypeAPICreateException("disallowed attributes")
}
if ((this.attrs & attrs) != attrs) {
checkNotFrozen(this.frozen)
}
this.attrs = attrs
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attrs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right A... | add(attrs: int): void throws {
if ((attrs & this.allowed) != attrs) {
throw new TypeAPICreateException("disallowed attributes")
}
if ((this.attrs & attrs) != attrs) {
checkNotFrozen(this.frozen)
}
this.attrs = attrs
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 70a25a9d6536ee940a270acbd1512498a624824d | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/database/RecurringBillDatabase.ets | arkts | queryConfigById | 根据ID查询定期配置 | async queryConfigById(id: number): Promise<RecurringBillConfig | null> {
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const predicates = new relationalStore.RdbPredicates(this.CONFIG_TABLE);
predicates.equalTo('id', id);
try {
const resultSet = await this.rdbStore.query(predic... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryConfigById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#t... | async queryConfigById(id: number): Promise<RecurringBillConfig | null> {
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const predicates = new relationalStore.RdbPredicates(this.CONFIG_TABLE);
predicates.equalTo('id', id);
try {
const resultSet = await this.rdbStore.query(predic... | https://github.com/qiuhaotc/HarmonyOSPlayground | fc1bfa957a55ee4bc89de37bac8ac8e330122c7f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getOnlineComicById | 根据ID获取在线漫画 | async getOnlineComicById(comicId: string): Promise<DatabaseRecord | null> {
try {
const sql = 'SELECT * FROM online_comic_info WHERE id = ?';
const result = await this.databaseManager.querySql(sql, [comicId]);
if (result && result.length > 0) {
return result[0] as DatabaseRecord;
}... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOnlineComicById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left comicId AST#identifier#Right AST#type_annotation#Left AST#:#... | async getOnlineComicById(comicId: string): Promise<DatabaseRecord | null> {
try {
const sql = 'SELECT * FROM online_comic_info WHERE id = ?';
const result = await this.databaseManager.querySql(sql, [comicId]);
if (result && result.length > 0) {
return result[0] as DatabaseRecord;
}... | https://github.com/DaLongZhuaZi/manxia | af399b93205720698e47d559df2ca6697b36b881 | github |
iJcher/openharmony-app-znjj | entry/src/main/ets/components/ACmanager.ets | arkts | aboutToAppear | 模拟异步效果 | aboutToAppear(): void {
setTimeout(()=>{
this.isLoading=false
},1000)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#L... | aboutToAppear(): void {
setTimeout(()=>{
this.isLoading=false
},1000)
} | https://github.com/iJcher/openharmony-app-znjj | 9ffd179bbd1fd312f2da2919c05d113524f8cf01 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartBudgetService.ets | arkts | getBudgetOptimization | 获取预算优化建议(集成个性化过滤) | static async getBudgetOptimization(params: BudgetOptimizationParams): Promise<BudgetAdvice[]> {
hilog.info(HILOG_DOMAIN, LOG_TAG, '获取预算优化建议');
try {
const historicalData = await SmartBudgetService.fetchHistoricalData(params.userId, 6);
const config = BudgetForecastUtils.createDefaultConfig();
... | 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 getBudgetOptimization AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#... | static async getBudgetOptimization(params: BudgetOptimizationParams): Promise<BudgetAdvice[]> {
hilog.info(HILOG_DOMAIN, LOG_TAG, '获取预算优化建议');
try {
const historicalData = await SmartBudgetService.fetchHistoricalData(params.userId, 6);
const config = BudgetForecastUtils.createDefaultConfig();
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7ed7f2f50c3cb81410e1189174a59e8f969a99de | github |
xblLab/HarmonyProjectTemplate | components/module_player/src/main/ets/tools/PipManager.ets | arkts | onActionEvent | 监听画中画控制面板控件动作事件 | onActionEvent(control: PiPWindow.ControlEventParam) {
switch (control.controlType) {
// 视频播放、停止
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
// 停止视频
PipManager.getInstance().player.isPlaying = false;
} el... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onActionEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left control AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Le... | onActionEvent(control: PiPWindow.ControlEventParam) {
switch (control.controlType) {
// 视频播放、停止
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
// 停止视频
PipManager.getInstance().player.isPlaying = false;
} el... | https://github.com/xblLab/HarmonyProjectTemplate | 671894c78731a327d4dc6bcd40d7388994b58b3e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setSeconds | Sets the seconds for a specified date according to local time.
@param value new seconds | public setSeconds(value: byte): void {
assert value >= 0 && value < 60;
let sec = ecmaSecFromTime(this.ms - this.TZOffset * 60 * msPerSecond);
this.ms -= sec * msPerSecond;
this.ms += value * msPerSecond;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left byte AST#identifier#... | public setSeconds(value: byte): void {
assert value >= 0 && value < 60;
let sec = ecmaSecFromTime(this.ms - this.TZOffset * 60 * msPerSecond);
this.ms -= sec * msPerSecond;
this.ms += value * msPerSecond;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bc6b51af8de7a4a25df454592052e703ea75a5d7 | gitee |
arkui-x/samples | CodeLab/Cases/feature/danmakuplayer/src/main/ets/view/VideoView.ets | arkts | aboutToDisappear | 页面消失停止播放 | aboutToDisappear() {
const player: BaseVideoPlayer = GlobalContext.getContext().getObject('currentPlayer') as BaseVideoPlayer;
if (player) {
player.stop();
}
this.isQuit = true;
if (this.curDirection === Directions.VERTICAL) {
this.changeOrientation();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | aboutToDisappear() {
const player: BaseVideoPlayer = GlobalContext.getContext().getObject('currentPlayer') as BaseVideoPlayer;
if (player) {
player.stop();
}
this.isQuit = true;
if (this.curDirection === Directions.VERTICAL) {
this.changeOrientation();
}
} | https://gitcode.com/arkui-x/samples | aa8e49cd1c70a9268061bb4b643f89267f3fdfc9 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | indexOf | Returns the first index at which a given element
can be found in the array, or -1 if it is not present.
@param val value to search
@returns index of val, -1 otherwise | public indexOf(val: T): int {
for(let i = 0; i < this.data.length; i++) {
if (Array.objEquals<T>(val, this.data[i])) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AS... | public indexOf(val: T): int {
for(let i = 0; i < this.data.length; i++) {
if (Array.objEquals<T>(val, this.data[i])) {
return i
}
}
return -1
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4997a032c0d94fabe798cebe4a6e4bc51ccd721d | gitee |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateTime | 按指定时长触发振动
@param duration 振动时长,单位ms
@param usage 振动场景,默认TOUCH | static vibrateTime(duration: number, usage: VibrationUsage = VibrationUsage.TOUCH): void {
if (!VibratorManager.isEnabled()) {
return;
}
VibratorManager.logExecution(`vibrateTime(${duration}ms)`);
try {
vibrator.startVibration(
{ type: 'time', duration },
{ usage },
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | static vibrateTime(duration: number, usage: VibrationUsage = VibrationUsage.TOUCH): void {
if (!VibratorManager.isEnabled()) {
return;
}
VibratorManager.logExecution(`vibrateTime(${duration}ms)`);
try {
vibrator.startVibration(
{ type: 'time', duration },
{ usage },
... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 663a26b324677e39258c57353965f59272a767e7 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | handleContentUrl | -- Overlay callbacks (invoked by CountlyContentOverlay @Component) --
Called from the overlay component's Web.onLoadIntercept. Returns true if
the SDK handled the URL (close / link / event / resize_me / cly_x_int=1)
and the webview must block navigation. Returns false for regular page
navigation the webview should load... | public handleContentUrl(url: string): boolean {
if (Utils.isNullOrEmpty(url)) return false;
const isCommand: boolean = url.startsWith(ACTION_BASE_URL);
const isExternalMarker: boolean = url.indexOf(EXTERNAL_LINK_MARKER) !== -1;
if (!isCommand && !isExternalMarker) return false;
// Origin validat... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleContentUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public handleContentUrl(url: string): boolean {
if (Utils.isNullOrEmpty(url)) return false;
const isCommand: boolean = url.startsWith(ACTION_BASE_URL);
const isExternalMarker: boolean = url.indexOf(EXTERNAL_LINK_MARKER) !== -1;
if (!isCommand && !isExternalMarker) return false;
// Origin validat... | https://github.com/Countly/countly-sdk-hos | 6ff3d388c177fc79cbc2149fa891cd27a06b375f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setMonth | Sets the month for a specified date according to the currently set year.
@param { int } month new month
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setMonth(month: int): long {
let yearsNow: int = this.getFullYear();
let yearsOffSet: int = Math.floor(month / 12.0).toInt();
let yearsNew = yearsNow + yearsOffSet;
let adjustMonth = ((month % 12) + 12) % 12;
if (yearsNew !== yearsNow) {
this.setFullYear(ye... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left month AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig... | public setMonth(month: int): long {
let yearsNow: int = this.getFullYear();
let yearsOffSet: int = Math.floor(month / 12.0).toInt();
let yearsNew = yearsNow + yearsOffSet;
let adjustMonth = ((month % 12) + 12) % 12;
if (yearsNew !== yearsNow) {
this.setFullYear(ye... | https://gitcode.com/iop123123/arkts-static-skills | e887841b7617443bd2dc221be0987b12804a426b | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/HttpClient.ets | arkts | getBinaryWithClientCert | 执行带客户端证书的 HTTPS 请求并返回二进制数据
@param url 请求 URL
@param certPath 证书文件路径
@param keyPath 私钥文件路径
@param config 配置选项
@returns ArrayBuffer | static async getBinaryWithClientCert(
url: string,
certPath: string,
keyPath: string,
config?: HttpClientConfig
): Promise<ArrayBuffer> {
return HttpClient.getBinary(url, {
skipServerValidation: true,
clientCertPath: certPath,
clientKeyPath: keyPath,
connectTimeout: confi... | 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 getBinaryWithClientCert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#L... | static async getBinaryWithClientCert(
url: string,
certPath: string,
keyPath: string,
config?: HttpClientConfig
): Promise<ArrayBuffer> {
return HttpClient.getBinary(url, {
skipServerValidation: true,
clientCertPath: certPath,
clientKeyPath: keyPath,
connectTimeout: confi... | https://github.com/AlkaidLab/moonlight-harmony | 4f92d94c56063f511cbae6dc08fb7be2b53c67f0 | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/utils/ToolKits.ets | arkts | setStatusBarColor | 设置全面屏状态栏颜色。
@param context 上下文对象
@param statusBarContentColor 状态栏文本颜色
@param statusBarColor 状态栏背景色 | static setStatusBarColor(context: common.BaseContext, statusBarContentColor: string, statusBarColor: string) {
// window.getLastWindow(context).then((windowClass: window.Window) => { // 这种方式获得window对象时,在page首次启动后,为啥在onPageShow里调用setStatusBarColor没效果?
try {
let windowClass = AppStorage.get<window.Win... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setStatusBarColor 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_expr... | static setStatusBarColor(context: common.BaseContext, statusBarContentColor: string, statusBarColor: string) {
// window.getLastWindow(context).then((windowClass: window.Window) => { // 这种方式获得window对象时,在page首次启动后,为啥在onPageShow里调用setStatusBarColor没效果?
try {
let windowClass = AppStorage.get<window.Win... | https://github.com/JackJiang2011/harmonychat | 16ad762ab6485f6219722b48a8f63112c4e92f94 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets | arkts | getEventsByDateRange | 批量查询日程(例如按日期范围) | async getEventsByDateRange(startDate: number, endDate: number): Promise<CalendarEvent[]> {
const rdbStore = await this.initDatabase();
const events: CalendarEvent[] = [];
try {
const predicates = new relationalStore.RdbPredicates('calendar_events');
predicates.greaterThanOrEqualTo('start_time... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEventsByDateRange AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left startDate AST#identifier#Right AST#type_annotation#Left AS... | async getEventsByDateRange(startDate: number, endDate: number): Promise<CalendarEvent[]> {
const rdbStore = await this.initDatabase();
const events: CalendarEvent[] = [];
try {
const predicates = new relationalStore.RdbPredicates('calendar_events');
predicates.greaterThanOrEqualTo('start_time... | https://gitcode.com/openharmony/codelabs | 63f76d25b7fa5d20aef13fb2044f519303112794 | gitcode |
guoxiucai/ohos-scrcpy-app | scrcpy_server/entry/src/main/ets/scrcpyservice/AppListProvider.ets | arkts | buildAppListPayload | 拉列表并编成 AppList 设备状态 payload (含 subType=0x10)。 | static async buildAppListPayload(): Promise<Uint8Array> {
const apps = await AppListProvider.listRemovableApps();
return encodeAppList(apps);
} | 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 buildAppListPayload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | static async buildAppListPayload(): Promise<Uint8Array> {
const apps = await AppListProvider.listRemovableApps();
return encodeAppList(apps);
} | https://github.com/guoxiucai/ohos-scrcpy-app | 8c68ad4f47fce1348bffefa43c61f82b0d221760 | github |
Joker-x-dev/CoolMallArkTS | core/result/src/main/ets/RequestHelper.ets | arkts | loading | 配置是否展示 loading
@param {boolean} enable - 是否展示
@returns {RequestHelper<T>} 当前实例 | loading(enable: boolean = false): RequestHelper<T> {
this.useLoading = enable;
return this;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left loading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | loading(enable: boolean = false): RequestHelper<T> {
this.useLoading = enable;
return this;
} | https://github.com/Joker-x-dev/CoolMallArkTS | c69e5d7d703ba62e20be6ab376523fe5fa06c1f2 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/DebounceUtil.ets | arkts | reset | 重置节流状态
@param key 唯一标识键 | static reset(key: string): void {
ThrottleUtil.lastExecuteTime.delete(key)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static reset(key: string): void {
ThrottleUtil.lastExecuteTime.delete(key)
} | https://github.com/Yebingiscn/SweetVideo | 3682216b5ab73f89412e93ada6c20b98ed757368 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/utils/ExpressionEvaluator.ets | arkts | evaluate | 验证表达式是否合法并计算结果
@param expression 用户输入的表达式
@param cards 当前的4张牌
@returns 验证结果对象 | static evaluate(expression: string, cards: Card[]): EvaluationResult {
try {
// 预处理表达式,适配多种输入方式
let processedExpression = expression;
// 移除空格和制表符
processedExpression = processedExpression.replace(/\s/g, '');
// 检查表达式是否为空
if (!processedExpression) {
// 定义结果... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left evaluate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left expression AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | static evaluate(expression: string, cards: Card[]): EvaluationResult {
try {
// 预处理表达式,适配多种输入方式
let processedExpression = expression;
// 移除空格和制表符
processedExpression = processedExpression.replace(/\s/g, '');
// 检查表达式是否为空
if (!processedExpression) {
// 定义结果... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 34d3a8482082f57d143ec8659f440864ebd70c19 | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets | arkts | getAllPlans | 获取所有计划 | async getAllPlans(): Promise<Plan[]> {
if (!this.preferences) {
return [];
}
try {
const plansJson = await this.preferences.get(this.KEY_PLANS, '[]');
const plansData: PlanData[] = JSON.parse(plansJson as string) as PlanData[];
const plans: Plan[] = [];
for (let i = 0; i < ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllPlans AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST... | async getAllPlans(): Promise<Plan[]> {
if (!this.preferences) {
return [];
}
try {
const plansJson = await this.preferences.get(this.KEY_PLANS, '[]');
const plansData: PlanData[] = JSON.parse(plansJson as string) as PlanData[];
const plans: Plan[] = [];
for (let i = 0; i < ... | https://gitcode.com/openharmony/codelabs | 15a0800614883aef865892fe6dcc9601c84825aa | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | buildNativeScript | 构建Native JSVM执行脚本
包含完整的辅助函数和上下文变量 | private buildNativeScript(code: string, context: JsContext): string {
// 获取sourceUrl(优先从variables中获取,否则使用baseUrl)
const sourceUrl = context.variables?.['sourceUrl'] || context.baseUrl || '';
const activeJsLib = context.jsLib !== undefined ? context.jsLib : this.jsLib;
const sourceBookSourceName = cont... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildNativeScript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private buildNativeScript(code: string, context: JsContext): string {
// 获取sourceUrl(优先从variables中获取,否则使用baseUrl)
const sourceUrl = context.variables?.['sourceUrl'] || context.baseUrl || '';
const activeJsLib = context.jsLib !== undefined ? context.jsLib : this.jsLib;
const sourceBookSourceName = cont... | https://github.com/DaLongZhuaZi/manxia | 6eec7fadba25c5fa05494f67b26b3a354ab60248 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | createDataChannel | 创建数据通道 | public createDataChannel(label: string, ordered: boolean = true): boolean {
if (!this.client) return false;
return this.client.createDataChannel(label, ordered);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createDataChannel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public createDataChannel(label: string, ordered: boolean = true): boolean {
if (!this.client) return false;
return this.client.createDataChannel(label, ordered);
} | https://github.com/tdcare/tdwebrtc | 379742c598bd2531c35cadb5586f36446102d600 | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/notify/TnNotify.ets | arkts | show | 显示消息通知
@param option 通知配置选项 | public show(option: TnNotifyOption): void {
// 如果当前有通知正在显示,先关闭
if (this.isShowing) {
this.closeImmediate();
}
this.isShowing = true;
this.uiContext = ContextUtil.getUICtx();
const promptAction = this.uiContext.getPromptAction();
const params: TnNotifyParams = new TnNotifyParams(optio... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public show(option: TnNotifyOption): void {
// 如果当前有通知正在显示,先关闭
if (this.isShowing) {
this.closeImmediate();
}
this.isShowing = true;
this.uiContext = ContextUtil.getUICtx();
const promptAction = this.uiContext.getPromptAction();
const params: TnNotifyParams = new TnNotifyParams(optio... | https://github.com/codelably/tuniao-ui | 3336e62452a7ba41ddd534a3c870d02d2b445e09 | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/utils/Utils.ets | arkts | getTimeStr | 通过时间戳转时间字符串 | static getTimeStr(time:number){
return dayjs(time).format('YYYY.MM.DD HH:mm:ss')
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTimeStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | static getTimeStr(time:number){
return dayjs(time).format('YYYY.MM.DD HH:mm:ss')
} | https://github.com/wanrenhuifu/JLU | 66323eed1439a833705b2f83f1db0de382791ee3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/SourceTabContent.ets | arkts | build | ── UI 构建方法 ── | build() {
Stack({ alignContent: Alignment.TopStart }) {
Column({ space: 0 }) {
// 顶部避让空间
Blank().height(this.getInitialTopOverlaySpacerHeight())
// 搜索栏
this.buildSearchBar()
// 功能按钮行
this.buildActionButtons()
// 图源列表区域
Refresh({ refreshing: ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack({ alignContent: Alignment.TopStart }) {
Column({ space: 0 }) {
// 顶部避让空间
Blank().height(this.getInitialTopOverlaySpacerHeight())
// 搜索栏
this.buildSearchBar()
// 功能按钮行
this.buildActionButtons()
// 图源列表区域
Refresh({ refreshing: ... | https://github.com/DaLongZhuaZi/manxia | ef5955782d5ed488241dd87ac525692dae639398 | github |
LYM15/FireflyCompanion | entry/src/main/ets/utils/UserDataUtils.ets | arkts | saveUserList | 保存用户列表 | static saveUserList(userList: UserInfo[]): void {
try {
AppStorage.setOrCreate(UserDataUtils.STORAGE_KEY, JSON.stringify(userList));
} catch (err) {
console.error('Failed to save user list:' + JSON.stringify(err));
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveUserList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre... | static saveUserList(userList: UserInfo[]): void {
try {
AppStorage.setOrCreate(UserDataUtils.STORAGE_KEY, JSON.stringify(userList));
} catch (err) {
console.error('Failed to save user list:' + JSON.stringify(err));
}
} | https://github.com/LYM15/FireflyCompanion | 6d3baae23276e0567864322d6945542a05ea2449 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | isAnimationPlaying | 检查动画是否正在播放 | public isAnimationPlaying(animationId: string): boolean {
const state = this.activeAnimations.get(animationId);
return state ? state.isPlaying : false;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAnimationPlaying AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | public isAnimationPlaying(animationId: string): boolean {
const state = this.activeAnimations.get(animationId);
return state ? state.isPlaying : false;
} | https://github.com/DaLongZhuaZi/manxia | f8a67f85c9674f28b4f8ec81fd5398b3b2f0a10c | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.