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 |
|---|---|---|---|---|---|---|---|---|---|---|
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getPrimarySlotId | 获取主卡所在卡槽的索引号。使用Promise异步回调。
@returns | static async getPrimarySlotId(): Promise<number> {
return radio.getPrimarySlotId();
} | 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 getPrimarySlotId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | static async getPrimarySlotId(): Promise<number> {
return radio.getPrimarySlotId();
} | https://github.com/tdcare/tdwebrtc | 0427bdc8ca33902ad9f0ecc2211787de50081440 | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/features/challenge/src/main/ets/components/ZoneDetailModal.ets | arkts | getAllText | get text of whole zone item | getAllText(): string {
const contentText: string = this.selectedZone.content.map((res: ResourceStr) => typeof res === 'string' ?
res : resourceManager.getStringSync(res)).join('');
return contentText + resourceManager.getStringSync(this.selectedZone.buildingInformation);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_b... | getAllText(): string {
const contentText: string = this.selectedZone.content.map((res: ResourceStr) => typeof res === 'string' ?
res : resourceManager.getStringSync(res)).join('');
return contentText + resourceManager.getStringSync(this.selectedZone.buildingInformation);
} | https://gitcode.com/HarmonyOS_Samples/hmosworld | 12892f194df71b7f23608735c3ca6439629a847a | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | hashString | 计算字符串的哈希值
@param str 字符串
@returns 哈希值 | private static hashString(str: string): number {
let hash: number = 0;
const length: number = str.length;
for (let i = 0; i < length; i++) {
const char: number = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash; // 转换为32位整数
}
return Math.abs(hash);
} | 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 hashString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST... | private static hashString(str: string): number {
let hash: number = 0;
const length: number = str.length;
for (let i = 0; i < length; i++) {
const char: number = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash; // 转换为32位整数
}
return Math.abs(hash);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L66-L75 | 435a6bbf09e4ea01c69d274ec57d9d06e8423710 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getTokenDailyTrend | 获取最近 dayCount 天的每日 Token 用量趋势(本地时区分桶,账本 total_tokens 求和) | async getTokenDailyTrend(dayCount: number = 30): Promise<DailyUsagePoint[]> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return []
}
const safeDayCount = dayCount > 0 ? dayCount : 30
const sinceMs = Date.now() - safeDayCount * 24 * 60 * 60 * 1000
const valueByDay = ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTokenDailyTrend AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dayCount AST#identifier#Right AST#type_annotation#Left AST#:... | async getTokenDailyTrend(dayCount: number = 30): Promise<DailyUsagePoint[]> {
await this.waitForInitialization()
if (this.rdbStore === null) {
return []
}
const safeDayCount = dayCount > 0 ? dayCount : 30
const sinceMs = Date.now() - safeDayCount * 24 * 60 * 60 * 1000
const valueByDay = ... | https://github.com/LongLiveY96/chatcube | 5247568f1017a59a01433fe94147a10938a97f1a | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | saveToDisk | 持久化到 Preferences | private async saveToDisk(): Promise<void> {
if (!this.dataPreferences) { return; }
try {
if (this.credential) {
this.dataPreferences.putSync(KEY_CREDENTIAL, JSON.stringify(this.credential));
} else {
this.dataPreferences.deleteSync(KEY_CREDENTIAL);
}
this.dataPreference... | 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 saveToDisk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | private async saveToDisk(): Promise<void> {
if (!this.dataPreferences) { return; }
try {
if (this.credential) {
this.dataPreferences.putSync(KEY_CREDENTIAL, JSON.stringify(this.credential));
} else {
this.dataPreferences.deleteSync(KEY_CREDENTIAL);
}
this.dataPreference... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | c769bcfad28331b7abd1f8b03703f92d853694d4 | github |
apap6628114/nga_oh | entry/src/main/ets/common/utils/LinkUtils.ets | arkts | parseQueryString | 解析查询字符串为键值 Map。 | function parseQueryString(qs: string): Map<string, string> {
const params: Map<string, string> = new Map()
const parts: string[] = qs.split('&')
for (let i = 0; i < parts.length; i++) {
const kv: string[] = parts[i].split('=')
if (kv.length === 2) params.set(kv[0], kv[1])
}
return params
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseQueryString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left qs AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function parseQueryString(qs: string): Map<string, string> {
const params: Map<string, string> = new Map()
const parts: string[] = qs.split('&')
for (let i = 0; i < parts.length; i++) {
const kv: string[] = parts[i].split('=')
if (kv.length === 2) params.set(kv[0], kv[1])
}
return params
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/utils/LinkUtils.ets#L50-L58 | 7b0f2158ab5c933205e5fa08c12b2c1ec97ee194 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/DiskCacheManager.ets | arkts | ensureCacheSpace | 确保有足够的缓存空间 | private async ensureCacheSpace(requiredSize: number): Promise<void> {
if (this.totalSize + requiredSize <= this.MAX_CACHE_SIZE) {
return;
}
logger.info(TAG, `缓存空间不足,开始清理: 当前=${(this.totalSize / 1024 / 1024).toFixed(2)}MB, 需要=${(requiredSize / 1024 / 1024).toFixed(2)}MB`);
// 按LRU策略排序(最近最少使用的在前... | 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 ensureCacheSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requiredSize AST#identifier#Right AST#ERROR#Left AS... | private async ensureCacheSpace(requiredSize: number): Promise<void> {
if (this.totalSize + requiredSize <= this.MAX_CACHE_SIZE) {
return;
}
logger.info(TAG, `缓存空间不足,开始清理: 当前=${(this.totalSize / 1024 / 1024).toFixed(2)}MB, 需要=${(requiredSize / 1024 / 1024).toFixed(2)}MB`);
// 按LRU策略排序(最近最少使用的在前... | https://github.com/DaLongZhuaZi/manxia | 17954459a5a673c192c6b94a9a37be9ab3f5764b | github |
openharmony/arkui_ace_engine | examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets | arkts | build | ===================== UI 构建 ===================== | build() {
Column() {
Tabs({ barPosition: BarPosition.Start, index: this.currentTab }) {
TabContent() {
this.buildDrawableDescriptorTab()
}
.tabBar('DrawableDescriptor')
TabContent() {
this.buildLayeredTab()
}
.tabBar('Layered')
Ta... | 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() {
Column() {
Tabs({ barPosition: BarPosition.Start, index: this.currentTab }) {
TabContent() {
this.buildDrawableDescriptorTab()
}
.tabBar('DrawableDescriptor')
TabContent() {
this.buildLayeredTab()
}
.tabBar('Layered')
Ta... | https://gitcode.com/openharmony/arkui_ace_engine | 0e717a150a1808ebdce67f310b33ccbb28ac7552 | gitcode |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | getThemeVideos | @summary Get theme videos for an item.
@param {LibraryApiGetThemeVideosRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public async getThemeVideos(requestParameters: LibraryApiGetThemeVideosRequest): Promise<ThemeMediaResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/ThemeVideos`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getThemeVideos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AS... | public async getThemeVideos(requestParameters: LibraryApiGetThemeVideosRequest): Promise<ThemeMediaResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/ThemeVideos`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 936df0447adf060a94731d42234ab9d8457519ae | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/components/TKExaminationItem.ets | arkts | getISSelected | 判断选项是否被选中 | getISSelected(option:Option){
let question = this.userAnswers.find(obj=>obj.questionId===this.item.id)
if (question) { //答题记录中有这道题
if (question.userAnswer.indexOf(option.identify) >= 0) {
return true
}else{
return false
}
}else{
return false
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getISSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left option AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Option AST#identifier#Right AST#ERROR#Rig... | getISSelected(option:Option){
let question = this.userAnswers.find(obj=>obj.questionId===this.item.id)
if (question) { //答题记录中有这道题
if (question.userAnswer.indexOf(option.identify) >= 0) {
return true
}else{
return false
}
}else{
return false
}
} | https://github.com/wanrenhuifu/JLU | 0f7a6c5e0281f40d48946e80d87cd3036cbde4a7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/WorkerLocal.ets | arkts | set | Updates the worker-local value for current worker.
@param {T} value - New value to store for current worker | set(value: T):void {
this.mutex.lockGuard(() => {
const workerId = CoroutineExtras.getWorkerId();
this.storage.set(workerId, new Wrapper<T>(value));
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST... | set(value: T):void {
this.mutex.lockGuard(() => {
const workerId = CoroutineExtras.getWorkerId();
this.storage.set(workerId, new Wrapper<T>(value));
});
} | https://gitcode.com/iop123123/arkts-static-skills | 2228bcaf26fb5f82987fd4a851f5d9f288014da2 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | subarray | Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices.
@param { int } [start] - Where the new Buffer will start
@param { int } [end] - Where the new Buffer will end (not inclusive)
@returns { Buffer } Returns a new Buffer that references the same memor... | public subarray(start?: int, end?: int): Buffer {
if (start == undefined || isNaN(start!)) {
start = 0
}
if (end == undefined || isNaN(end!) || end > this.length) {
end = this.length
}
let s = start + this.byteOffset
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left start AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le... | public subarray(start?: int, end?: int): Buffer {
if (start == undefined || isNaN(start!)) {
start = 0
}
if (end == undefined || isNaN(end!) || end > this.length) {
end = this.length
}
let s = start + this.byteOffset
... | https://gitcode.com/iop123123/arkts-static-skills | 09abdd0a3bd7d84fc3bd4878b140488621e021ba | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ScatterData.ets | arkts | getGreatestShapeSize | Returns the maximum shape-size across all DataSets.
@return | public getGreatestShapeSize() {
let max = 0;
for (let i = 0;i < this.mDataSets.size(); i++) {
const set = this.mDataSets.get(i);
const size = set.getScatterShapeSize();
if (size > max)
max = size;
}
return max;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGreatestShapeSize 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#{... | public getGreatestShapeSize() {
let max = 0;
for (let i = 0;i < this.mDataSets.size(); i++) {
const set = this.mDataSets.get(i);
const size = set.getScatterShapeSize();
if (size > max)
max = size;
}
return max;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fdd689845529a61b0633745a8a541729c1442da6 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | updateTabContent | 更新标签内容 | updateTabContent(tabId: string, markdownContent: string): void {
const tab = this.tabs.find(t => t.id === tabId);
if (tab) {
tab.markdownContent = markdownContent;
tab.isLoading = false;
this.notifyCallback();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateTabContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tabId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left... | updateTabContent(tabId: string, markdownContent: string): void {
const tab = this.tabs.find(t => t.id === tabId);
if (tab) {
tab.markdownContent = markdownContent;
tab.isLoading = false;
this.notifyCallback();
}
} | https://github.com/DaLongZhuaZi/manxia | ee456d80245db046f549d963ce7af4f128c6642e | github |
openharmony-sig/ohos_checksum | library/src/main/ets/sha1.ets | arkts | binb2hex | Convert an array of big-endian words to a hex string. | binb2hex(binarray: number[]): string {
let hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
let str = "";
for (let i = 0; i < binarray.length * 4; i++) {
str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +
hex_tab.charAt((binarray[i >> 2] >> ((3 - i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left binb2hex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left binarray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#[#Left [ AST#[#Right AST#]#Left ] A... | binb2hex(binarray: number[]): string {
let hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
let str = "";
for (let i = 0; i < binarray.length * 4; i++) {
str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +
hex_tab.charAt((binarray[i >> 2] >> ((3 - i... | https://gitee.com/openharmony-sig/ohos_checksum.git | daf05b7537d0c1739d9ba277da3f38052555e898 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/line/LineChartRenderer.ets | arkts | formatNumber | 格式化数字 | private formatNumber(value: number): string {
if (Math.abs(value) >= 1000000) {
return (value / 1000000).toFixed(1) + 'M';
} else if (Math.abs(value) >= 1000) {
return (value / 1000).toFixed(1) + 'K';
}
return value.toFixed(1);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private formatNumber(value: number): string {
if (Math.abs(value) >= 1000000) {
return (value / 1000000).toFixed(1) + 'M';
} else if (Math.abs(value) >= 1000) {
return (value / 1000).toFixed(1) + 'K';
}
return value.toFixed(1);
} | https://github.com/LJ666-ui/harmony-health-care | 645b144c778e7e700690906cbebb8247b215af92 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AdviceFeedback.ets | arkts | toJSON | 序列化为JSON | toJSON(): AdviceFeedbackJSON {
return {
feedbackId: this.feedbackId,
userId: this.userId,
adviceId: this.adviceId,
adviceType: this.adviceType,
categoryId: this.categoryId,
categoryName: this.categoryName,
suggestedBudget: this.suggestedBudget,
originalBudget: this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toJSON 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 AdviceFeedbackJSON AST#identifier#Right AST#ERROR#Right... | toJSON(): AdviceFeedbackJSON {
return {
feedbackId: this.feedbackId,
userId: this.userId,
adviceId: this.adviceId,
adviceType: this.adviceType,
categoryId: this.categoryId,
categoryName: this.categoryName,
suggestedBudget: this.suggestedBudget,
originalBudget: this.... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 796f312e72a250146b9548e02a0b6a84417034d8 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/MusicDbApi.ets | arkts | rowToSongApiDto | Maps a {@link SongRow} to {@link SongApiDto}. | private rowToSongApiDto(row: SongRow): SongApiDto {
const dto = new SongApiDto();
dto.id = row.id;
dto.title = row.title;
dto.singer = row.singer;
dto.mark = row.mark;
dto.label = row.label;
dto.src = row.src;
dto.index = row.index;
dto.lyric = row.lyric;
return dto;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rowToSongApiDto AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left row AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private rowToSongApiDto(row: SongRow): SongApiDto {
const dto = new SongApiDto();
dto.id = row.id;
dto.title = row.title;
dto.singer = row.singer;
dto.mark = row.mark;
dto.label = row.label;
dto.src = row.src;
dto.index = row.index;
dto.lyric = row.lyric;
return dto;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 267d7581a5c5fe124a80457a9bbf083ece147c6e | gitcode |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onFailedCallback | 连接失败的回调 | function onFailedCallback(code) {
console.log('[game]connectRemoteService onFailedCallback')
prompt.showToast({
message: "onConnectRemoteService onFailed: " + code
});
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left onFailedCallback AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#required_parameter#Right AST#)#Left ) A... | function onFailedCallback(code) {
console.log('[game]connectRemoteService onFailedCallback')
prompt.showToast({
message: "onConnectRemoteService onFailed: " + code
});
} | https://gitee.com/openharmony/codelabs.git | 8661c4f63f360ce4ad1fb7e79e7418420d266e2c | gitee |
Tianpei-Shi/MusicDash | src/model/UserModel.ets | arkts | fromJson | 从JSON对象创建UserInfo实例 | static fromJson(json: UserJsonData): UserInfo {
return new UserInfo(
json.id,
json.username,
json.password
);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UserJso... | static fromJson(json: UserJsonData): UserInfo {
return new UserInfo(
json.id,
json.username,
json.password
);
} | https://github.com/Tianpei-Shi/MusicDash | 857299e3617d10c542197e5c696a3f4cd433c9ae | github |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/common/PreferencesUtil.ets | arkts | putBoolean | 存储布尔值数据
@param context 应用上下文
@param key 键
@param value 值 | static async putBoolean(context: common.UIAbilityContext, key: string, value: boolean): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Pr... | 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 putBoolean 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 putBoolean(context: common.UIAbilityContext, key: string, value: boolean): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Pr... | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | c4de784a198d87ef4a9d4fc7f4facf421646bd52 | gitcode |
ibestservices/ibest-ui | library/src/main/ets/components/picker/index.ets | arkts | updateOffset | 更新某一列offset | updateOffset(columnIndex: number, offset: number){
this.offsetList[columnIndex] = offset
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left columnIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A... | updateOffset(columnIndex: number, offset: number){
this.offsetList[columnIndex] = offset
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L498-L500 | b41501b19fbff913f85314710737b53134913d51 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportNovelDictRules | 导出小说词典规则 | private async exportNovelDictRules(): Promise<NovelDictRuleBackup[]> {
try {
const sql = 'SELECT * FROM novel_dict_rule ORDER BY sortNumber ASC';
const results = await this.dbManager.querySql(sql);
const items: NovelDictRuleBackup[] = [];
for (const record of results) {
const rec ... | 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 exportNovelDictRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | private async exportNovelDictRules(): Promise<NovelDictRuleBackup[]> {
try {
const sql = 'SELECT * FROM novel_dict_rule ORDER BY sortNumber ASC';
const results = await this.dbManager.querySql(sql);
const items: NovelDictRuleBackup[] = [];
for (const record of results) {
const rec ... | https://github.com/DaLongZhuaZi/manxia | b5be04ffba7dd2c0189592c82df919ea4707218c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | updateXComponentActualSize | 更新 XComponent 实际渲染尺寸(由 onAreaChange 回调触发)
窗口模式下 XComponent 为 '100%',实际 vp 尺寸需从 onAreaChange 获取 | updateXComponentActualSize(widthVp: number, heightVp: number): void {
this.viewWidthVp = widthVp;
this.viewHeightVp = heightVp;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateXComponentActualSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left widthVp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#... | updateXComponentActualSize(widthVp: number, heightVp: number): void {
this.viewWidthVp = widthVp;
this.viewHeightVp = heightVp;
} | https://github.com/AlkaidLab/moonlight-harmony | aa1d3d5fb3757e6bc2552c4a7ec941f4dbc2cae4 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | getThemeSongs | @summary Get theme songs for an item.
@param {LibraryApiGetThemeSongsRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public async getThemeSongs(requestParameters: LibraryApiGetThemeSongsRequest): Promise<ThemeMediaResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/ThemeSongs`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getThemeSongs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST... | public async getThemeSongs(requestParameters: LibraryApiGetThemeSongsRequest): Promise<ThemeMediaResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Items/${requestParameters.itemId}/ThemeSongs`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | c6df8c38f09a3a9e6f18c5578601a28f549bb31a | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/ServerConfig.ets | arkts | applyUserPropertyFilter | Return true if a user-property key passes the filter. ModuleUserProfile
applies this on every set/setOnce/inc/push/pull/unset key. | public static applyUserPropertyFilter(propertyName: string, sc: ServerConfig): boolean {
return ListingFilters.applyListFilter(propertyName, sc.userPropertyFilter.filterList, sc.userPropertyFilter.isWhitelist);
} | 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 applyUserPropertyFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Le... | public static applyUserPropertyFilter(propertyName: string, sc: ServerConfig): boolean {
return ListingFilters.applyListFilter(propertyName, sc.userPropertyFilter.filterList, sc.userPropertyFilter.isWhitelist);
} | https://github.com/Countly/countly-sdk-hos | b6464ddf406b0050ad35eff54e9514ad4897a747 | github |
LZZLHY/hlib | entry/src/main/ets/api/ZLibraryClient.ets | arkts | assertOk | ─── 内部 ─────────────────────────────────────────── | private static assertOk(resp: ApiResponse): void {
const ok = resp.success === true || resp.success === 1;
if (!ok) {
const msg = resp.error || resp.message || 'api_failed';
throw new ApiError(msg);
}
} | 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 assertOk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resp AST#identifier#Right AST#:#Left : AST#... | private static assertOk(resp: ApiResponse): void {
const ok = resp.success === true || resp.success === 1;
if (!ok) {
const msg = resp.error || resp.message || 'api_failed';
throw new ApiError(msg);
}
} | https://github.com/LZZLHY/hlib | 62f4ba7c62cbfe270bda89204d53b0b67f185a2a | github |
egavrin/arkts_agent_kit | examples/fslib/src/tests/fslib.test.ets | arkts | testCopyFile | --- copyFile --- | function testCopyFile(): void {
ensureSetup()
let fs = new FileSystem()
let src: string = TMPDIR + "/cpy_src.txt"
let dest: string = TMPDIR + "/cpy_dest.txt"
fs.writeText(src, "copy me")
fs.copyFile(src, dest)
arktest.assertTrue(fs.exists(dest))
arktest.assertEQ(fs.readText(dest), "copy ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testCopyFile 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_typ... | function testCopyFile(): void {
ensureSetup()
let fs = new FileSystem()
let src: string = TMPDIR + "/cpy_src.txt"
let dest: string = TMPDIR + "/cpy_dest.txt"
fs.writeText(src, "copy me")
fs.copyFile(src, dest)
arktest.assertTrue(fs.exists(dest))
arktest.assertEQ(fs.readText(dest), "copy ... | https://gitcode.com/egavrin/arkts_agent_kit | f347a6e89c4deaa5e42ae24d3106fd35feb7c8b7 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | internal | Checks if ctx function returned an error
@throws TypeAPICreateException if error was found | internal checkError(arg: string | null): void throws {
if (arg != null) {
throw new TypeAPICreateException(arg as string)
}
} | AST#program#Left AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expre... | internal checkError(arg: string | null): void throws {
if (arg != null) {
throw new TypeAPICreateException(arg as string)
}
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 80f099903a292f6ec4ece5dd8564b8bed036868c | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | setTitleSize | 设置标题字体大小
@param size 字体大小 | public setTitleSize(size: number): void {
this.titleSize = size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTitleSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | public setTitleSize(size: number): void {
this.titleSize = size;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | c03c7a3502cef02aa489828ecbc3b31abe31dada | gitcode |
openharmony-sig/knowledge_demo_entainment | FA/GuoChat/entry/src/main/ets/MainAbility/pages/Moments.ets | arkts | build | 用户昵称
private momentItems: MomentData[] = getMomentDatas() //获取好友动态数据 | build(){
Column(){
/**
* 顶部封面布局
*/
Stack({ alignContent: Alignment.Top }){
//最下层的封面图片
Image($r('app.media.man'))
.objectFit(ImageFit.Cover)
.height(250)
.width('100%')
//返回按钮和拍摄按钮
Flex({direction: FlexDirection.Row , justifyCo... | 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#object#Left AST#{#Left { AST#{#Right AST#method_def... | build(){
Column(){
/**
* 顶部封面布局
*/
Stack({ alignContent: Alignment.Top }){
//最下层的封面图片
Image($r('app.media.man'))
.objectFit(ImageFit.Cover)
.height(250)
.width('100%')
//返回按钮和拍摄按钮
Flex({direction: FlexDirection.Row , justifyCo... | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | a3b7d4fbd7e7c5061c2011cdae2891ecc020b093 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamLifecycleManager.ets | arkts | handleDisplayChange | 处理屏幕变化事件
@param displayId 发生变化的显示器 ID | private handleDisplayChange(displayId: number): void {
// 只处理连接状态
if (!this.viewModel?.isConnected) {
return;
}
try {
const displayInfo = display.getDefaultDisplaySync();
const isLandscape = displayInfo.width > displayInfo.height;
// 只有方向真正变化时才处理
if (this.lastDisplayOri... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleDisplayChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left displayId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | private handleDisplayChange(displayId: number): void {
// 只处理连接状态
if (!this.viewModel?.isConnected) {
return;
}
try {
const displayInfo = display.getDefaultDisplaySync();
const isLandscape = displayInfo.width > displayInfo.height;
// 只有方向真正变化时才处理
if (this.lastDisplayOri... | https://github.com/AlkaidLab/moonlight-harmony | fa8535c2d1a9f86562d8ee46c0ea59b096eabb5f | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveConfig.ets | arkts | getAccessTokenText | 获取访问令牌文本
@returns 访问令牌 | public getAccessTokenText(): string {
return Sm4Utils.decryptWithPrefix(this.accessToken);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAccessTokenText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string ... | public getAccessTokenText(): string {
return Sm4Utils.decryptWithPrefix(this.accessToken);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveConfig.ets#L69-L71 | aa6eae85106f791ae6b6df1cdb597b69cbd0b1f6 | github |
fbinba3955/Flymby | common/src/main/ets/utils/NetSpeedManager.ets | arkts | startWatchSpeed | 开始监控网速 | async startWatchSpeed() {
statistics.getAllRxBytes((error: BusinessError, stats: number) => {
LogUtil.info("startWatchSpeed" + " - getUidRxBytes stats:" + stats + " error:" + error?.code)
if (!error) {
if (this.lastRxBytes >= 0) {
this.currentNetDxSpeed = StringUtil.formatSpeed(stats... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startWatchSpeed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expr... | async startWatchSpeed() {
statistics.getAllRxBytes((error: BusinessError, stats: number) => {
LogUtil.info("startWatchSpeed" + " - getUidRxBytes stats:" + stats + " error:" + error?.code)
if (!error) {
if (this.lastRxBytes >= 0) {
this.currentNetDxSpeed = StringUtil.formatSpeed(stats... | https://github.com/fbinba3955/Flymby | 2e5dfd0d91417cc0152e26a45ccbb0324473aab8 | github |
honjow/Next2V | shared/src/main/ets/utils/FoldScreenUtil.ets | arkts | unregisterCallback | Unregister callback
@param callback Callback to unregister | unregisterCallback(callback: (value: boolean) => void): void {
const index = this.callbacks.indexOf(callback)
if (index > -1) {
this.callbacks.splice(index, 1)
}
} | AST#program#Left AST#ERROR#Left AST#identifier#Left unregisterCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie... | unregisterCallback(callback: (value: boolean) => void): void {
const index = this.callbacks.indexOf(callback)
if (index > -1) {
this.callbacks.splice(index, 1)
}
} | https://github.com/honjow/Next2V | 34e83569cfad516802993958f65274d4a1a9a2d0 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/views/components/TopicBadges.ets | arkts | getTagSymbol | 标签名 -> 图标映射(覆盖常见中文标签;未知返回 null) | static getTagSymbol(tagName: string): Resource | null {
const key: string = tagName.trim();
if (key.length === 0) return null;
switch (key) {
// ── 中文标签 ──
case '公告':
case '公益推广':
case '推广':
return $r('sys.symbol.bell');
case '精华神帖':
case '优质博文':
return... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTagSymbol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tagName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | static getTagSymbol(tagName: string): Resource | null {
const key: string = tagName.trim();
if (key.length === 0) return null;
switch (key) {
// ── 中文标签 ──
case '公告':
case '公益推广':
case '推广':
return $r('sys.symbol.bell');
case '精华神帖':
case '优质博文':
return... | https://github.com/Amaz1ny/HarmonyDO-public | a9ba9c0da419690680f8745243a3387fc20b001d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | localeCompareDefaultCanUseFastPath | All the available locales that are statically known to fulfill fast path conditions. | private static localeCompareDefaultCanUseFastPath(locale: string): boolean {
switch (locale) {
case "en-US":
case "en":
case "fr":
case "es":
case "de":
case "pt":
case "it":
case "ca":
case "de-AT":
... | 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 localeCompareDefaultCanUseFastPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locale AST#identi... | private static localeCompareDefaultCanUseFastPath(locale: string): boolean {
switch (locale) {
case "en-US":
case "en":
case "fr":
case "es":
case "de":
case "pt":
case "it":
case "ca":
case "de-AT":
... | https://gitcode.com/iop123123/arkts-static-skills | b257f13cbdfa2f6a1dbbc9f1ee504496a7bbae22 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | getFileListFromSource | 从下载源获取文件列表(电子书专用)
@param sourceUrl 下载源URL | async getFileListFromSource(sourceUrl: string): Promise<EngineResult<Object[]>> {
const startTime = Date.now();
try {
const taskParams: Record<string, Object | undefined> = {};
taskParams['sourceUrl'] = sourceUrl;
const result = await this.executeTask('getFileListFromSource', taskParams... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFileListFromSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceUrl AST#identifier#Right AST#type_annotation#Left A... | async getFileListFromSource(sourceUrl: string): Promise<EngineResult<Object[]>> {
const startTime = Date.now();
try {
const taskParams: Record<string, Object | undefined> = {};
taskParams['sourceUrl'] = sourceUrl;
const result = await this.executeTask('getFileListFromSource', taskParams... | https://github.com/DaLongZhuaZi/manxia | 3ad621b6db29baaa5f84081cd63ed744f279384f | github |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/util/RecommendDataUtil.ets | arkts | getCategoryTabs | Fetches category tabs from the music DB and maps them to UI models.
@returns Category chip tab models. | public static getCategoryTabs(): RecommendCategoryTabUi[] {
return MusicDbApi.getInstance().getCategoryTabs().map((dto) => RecommendDataUtil.mapTabDtoToUi(dto));
} | 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 getCategoryTabs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public static getCategoryTabs(): RecommendCategoryTabUi[] {
return MusicDbApi.getInstance().getCategoryTabs().map((dto) => RecommendDataUtil.mapTabDtoToUi(dto));
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 4d73f724c7dfd9b390f095d839c0f34a5f2868b9 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/ThemeColors.ets | arkts | unregister | 取消注册主题色状态
@param state ThemeColorState实例 | static unregister(state: ThemeColorState): void {
const id = state.getId();
const registration = ThemeColorManager.registrations.get(id);
if (registration) {
// 从ThemeManager取消注册
const themeManager = ThemeManager.getInstance();
themeManager.offThemeChange(registration.themeCallback)... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Them... | static unregister(state: ThemeColorState): void {
const id = state.getId();
const registration = ThemeColorManager.registrations.get(id);
if (registration) {
// 从ThemeManager取消注册
const themeManager = ThemeManager.getInstance();
themeManager.offThemeChange(registration.themeCallback)... | https://github.com/DaLongZhuaZi/manxia | 551351b25a412bb47b14cfd2f1670d7668f83338 | github |
Vsolon0401/MallShopping | common/src/main/ets/service/ShoppingCartService.ets | arkts | fetchCartList | 获取当前用户购物车列表
@returns | async fetchCartList() {
return Request.get('/cart/list').then(res => {
const data: CartItem[] = res.data
// 格式化商品属性
data.forEach(product => {
const specificationList: any[] = JSON.parse(product.productAttr)
let specification = specificationList.reduce((pre, cur) => {
re... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchCartList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#... | async fetchCartList() {
return Request.get('/cart/list').then(res => {
const data: CartItem[] = res.data
// 格式化商品属性
data.forEach(product => {
const specificationList: any[] = JSON.parse(product.productAttr)
let specification = specificationList.reduce((pre, cur) => {
re... | https://github.com/Vsolon0401/MallShopping | 02d37a4417febdd752f3ff7b58f1aa3bf9065dc5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | hasGarbledText | 检查文本是否包含乱码 | private hasGarbledText(text: string): boolean {
// 检查是否包含常见的乱码特征
const garbledPatterns = [
/\ufffd{2,}/, // 连续的替换字符
/[\x00-\x08\x0B\x0C\x0E-\x1F]{3,}/, // 连续的控制字符
];
for (const pattern of garbledPatterns) {
if (pattern.test(text)) {
return true;
}
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasGarbledText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private hasGarbledText(text: string): boolean {
// 检查是否包含常见的乱码特征
const garbledPatterns = [
/\ufffd{2,}/, // 连续的替换字符
/[\x00-\x08\x0B\x0C\x0E-\x1F]{3,}/, // 连续的控制字符
];
for (const pattern of garbledPatterns) {
if (pattern.test(text)) {
return true;
}
}
... | https://github.com/DaLongZhuaZi/manxia | 2815d00d51cb280284251b3468eab08c7b4c9bda | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | updateComputerFromPoll | 根据轮询结果更新电脑信息
如果电脑的 UUID 是临时的 discovered-*,用服务器返回的真实 UUID 重新映射 | private updateComputerFromPoll(computer: ComputerInfo, result: PollResult): void {
const info = result.serverInfo!;
// 处理 UUID 归一:discovered-* 临时条目获得真实 UUID
let target = computer;
if (info.uniqueId && computer.uuid !== info.uniqueId) {
target = this.reconcileUuid(computer, info.uniqueId);
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateComputerFromPoll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | private updateComputerFromPoll(computer: ComputerInfo, result: PollResult): void {
const info = result.serverInfo!;
// 处理 UUID 归一:discovered-* 临时条目获得真实 UUID
let target = computer;
if (info.uniqueId && computer.uuid !== info.uniqueId) {
target = this.reconcileUuid(computer, info.uniqueId);
}... | https://github.com/AlkaidLab/moonlight-harmony | c38776edb0981eb503e0013b6d9304fc798e41eb | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | addQueryValue | Encodes the key and value and then appends the result to the query string.
@param { string } [key] - The key it will be encoded with.
@param { string } [value] - The value it will be encoded with.
@returns { URI } Return URI object. | addQueryValue(key: string, value: string): URI {
let uriStr = this.uriEntry.addQueryValue(encodeURIComponent(key), encodeURIComponent(value));
return new URI(uriStr);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addQueryValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS... | addQueryValue(key: string, value: string): URI {
let uriStr = this.uriEntry.addQueryValue(encodeURIComponent(key), encodeURIComponent(value));
return new URI(uriStr);
} | https://gitcode.com/iop123123/arkts-static-skills | 479a67ea9044ffc9920656489e32b4ca7c0407e4 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | sendMessageWithWebContext | 带网页上下文发送消息 | async sendMessageWithWebContext(
content: string,
webContext: WebSearchResult,
providerId: string,
providerType: ProviderType,
apiStyle: ApiStyle,
apiKey: string,
baseUrl: string,
modelId: string,
modelName: string,
messages: ChatMessage[],
attachments: MessageAttachment[],... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendMessageWithWebContext AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left... | async sendMessageWithWebContext(
content: string,
webContext: WebSearchResult,
providerId: string,
providerType: ProviderType,
apiStyle: ApiStyle,
apiKey: string,
baseUrl: string,
modelId: string,
modelName: string,
messages: ChatMessage[],
attachments: MessageAttachment[],... | https://github.com/LongLiveY96/chatcube | 49df65f2dfa40d63b471dad12d0ea1d6c979d1c0 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/entryability/EntryAbility.ets | arkts | setupMorningNotification | 设置早餐通知(8:00) | private setupMorningNotification(): void {
// 获取当前时间
const now = new Date();
const currentHour = now.getHours();
const currentMinute = now.getMinutes();
this.setupMealNotification(
MORNING_NOTIFICATION_WORK_ID,
'morning',
'饮食提醒',
'别忘记吃饭哦~',
currentHour,
currentM... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupMorningNotification 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 ... | private setupMorningNotification(): void {
// 获取当前时间
const now = new Date();
const currentHour = now.getHours();
const currentMinute = now.getMinutes();
this.setupMealNotification(
MORNING_NOTIFICATION_WORK_ID,
'morning',
'饮食提醒',
'别忘记吃饭哦~',
currentHour,
currentM... | https://github.com/chendi126/harmonyOS-TCP | 6451fdd0cefdfb16d3872de1003e2801adfe35b0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets | arkts | keys | Returns elements from the Map as an keys Iterator
@returns iterator with map keys | override keys(): IterableIterator<K> {
return this.mappedIterator<K>((k: K, v: V): K => k)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys 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#:#Ri... | override keys(): IterableIterator<K> {
return this.mappedIterator<K>((k: K, v: V): K => k)
} | https://gitcode.com/iop123123/arkts-static-skills | 7d500bc8400ce5739d8f8ce28c117bc4350c9b3d | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/NeurologyAgent.ets | arkts | getSystemPrompt | 获取系统提示词
定义神经内科医生的专业角色和回答规范 | protected getSystemPrompt(): string {
return `你是一位专业的神经内科医生,擅长脑血管疾病和神经系统疾病的诊疗。
【专业领域】
1. 脑血管疾病
- 脑梗塞:急性期治疗、二级预防、康复指导
- 脑出血:病因诊断、治疗原则、预后评估
- 短暂性脑缺血发作(TIA):风险评估、预防措施
2. 神经系统疾病
- 帕金森病:药物治疗、康复训练、生活指导
- 癫痫:发作类型、用药指导、生活注意事项
- 多发性硬化:疾病管理、症状控制
3. 头痛眩晕
- 偏头痛:诱发因素、急性治疗、预防用药
- 紧张性头痛:病因分析、治疗建议
-... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getSystemPrompt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left s... | protected getSystemPrompt(): string {
return `你是一位专业的神经内科医生,擅长脑血管疾病和神经系统疾病的诊疗。
【专业领域】
1. 脑血管疾病
- 脑梗塞:急性期治疗、二级预防、康复指导
- 脑出血:病因诊断、治疗原则、预后评估
- 短暂性脑缺血发作(TIA):风险评估、预防措施
2. 神经系统疾病
- 帕金森病:药物治疗、康复训练、生活指导
- 癫痫:发作类型、用药指导、生活注意事项
- 多发性硬化:疾病管理、症状控制
3. 头痛眩晕
- 偏头痛:诱发因素、急性治疗、预防用药
- 紧张性头痛:病因分析、治疗建议
-... | https://github.com/LJ666-ui/harmony-health-care | d50f1040fb6adddc9a4f421187154b7fea9ad797 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets | arkts | getTheme | 获取主题设置
@returns Promise<string> 主题名称 | async getTheme(): Promise<string> {
try {
const value = await this.dao.get(AppConstants.PREF_KEY_THEME, 'light');
return value.toString();
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get theme: ${JSON.stringify(err)}`);
return 'light';
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTheme AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async getTheme(): Promise<string> {
try {
const value = await this.dao.get(AppConstants.PREF_KEY_THEME, 'light');
return value.toString();
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get theme: ${JSON.stringify(err)}`);
return 'light';
}
} | https://github.com/Kira-Yagami-Light/Kira-Projects | 208fb9464bf0c5042c8f4fe2c996e89acee1f110 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | userNotificationLevel | 更新用户通知级别 | static userNotificationLevel(username: string): string {
return `/u/${username}/notification_level.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left userNotificationLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST... | static userNotificationLevel(username: string): string {
return `/u/${username}/notification_level.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 3f0cec0a756add462e0213a83967b83bad46eef5 | github |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | saveCloudDocId | Cloud Doc Map Methods — 本地文件 URI → 云端文档 ID | static async saveCloudDocId(context: common.UIAbilityContext, fileUri: string, cloudDocId: string) {
if (!fileUri || !cloudDocId) return;
const prefs = await PreferencesUtil.getPreferences(context);
const raw = await prefs.get(PreferencesUtil.KEY_CLOUD_DOC_MAP, '{}') as string;
const map: Record<strin... | 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 saveCloudDocId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :... | static async saveCloudDocId(context: common.UIAbilityContext, fileUri: string, cloudDocId: string) {
if (!fileUri || !cloudDocId) return;
const prefs = await PreferencesUtil.getPreferences(context);
const raw = await prefs.get(PreferencesUtil.KEY_CLOUD_DOC_MAP, '{}') as string;
const map: Record<strin... | https://github.com/electronicminer/Harmony-Markdown-Editor | 842c316d75719218bcd1bfa69dfc3221651194c9 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | removeSpec | 删除商品规格
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@returns {Promise<void>} Promise<void> | async removeSpec(goodsId: number, specId: number): Promise<void> {
await this.cartRepository.removeSpecFromCart(goodsId, specId);
// 更新本地数据
for (let i = 0; i < this.cartList.length; i++) {
const cart = this.cartList[i];
if (cart.goodsId === goodsId) {
cart.spec = cart.spec.filter((s: C... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeSpec AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left goodsId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async removeSpec(goodsId: number, specId: number): Promise<void> {
await this.cartRepository.removeSpecFromCart(goodsId, specId);
// 更新本地数据
for (let i = 0; i < this.cartList.length; i++) {
const cart = this.cartList[i];
if (cart.goodsId === goodsId) {
cart.spec = cart.spec.filter((s: C... | https://github.com/Joker-x-dev/CoolMallArkTS | 496d3fd244df07c3de278058834ac2b671c74904 | github |
RoooyHe/toona-ohos | toona/src/main/ets/pages/JoinSpacePage.ets | arkts | CreateSpaceDialogBuilder | 创建空间弹窗 - Builder | @Builder
function CreateSpaceDialogBuilder(dialogParams: QuickDialogParams) {
CreateSpaceDialogContent({ dialogParams: dialogParams })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left CreateSpaceDialogBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri... | @Builder
function CreateSpaceDialogBuilder(dialogParams: QuickDialogParams) {
CreateSpaceDialogContent({ dialogParams: dialogParams })
} | https://github.com/RoooyHe/toona-ohos | db3800b7d0ea30bd22c57e3db759166a38c6a8d6 | github |
somnio-software/my-bot-pal | entry/src/main/ets/features/chat/repository/ChatRepository.ets | arkts | createRequestBody | Create request body from conversation history | private createRequestBody(conversation: ChatMessage[]): ChatRequestBody {
let fupQuestion: FupQuestion | null = null;
for (let i = conversation.length - 1; i >= 0; i--) {
const msg = conversation[i];
if (msg.apiMessageType === ApiMessageType.HUMAN && msg.suggestions && msg.suggestions.length > 0) ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createRequestBody AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left conversation AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub... | private createRequestBody(conversation: ChatMessage[]): ChatRequestBody {
let fupQuestion: FupQuestion | null = null;
for (let i = conversation.length - 1; i >= 0; i--) {
const msg = conversation[i];
if (msg.apiMessageType === ApiMessageType.HUMAN && msg.suggestions && msg.suggestions.length > 0) ... | https://github.com/somnio-software/my-bot-pal | 0e01b23aa26c62a5c85bdf3ea068c47ec472cb84 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets | arkts | getSourceMangaCacheStats | 获取图源的漫画缓存统计 | async getSourceMangaCacheStats(sourceId: number): Promise<MangaCacheStats[]> {
const startedAt: number = Date.now();
const cachedStats: MangaCacheStats[] | null = this.getCachedSourceMangaStats(sourceId);
if (cachedStats !== null) {
this.recordPermanentStatsFlow(
sourceId,
DownloadCa... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSourceMangaCacheStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left... | async getSourceMangaCacheStats(sourceId: number): Promise<MangaCacheStats[]> {
const startedAt: number = Date.now();
const cachedStats: MangaCacheStats[] | null = this.getCachedSourceMangaStats(sourceId);
if (cachedStats !== null) {
this.recordPermanentStatsFlow(
sourceId,
DownloadCa... | https://github.com/DaLongZhuaZi/manxia | 318f4f01f7939c7fa5c2282605808cc90a33641d | github |
LJ666-ui/harmony-health-care | 5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets | arkts | execute | 执行健康风险评估 | static async execute(query: string): Promise<RiskAssessmentResult> {
// 步骤1:获取用户健康数据
const healthData = await this.collectHealthData();
// 步骤2:计算各项风险因子
const riskFactors = this.calculateRiskFactors(healthData);
// 步骤3:计算慢性病风险
const chronicRisks = this.assessChronicDiseaseRisks(riskFa... | 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 execute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Ri... | static async execute(query: string): Promise<RiskAssessmentResult> {
// 步骤1:获取用户健康数据
const healthData = await this.collectHealthData();
// 步骤2:计算各项风险因子
const riskFactors = this.calculateRiskFactors(healthData);
// 步骤3:计算慢性病风险
const chronicRisks = this.assessChronicDiseaseRisks(riskFa... | https://github.com/LJ666-ui/harmony-health-care | 67240c41cd2722129346f7f3b5fd75c4cfab7d69 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | dotAll | Gets the dotAll flag, indicating whether '.' matches newline characters.
@return { boolean } `true` if dotAll is enabled, `false` otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get dotAll(): boolean {
return this.isDotAll
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left dotAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right A... | get dotAll(): boolean {
return this.isDotAll
} | https://gitcode.com/iop123123/arkts-static-skills | 502f94f1e7af9f689c667a01bf69f0e22ca6a602 | gitcode |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataManager.ets | arkts | getHealthRecordByDate | 根据日期获取健康记录 | async getHealthRecordByDate(date: string): Promise<HealthRecord | null> {
const records = await this.getAllHealthRecords();
return records.find(r => r.date === date) || null;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getHealthRecordByDate AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left date AST#identifier#Right AST#type_annotation#Left AST#:#... | async getHealthRecordByDate(date: string): Promise<HealthRecord | null> {
const records = await this.getAllHealthRecords();
return records.find(r => r.date === date) || null;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 141a5c273748cacb371ceac9af21e406765a333e | github |
the-wwyang/kids-learning-app | src/main/ets/services/AnswerValidator.ets | arkts | calculatePoints | 根据难度计算得分
@param difficulty 难度等级
@returns 分数 | static calculatePoints(difficulty: Difficulty): number {
const pointsMap: Record<Difficulty, number> = {
[Difficulty.EASY]: 10,
[Difficulty.MEDIUM]: 20,
[Difficulty.HARD]: 30
};
return pointsMap[difficulty];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculatePoints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static calculatePoints(difficulty: Difficulty): number {
const pointsMap: Record<Difficulty, number> = {
[Difficulty.EASY]: 10,
[Difficulty.MEDIUM]: 20,
[Difficulty.HARD]: 30
};
return pointsMap[difficulty];
} | https://github.com/the-wwyang/kids-learning-app | 29aea78bcb9f1f42a1a6c8c4aa81355142178692 | github |
codelably/HCompass | core/module/src/main/ets/ModuleRegistry.ets | arkts | isBootstrapped | 检查是否已启动
@returns 是否已启动 | isBootstrapped(): boolean {
return this.bootstrapped;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isBootstrapped AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stat... | isBootstrapped(): boolean {
return this.bootstrapped;
} | https://github.com/codelably/HCompass | 30df517c6644176bea102f15045f866166bf071b | github |
arkui-x/samples | CodeLab/ArkTSComponentCollection/entry/src/main/ets/pages/components/imageVideoAndMedia/videoSample/VideoSample.ets | arkts | build | fixme:修复了视频组件全屏后,视频控制栏消失的情况,推测为被Scroll组件包裹后会出现之前的情况,目前仍出现问题为:全屏后视频播放栏与系统导航栏重合无法正常点击 | build() {
Column() {
TitleBar({ title: $r('app.string.video_title') })
Column() {
IntroductionTitle({ introduction: $r('app.string.video_show') })
Video({ src: $r('app.media.video_test'),
currentProgressRate: this.videoCurrent,
previewUri: $r('app.media.flower'),
... | 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() {
Column() {
TitleBar({ title: $r('app.string.video_title') })
Column() {
IntroductionTitle({ introduction: $r('app.string.video_show') })
Video({ src: $r('app.media.video_test'),
currentProgressRate: this.videoCurrent,
previewUri: $r('app.media.flower'),
... | https://gitcode.com/arkui-x/samples | a605330114cc56782ec797557bc860843ec514f1 | gitcode |
fbinba3955/Flymby | main/src/main/ets/pages/home/media/EmbyEpisodeDetail/components/MediaInfoComponent.ets | arkts | build | 当前选中的媒体流索引 | build() {
Column() {
this.MediaInfo()
this.MediaFormat()
}
.width("100%")
.alignItems(HorizontalAlign.Start)
} | 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() {
Column() {
this.MediaInfo()
this.MediaFormat()
}
.width("100%")
.alignItems(HorizontalAlign.Start)
} | https://github.com/fbinba3955/Flymby | f5f3c79ec44894cae43ccfc157640c2bf7bc218b | github |
openharmony/codelabs | ETSUI/Foodbook/entry/src/main/ets/pages/edit.ets | arkts | saveSignature | 保存签名的方法 | saveSignature() {
AppStorage.setOrCreate('userSignature', this.signature) // 存储签名
console.log('签名已保存:', this.signature)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveSignature 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... | saveSignature() {
AppStorage.setOrCreate('userSignature', this.signature) // 存储签名
console.log('签名已保存:', this.signature)
} | https://gitcode.com/openharmony/codelabs | 2048f893f25d28802114c225d9d2fd35d8d1ff84 | gitcode |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getSiteInfo | Get site info | async getSiteInfo(): Promise<V2exSiteInfo> {
return this.http.get<V2exSiteInfo>(ApiConstants.API_SITE_INFO)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSiteInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getSiteInfo(): Promise<V2exSiteInfo> {
return this.http.get<V2exSiteInfo>(ApiConstants.API_SITE_INFO)
} | https://github.com/honjow/Next2V | 9a9f7c167840fc449754ee1f46626d2abdcdf88e | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test43_original_index.ets | arkts | merge | --- Merge sort (recursive divide-and-conquer) --- | function merge(left: number[], right: number[]): number[] {
let result: number[] = [];
let i: number = 0;
let j: number = 0;
while (i < left.length && j < right.length) {
if (left[i] <= right[j]) {
result.push(left[i]);
i = i + 1;
} else {
result.push(right[j]);
j = j + 1;
}
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left merge AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left left AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function merge(left: number[], right: number[]): number[] {
let result: number[] = [];
let i: number = 0;
let j: number = 0;
while (i < left.length && j < right.length) {
if (left[i] <= right[j]) {
result.push(left[i]);
i = i + 1;
} else {
result.push(right[j]);
j = j + 1;
}
... | https://github.com/miaochiahao/ark-ghidra | 1b4db34e15ac9c373b89636ba3b0daefea36bc10 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | regenerateTitle | 手动重新生成标题 | async regenerateTitle(): Promise<void> {
if (this.currentSession === null) {
return
}
if (this.currentSession.messages.length === 0) {
console.warn('ChatViewModel', 'Cannot generate title: no messages in session')
return
}
await this.generateSmartTitle(this.currentSession.id, thi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left regenerateTitle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left... | async regenerateTitle(): Promise<void> {
if (this.currentSession === null) {
return
}
if (this.currentSession.messages.length === 0) {
console.warn('ChatViewModel', 'Cannot generate title: no messages in session')
return
}
await this.generateSmartTitle(this.currentSession.id, thi... | https://github.com/LongLiveY96/chatcube | e888358aa663fb14dea6d46dc5c1179c1f326c2f | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertWeight | WEIGHT | static convertWeight(value: number, from: WeightUnit, to: WeightUnit): number {
const toKg: Record<WeightUnit, number> = {
[WeightUnit.MILLIGRAM]: 0.000001,
[WeightUnit.GRAM]: 0.001,
[WeightUnit.KILOGRAM]: 1,
[WeightUnit.TONNE]: 1000,
[WeightUnit.OUNCE]: 0.0283495,
[WeightUnit.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertWeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n... | static convertWeight(value: number, from: WeightUnit, to: WeightUnit): number {
const toKg: Record<WeightUnit, number> = {
[WeightUnit.MILLIGRAM]: 0.000001,
[WeightUnit.GRAM]: 0.001,
[WeightUnit.KILOGRAM]: 1,
[WeightUnit.TONNE]: 1000,
[WeightUnit.OUNCE]: 0.0283495,
[WeightUnit.... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | c77ffff438373923d54d7ec391864b5d985c163b | github |
LZZLHY/hlib | entry/src/main/ets/utils/I18n.ets | arkts | format | 取格式化字符串:自动用全局 context 解析模板,按顺序填充 args。
支持 %s / %d 占位符(与 string.json 中 fmt 后缀的资源一致)。
缺失 context 时回退到 fallback;若 fallback 仍空则返回 key。 | static format(key: string, args: Array<string | number>, fallback?: string): string {
const tmpl: string = I18n.ts(key, fallback);
return I18n.applyArgs(tmpl, args);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left format AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | static format(key: string, args: Array<string | number>, fallback?: string): string {
const tmpl: string = I18n.ts(key, fallback);
return I18n.applyArgs(tmpl, args);
} | https://github.com/LZZLHY/hlib | d109713ce712b9349cc8c41f0a77e63b9c4cfa45 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | setAppFontSize | 设置APP界面字体大小倍率 | async setAppFontSize(size: number): Promise<void> {
this.settings.appFontSize = Math.max(0.8, Math.min(1.5, size));
await this.saveSettings();
this.notifyFontChange(FontScene.APP_UI);
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setAppFontSize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_param... | async setAppFontSize(size: number): Promise<void> {
this.settings.appFontSize = Math.max(0.8, Math.min(1.5, size));
await this.saveSettings();
this.notifyFontChange(FontScene.APP_UI);
} | https://github.com/DaLongZhuaZi/manxia | e0f18625886d69238efc7b50ebcdd5787ee6dc6c | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | isCellularDataEnabled | 检查蜂窝数据业务是否启用,使用Promise方式作为异步方法。
@returns | static async isCellularDataEnabled(): Promise<boolean> {
return data.isCellularDataEnabled();
} | 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 isCellularDataEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | static async isCellularDataEnabled(): Promise<boolean> {
return data.isCellularDataEnabled();
} | https://github.com/tdcare/tdwebrtc | 7a1912700b8231039705ab824e4c464edc888df0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets | arkts | parseUrlOption | 解析URL选项JSON(宽松模式)
参考Legado原版GSON宽松解析,支持以下非标准格式:
1. 无引号键名: {method: "post"}
2. 单引号: {'method': 'post'}
3. 尾部逗号: {method: "post",}
4. 注释: {method: "post" ...comment... } | private parseUrlOption(optionStr: string): LegadoUrlOption | null {
if (!optionStr || !optionStr.trim()) {
return null;
}
let jsonStr = optionStr.trim();
const strictOption = this.tryParseUrlOptionJson(jsonStr);
if (strictOption !== null) {
return strictOption;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseUrlOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left optionStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | private parseUrlOption(optionStr: string): LegadoUrlOption | null {
if (!optionStr || !optionStr.trim()) {
return null;
}
let jsonStr = optionStr.trim();
const strictOption = this.tryParseUrlOptionJson(jsonStr);
if (strictOption !== null) {
return strictOption;
}
... | https://github.com/DaLongZhuaZi/manxia | ab4928b21d58526a0fcc3869f3f390b3b8b650f7 | github |
openharmony/applications_calendar_data | dataprovider/src/main/ets/DataShareAbilityAuthenticateProxy.ets | arkts | dataOperateSelectorByLowAuthority | Perform database operations corresponding to low-level permissions
@Param uri indicates user's input uri
@Param dataParameter indicates database operation information to be performed | async function dataOperateSelectorByLowAuthority(uri: string, dataParameter: DataParameter) {
let operationName = dataParameter.operationName;
let columns = dataParameter.columns;
let predicates = dataParameter.predicates;
let value = dataParameter.value;
let callback = dataParameter.callback;
switch (opera... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left dataOperateSelectorByLowAuthority AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uri AST#identif... | async function dataOperateSelectorByLowAuthority(uri: string, dataParameter: DataParameter) {
let operationName = dataParameter.operationName;
let columns = dataParameter.columns;
let predicates = dataParameter.predicates;
let value = dataParameter.value;
let callback = dataParameter.callback;
switch (opera... | https://gitee.com/openharmony/applications_calendar_data.git | fb6489e43d431d506de1d4a75d2ff470a848ccb7 | gitee |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineSurfaceManagerBridge.ets | arkts | addSurfaceListener | MARK: - Native Listener Management
Registers a native surface listener. | addSurfaceListener(listener: ISurfaceListener): void {
this._registeredListeners.push(listener);
registerA2UISurfaceListener(this.instanceId, listener);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addSurfaceListener 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 ISurfaceListener AST#identifier#R... | addSurfaceListener(listener: ISurfaceListener): void {
this._registeredListeners.push(listener);
registerA2UISurfaceListener(this.instanceId, listener);
} | https://github.com/AGenUI/AGenUI | 8446c131c55055dfd2d1bff2412e860395bdaa46 | github |
pangpang20/antennaPodHM | entry/src/main/ets/pages/PodcastDetailPage.ets | arkts | aboutToAppear | 存储所有单集 | aboutToAppear() {
const params = UIUtils.getParams<Record<string, Object>>();
if (params && params['podcastId']) {
this.podcastId = params['podcastId'] as string;
this.loadPodcastDetail();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
const params = UIUtils.getParams<Record<string, Object>>();
if (params && params['podcastId']) {
this.podcastId = params['podcastId'] as string;
this.loadPodcastDetail();
}
} | https://github.com/pangpang20/antennaPodHM | b76e40ce27b680e5b9676d9b0379fe66fa764fed | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ResultSetUtils.ets | arkts | toRow | 将 ResultSet 当前行转换为 ResultSetRow
@param resultSet 查询结果集
@param metadata 实体元数据
@returns ResultSetRow 对象 | static toRow(resultSet: relationalStore.ResultSet, metadata: EntityMetadata): ResultSetRow {
const row = new ResultSetRow()
const columnNames = resultSet.columnNames
let loggedError = false
for (let i = 0; i < columnNames.length; i++) {
const columnName = columnNames[i]
try {
cons... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left toRow AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AS... | static toRow(resultSet: relationalStore.ResultSet, metadata: EntityMetadata): ResultSetRow {
const row = new ResultSetRow()
const columnNames = resultSet.columnNames
let loggedError = false
for (let i = 0; i < columnNames.length; i++) {
const columnName = columnNames[i]
try {
cons... | https://github.com/offlinecat-dev/OCNetORM | 2d8d12a3343dbc25fd60ff645a98bf3d4ac93bf2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Float32Array 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 % Float32Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength should ... | 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 % Float32Array.BYTES_PER_ELEMENT.toInt() != 0) {
throw new RangeError("ArrayBuffer.byteLength should ... | https://gitcode.com/iop123123/arkts-static-skills | 631bcb30e4209162da3f2cec4b1d9559a06353e1 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | playEpisode | 播放Episode | async playEpisode(episode: Episode): Promise<void> {
try {
console.info('[PlayerService] playEpisode start, episode:', episode.title);
console.info('[PlayerService] audioUrl:', episode.audioUrl);
console.info('[PlayerService] localPath:', episode.localPath);
// 设置加载状态
this.state = P... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left playEpisode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left episode AST#identifier#Right AST#type_annotation#Left AST#... | async playEpisode(episode: Episode): Promise<void> {
try {
console.info('[PlayerService] playEpisode start, episode:', episode.title);
console.info('[PlayerService] audioUrl:', episode.audioUrl);
console.info('[PlayerService] localPath:', episode.localPath);
// 设置加载状态
this.state = P... | https://github.com/pangpang20/antennaPodHM | 9b5150a198b672a4184d1f8322aafc8fc1c8832f | github |
openharmony/applications_call | entry/src/main/ets/model/CallServiceProxy.ets | arkts | setMuted | set call mute | public setMuted() {
call.setMuted().then((res) => {
LogUtils.i(TAG, prefixLog + 'then:setMute');
}).catch((err) => {
LogUtils.i(TAG, prefixLog + 'catch:setMute : %s' + JSON.stringify(err));
});
}; | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMuted 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#... | public setMuted() {
call.setMuted().then((res) => {
LogUtils.i(TAG, prefixLog + 'then:setMute');
}).catch((err) => {
LogUtils.i(TAG, prefixLog + 'catch:setMute : %s' + JSON.stringify(err));
});
}; | https://gitee.com/openharmony/applications_call.git | 37bae58904a1eec7db38e33df024346c66ac8aaa | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | from | Creates a new `Array` instance from characters of `String`.
@param str source string to be converted to array of character's `String`
@returns `Array` intance constructed from characters of source `String`. | public static from(str: String): Array<String> {
let strs = Array.charStrings(str);
return Array.from<String>(strs);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left A... | public static from(str: String): Array<String> {
let strs = Array.charStrings(str);
return Array.from<String>(strs);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 93466da1f5e30abba97cfa47c8485adcc22e7c31 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | subarray | Creates a Int8Array with the same underlying ArrayBuffer
@param begin start index, inclusive
@param end last index, exclusive
@returns new Int8Array with the same underlying ArrayBuffer | public subarray(begin: number, end: number): Int8Array {
return this.subarray(begin as int, end as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public subarray(begin: number, end: number): Int8Array {
return this.subarray(begin as int, end as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a560cdfa98add423c2d8d5054e87d88d17c5e64f | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BattleEngine.ets | arkts | buildSessionResult | Produce a frozen {@link SessionResult} describing the finished
battle. Only valid once status is Won or Lost — calling it earlier
throws because ResultPage would otherwise show stats that can still
change. Star rating comes straight from spec §4.4:
3 stars — Won with correctRate ≥ 0.8.
2 stars — Won with correctRate < ... | buildSessionResult(): SessionResult {
if (this.state_.status !== BattleStatus.Won && this.state_.status !== BattleStatus.Lost) {
throw new Error(`BattleEngine.buildSessionResult: battle not finished (status=${this.state_.status})`);
}
const r: SessionResult = new SessionResult();
r.status = this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildSessionResult 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 SessionResult AST#identifier#Right AST#ERRO... | buildSessionResult(): SessionResult {
if (this.state_.status !== BattleStatus.Won && this.state_.status !== BattleStatus.Lost) {
throw new Error(`BattleEngine.buildSessionResult: battle not finished (status=${this.state_.status})`);
}
const r: SessionResult = new SessionResult();
r.status = this... | https://github.com/terryma2024/happyword | ae9d1c8204adc1b2e862dfbbb2e063fc9b295bac | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/DemoDataService.ets | arkts | seedSharedLedger | ---------------- 共享账本填充 ---------------- | private static async seedSharedLedger(userId: number) {
console.info('[SharedLedger] 开始填充共享账本数据...');
const daoModule = await import('../dao/SharedLedgerDAO');
const SharedLedgerDAO = daoModule.SharedLedgerDAO;
const LedgerMemberDAO = daoModule.LedgerMemberDAO;
const SharedBillDAO = daoModule.Shar... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left seedSharedLedger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | private static async seedSharedLedger(userId: number) {
console.info('[SharedLedger] 开始填充共享账本数据...');
const daoModule = await import('../dao/SharedLedgerDAO');
const SharedLedgerDAO = daoModule.SharedLedgerDAO;
const LedgerMemberDAO = daoModule.LedgerMemberDAO;
const SharedBillDAO = daoModule.Shar... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7fade74c18c83f2a8ffaed5c46200b2ac69bcca7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets | arkts | deleteSourceFiles | 删除图源相关文件(JSON配置和图标)
@param pkg 图源包名 | deleteSourceFiles(pkg: string): void {
if (!pkg || !this.repositoryDir) {
logger.warn(TAG, `无法删除图源文件: pkg=${pkg}, repositoryDir=${this.repositoryDir}`);
return;
}
// 删除 JSON 配置文件
const jsonPath = `${this.repositoryDir}/${pkg}.json`;
try {
if (SafeFileUtils.accessSync(jsonPath)) ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteSourceFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pkg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | deleteSourceFiles(pkg: string): void {
if (!pkg || !this.repositoryDir) {
logger.warn(TAG, `无法删除图源文件: pkg=${pkg}, repositoryDir=${this.repositoryDir}`);
return;
}
// 删除 JSON 配置文件
const jsonPath = `${this.repositoryDir}/${pkg}.json`;
try {
if (SafeFileUtils.accessSync(jsonPath)) ... | https://github.com/DaLongZhuaZi/manxia | 84cf494599b56fe1a2539334bf9b0b0ca5012915 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets | arkts | sub | Performs shortegral subtraction of this instance with provided one, returns the result as new instance
@param { Short } other Right hand side of the subtraction
@returns { Short } Result of the subtraction
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public sub(other: Short): Short {
return new Short((this.value - other.toShort()).toShort())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sub AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public sub(other: Short): Short {
return new Short((this.value - other.toShort()).toShort())
} | https://gitcode.com/iop123123/arkts-static-skills | 76799d65fb576fcb5fe39729c1e308ed0f88ba10 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/webdav/WebDAVStorage.ets | arkts | read | 读取文件内容
@param path 文件路径
@returns 结果 | public read(path: string): Promise<ArrayBuffer> {
if (!this.client) {
hilog.error(DOMAIN, TAG, 'WebDAV not init:%{public}s', JSON.stringify(this.config));
return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.webdav_not_init'))));
}
... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left read AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#... | public read(path: string): Promise<ArrayBuffer> {
if (!this.client) {
hilog.error(DOMAIN, TAG, 'WebDAV not init:%{public}s', JSON.stringify(this.config));
return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, ResourceManager.getString($r('app.string.webdav_not_init'))));
}
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/webdav/WebDAVStorage.ets#L85-L101 | a89ae7a7ee16791bf41b4cf59ba660cd7708a76c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | concatArray | Creates a new `Object[]` from `Array` instance and given `Array` instance.
@param other to concatenate into a new array.
@returns Primitive array of `Object`s, constructed from `this` and given `other` instances of `Array` class. | private concatArray(other: Array<T>): T[] {
assert other != null : "Can't concat with null Array";
let res = new T[this.data.length + other.data.length];
let idx = 0;
for (let i = 0; i < this.data.length; i++) {
res[idx] = this.data[i];
idx++;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left concatArray 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#instantiation_ex... | private concatArray(other: Array<T>): T[] {
assert other != null : "Can't concat with null Array";
let res = new T[this.data.length + other.data.length];
let idx = 0;
for (let i = 0; i < this.data.length; i++) {
res[idx] = this.data[i];
idx++;
}
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 10f19626b56066b02f841ddbdd65d891c66836a8 | gitee |
erosTeam/NextE | feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets | arkts | dedupeNew | Drop rows already in the list (and dupes within the incoming page) before append. EH can repeat
the boundary gallery across page boundaries, and the LazyForEach key is gid — duplicate keys
would churn/throw. eros_fe tolerates dupes via index keys; a gid-keyed list must filter them. | private dedupeNew(rows: EhGallery[]): EhGallery[] {
const seen: Set<string> = new Set<string>()
this.dataSource.getAll().forEach((g: EhGallery) => seen.add(g.gid))
const out: EhGallery[] = []
rows.forEach((g: EhGallery) => {
if (g.gid.length > 0 && !seen.has(g.gid)) {
seen.add(g.gid)
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dedupeNew AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rows AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressio... | private dedupeNew(rows: EhGallery[]): EhGallery[] {
const seen: Set<string> = new Set<string>()
this.dataSource.getAll().forEach((g: EhGallery) => seen.add(g.gid))
const out: EhGallery[] = []
rows.forEach((g: EhGallery) => {
if (g.gid.length > 0 && !seen.has(g.gid)) {
seen.add(g.gid)
... | https://github.com/erosTeam/NextE | 79e27adde42048d0a35662e3cf0dfac256857d88 | github |
Gramony/Gramony | features/home/src/main/ets/pages/Me.ets | arkts | build | version ID | build(): void {
Column() {
ProfilePage({
user: this.meInfo,
chatId: this.meInfo ? this.meInfo.chatId.toString() : '',
title: $r('app.string.me'),
device: deviceInfo.versionId ?? "HarmonyOS NEXT",
})
}.onAppear(async () => {
this.meInfo = await getMe();
})
... | 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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Column() {
ProfilePage({
user: this.meInfo,
chatId: this.meInfo ? this.meInfo.chatId.toString() : '',
title: $r('app.string.me'),
device: deviceInfo.versionId ?? "HarmonyOS NEXT",
})
}.onAppear(async () => {
this.meInfo = await getMe();
})
... | https://github.com/Gramony/Gramony | 528000cf4bbbc8f088d2b0aa0f3a6aca3fd959ed | github |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVRecorder/entry/src/main/ets/utils/FileUtil.ets | arkts | writeStrToFile | Save the text content to a file. | static writeStrToFile(path: string, text: string): number {
try {
let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
let value = fileIo.writeSync(file.fd, text);
fileIo.closeSync(file);
return value;
} catch (err) {
Logger.error('FileUtil', 'wr... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left writeStrToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | static writeStrToFile(path: string, text: string): number {
try {
let file = fileIo.openSync(path, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE);
let value = fileIo.writeSync(file.fd, text);
fileIo.closeSync(file);
return value;
} catch (err) {
Logger.error('FileUtil', 'wr... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 2e15880290645bb36e2d2cc6ec2aa156a4ecd606 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an Uint32Array from FixedArray<int>
@param { FixedArray<int> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafeClamp(i, numbers[i].toLong())
}
} | 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 numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafeClamp(i, numbers[i].toLong())
}
} | https://gitcode.com/iop123123/arkts-static-skills | e9fd1433c9ddc45d549d2cc257c81494b9792e6e | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmStateManager.ets | arkts | getPreferences | Get AlarmStateManager Preferences instance.
@return Preferences instance | private async getPreferences(): Promise<Preferences> {
if (this.preferences) {
return this.preferences;
}
this.preferences = await preferencesUtil.getPreferences(GlobalContext.getContext()
.getObject('clockContext') as Context, APP_CONFIG);
return this.preferences as Preferences;
} | 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 getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async getPreferences(): Promise<Preferences> {
if (this.preferences) {
return this.preferences;
}
this.preferences = await preferencesUtil.getPreferences(GlobalContext.getContext()
.getObject('clockContext') as Context, APP_CONFIG);
return this.preferences as Preferences;
} | https://gitee.com/openharmony-sig/applications_clock.git | 1167a60509343cc48080c82bd6ffa92d98a593b0 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | getWorker | get worker
@return object worker.ThreadWorker | public getWorker(): worker.ThreadWorker {
return this.worker;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWorker 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#member_expression#Left AST#i... | public getWorker(): worker.ThreadWorker {
return this.worker;
} | https://gitee.com/openharmony-sig/applications_calculator.git | 17c05e1e158d5fc3606201040589fa1d481000f7 | gitee |
Countly/countly-sdk-hos | library/src/ohosTest/ets/test/Leak.test.ets | arkts | settle | Best-effort GC nudge — there's no `gc()` in ArkTS, but yielding the event
loop a few times lets V8 finish any short-lived collections that were
already queued. Calling this on either side of a sample tightens the
delta against incidental garbage from the test harness itself. | async function settle(): Promise<void> {
for (let i: number = 0; i < 3; i++) {
await flushTick(20);
}
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left settle 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 :... | async function settle(): Promise<void> {
for (let i: number = 0; i < 3; i++) {
await flushTick(20);
}
} | https://github.com/Countly/countly-sdk-hos | 5858d9e2238cca7026abfd7f9ac145d9a0030b24 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | get | 获取缓存项 | get(key: string): ArrayBuffer | null {
const item = this.cacheItems.get(key);
if (!item) {
return null;
}
// 检查是否过期
if (Date.now() > item.expireTime) {
this.remove(key);
return null;
}
// 更新访问信息
item.accessCount++;
item.lastAccessTime = Date.now();
return i... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#... | get(key: string): ArrayBuffer | null {
const item = this.cacheItems.get(key);
if (!item) {
return null;
}
// 检查是否过期
if (Date.now() > item.expireTime) {
this.remove(key);
return null;
}
// 更新访问信息
item.accessCount++;
item.lastAccessTime = Date.now();
return i... | https://github.com/DaLongZhuaZi/manxia | 50aee2da07c71dfc7e1c0b73fb1937e0c0dab625 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | notifyAllListeners | 通知所有场景的监听器 | private notifyAllListeners(): void {
const scenes: FontScene[] = [FontScene.APP_UI, FontScene.NOVEL, FontScene.EBOOK];
for (const scene of scenes) {
this.notifyFontChange(scene);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyAllListeners 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 A... | private notifyAllListeners(): void {
const scenes: FontScene[] = [FontScene.APP_UI, FontScene.NOVEL, FontScene.EBOOK];
for (const scene of scenes) {
this.notifyFontChange(scene);
}
} | https://github.com/DaLongZhuaZi/manxia | 1a168f343224de4cd8330ef978a397246983fec6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringWithSplitRulesAsync | 使用分割规则获取字符串(异步版本) | private async getStringWithSplitRulesAsync(rules: string[], splitType: string): Promise<string> {
const results: string[] = [];
for (const rule of rules) {
const result = await this.getStringSingleAsync(rule);
if (result) {
results.push(result);
// || 操作:第一个有结果就返回
if (... | 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 getStringWithSplitRulesAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rules AST#identifier#Rig... | private async getStringWithSplitRulesAsync(rules: string[], splitType: string): Promise<string> {
const results: string[] = [];
for (const rule of rules) {
const result = await this.getStringSingleAsync(rule);
if (result) {
results.push(result);
// || 操作:第一个有结果就返回
if (... | https://github.com/DaLongZhuaZi/manxia | e8e9b6a7989dbb3ed9e266ad57ace8092d83766a | github |
the-wwyang/kids-learning-app | src/main/ets/common/MathPageStrings.ets | arkts | getMilestoneReward | 里程碑奖励消息
@param count 完成题目数量
@returns 奖励消息 | static getMilestoneReward(count: number): string {
return `太棒了!完成${count}题奖励1颗星星${MathPageStrings.ICON_STAR}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMilestoneReward 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#L... | static getMilestoneReward(count: number): string {
return `太棒了!完成${count}题奖励1颗星星${MathPageStrings.ICON_STAR}`;
} | https://github.com/the-wwyang/kids-learning-app | 32cb1f293b89423c3f96191cb66a6ea858795d13 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | initializeUsbDriver | 初始化 USB 驱动 | private async initializeUsbDriver(): Promise<void> {
try {
console.info('[GAMEPAD] 初始化 USB 驱动服务...');
this.usbDriverService.setListener(this);
await this.usbDriverService.start();
console.info('[GAMEPAD] USB 驱动服务已启动');
} catch (err) {
console.error('[GAMEPAD] USB 驱动服务启动失败:', err)... | 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 initializeUsbDriver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async initializeUsbDriver(): Promise<void> {
try {
console.info('[GAMEPAD] 初始化 USB 驱动服务...');
this.usbDriverService.setListener(this);
await this.usbDriverService.start();
console.info('[GAMEPAD] USB 驱动服务已启动');
} catch (err) {
console.error('[GAMEPAD] USB 驱动服务启动失败:', err)... | https://github.com/AlkaidLab/moonlight-harmony | d49b439a70bd54fc4d1b6dc3a9df175ba7c947b0 | github |
openharmony/applications_mms | entry/src/main/ets/service/SettingService.ets | arkts | getSettingFlagForConvListPage | Values of the notification information integration switch and whether to display contact avatars | getSettingFlagForConvListPage() {
let result: LooseObject = {
'isShowContactHeadIcon': false,
'hasAggregate': false,
'recallMessagesFlag': false,
};
mSettingModel.getSettingValue(settingValue => {
if (settingValue.code === common.int.SUCCESS) {... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSettingFlagForConvListPage 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#stat... | getSettingFlagForConvListPage() {
let result: LooseObject = {
'isShowContactHeadIcon': false,
'hasAggregate': false,
'recallMessagesFlag': false,
};
mSettingModel.getSettingValue(settingValue => {
if (settingValue.code === common.int.SUCCESS) {... | https://gitee.com/openharmony/applications_mms.git | 02a692deeb1703061fb72115357658a9ef6b8f55 | gitee |
Joker-x-dev/HarmonyKit | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | ensureMigrated | 确保 Demo 表完成迁移
@returns {void} 无返回 | private ensureMigrated(): void {
if (!DemoLocalDataSourceImpl.migrated) {
this.orm.migrate(DemoEntity);
DemoLocalDataSourceImpl.migrated = true;
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureMigrated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr... | private ensureMigrated(): void {
if (!DemoLocalDataSourceImpl.migrated) {
this.orm.migrate(DemoEntity);
DemoLocalDataSourceImpl.migrated = true;
}
} | https://github.com/Joker-x-dev/HarmonyKit | 0ef41553fe29b50d83f45334b5ca90796ddb1d4b | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.