nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/ohos_byte_global_viewpool | byte_global_viewpool/src/main/ets/schedule/ScheduleService.ets | arkts | postSplitTasks | @description 任务组打散执行,目前打散时间为8ms
@param {ArrayList<()=>void>} taskList 任务组
@param {string} name 任务组名称 | public static postSplitTasks(taskList: ArrayList<()=>void>, name: string) {
let count = taskList.length
if (count === 0) return
for (let i = 0; i < count; i++) {
ScheduleService.mSplitTasksRunner.addTask(taskList[i], name)
}
} | 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 postSplitTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskList AST#identifier#Right AST#:#Left... | public static postSplitTasks(taskList: ArrayList<()=>void>, name: string) {
let count = taskList.length
if (count === 0) return
for (let i = 0; i < count; i++) {
ScheduleService.mSplitTasksRunner.addTask(taskList[i], name)
}
} | https://gitee.com/openharmony-sig/ohos_byte_global_viewpool.git | e166f6725927f8eb5cb560d41779b9a27446e219 | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModulePush.ets | arkts | recordPushNotificationToken | Manually resend the last-known token to the server. Useful after a device
ID change (with merge) where the server needs to re-associate the token. | public async recordPushNotificationToken(): Promise<void> {
if (Utils.isNullOrEmpty(this.lastToken)) {
this.config.logger.w('[ModulePush] recordPushNotificationToken, no token yet, call onTokenRefresh first');
return;
}
if (!this.core.consentModule.hasConsent(CountlyFeature.PUSH) && !this.send... | 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 recordPushNotificationToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio... | public async recordPushNotificationToken(): Promise<void> {
if (Utils.isNullOrEmpty(this.lastToken)) {
this.config.logger.w('[ModulePush] recordPushNotificationToken, no token yet, call onTokenRefresh first');
return;
}
if (!this.core.consentModule.hasConsent(CountlyFeature.PUSH) && !this.send... | https://github.com/Countly/countly-sdk-hos | 3224bee731516c7d1681407b1fa1f5870e35bc74 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/pages/Index.ets | arkts | checkShowScratchingBoard | Check if there is scratching board panel in sidebar,
If so then call sidebar to switch to that page. | checkShowScratchingBoard() {
let hasBoard = false;
const buttons = sidebarButtons();
for (const button of buttons) {
if (button[1] == UnifiedButtonsType.SCRATCHING_BOARD) {
hasBoard = true;
break;
}
}
if (hasBoard) {
animateToImmediately(defaultAnimation(), () => ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkShowScratchingBoard 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... | checkShowScratchingBoard() {
let hasBoard = false;
const buttons = sidebarButtons();
for (const button of buttons) {
if (button[1] == UnifiedButtonsType.SCRATCHING_BOARD) {
hasBoard = true;
break;
}
}
if (hasBoard) {
animateToImmediately(defaultAnimation(), () => ... | https://github.com/awaLiny2333/LinysBrowser_NEXT | b07fcb79c9851f9a3dd2a21236fcbbf21c8d7bc5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | keys | Returns an list of keys in Float64Array
@returns { IterableIterator<int> } - iterator over keys
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public keys(): IterableIterator<int> {
return new Float64ArrayIteratorKeys(this)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public 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#:#Righ... | public keys(): IterableIterator<int> {
return new Float64ArrayIteratorKeys(this)
} | https://gitcode.com/iop123123/arkts-static-skills | 76bad0f20e5f79b59f2d6ed6644d3a4da652385c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets | arkts | getName | Get the name of the worker
@returns { string } The name of the worker | public getName(): string {
return this.worker.getName();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getName 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#... | public getName(): string {
return this.worker.getName();
} | https://gitcode.com/iop123123/arkts-static-skills | dec83491b67ce037b068f75760bdfb6f43857803 | gitcode |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/DatabaseHelper.ets | arkts | getDBManager | 获取数据库管理器实例 | public static getDBManager(): DBManager {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.dbManager) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return DatabaseHelper.dbManager;
} | 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 getDBManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public static getDBManager(): DBManager {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.dbManager) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return DatabaseHelper.dbManager;
} | https://github.com/fuhhhhhhhh/openharmony | 9d59c7b7d3d95214af46e2ab0053edd41fd91506 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | loadMediaList | 查询媒体列表
@param id
@param types
@param recursive
@returns | public async loadMediaList(id: string, types: Array<BaseItemKind>, recursive: boolean): Promise<Array<BaseItemDto>> {
return this.requireApi().loadMediaList(id, types, recursive)
} | 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 loadMediaList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:... | public async loadMediaList(id: string, types: Array<BaseItemKind>, recursive: boolean): Promise<Array<BaseItemDto>> {
return this.requireApi().loadMediaList(id, types, recursive)
} | https://github.com/OHPG/FinMusic | 4ce9d9fc398d7d6ff5fd86963c9e7dd38d132d32 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | getFontDisplayName | 获取字体显示名称 | getFontDisplayName(scene: FontScene): string {
let fontType: FontType;
let systemFontId: string;
let customFontId: string;
switch (scene) {
case FontScene.APP_UI:
fontType = this.settings.appFontType;
systemFontId = this.settings.appSystemFontId;
customFontId = this.sett... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFontDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FontScene AST#identifier#Right AST#)... | getFontDisplayName(scene: FontScene): string {
let fontType: FontType;
let systemFontId: string;
let customFontId: string;
switch (scene) {
case FontScene.APP_UI:
fontType = this.settings.appFontType;
systemFontId = this.settings.appSystemFontId;
customFontId = this.sett... | https://github.com/DaLongZhuaZi/manxia | 5d257ca327d20969d5768fff5ad6091aee65fb73 | github |
YDYm233/EasyRandom_HarmonyNextApp | product/wearable/src/main/ets/utils/WearScreenUtil.ets | arkts | buttonFontSize | 按钮字号 (fp) | static get buttonFontSize(): number {
const screenSize = WearScreenUtil.screenSize;
if (screenSize === 'small') return 14;
if (screenSize === 'large') return 18; // 暂无此设备,预留
return 16; // standard
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left buttonFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static get buttonFontSize(): number {
const screenSize = WearScreenUtil.screenSize;
if (screenSize === 'small') return 14;
if (screenSize === 'large') return 18; // 暂无此设备,预留
return 16; // standard
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 35b62f26645a96070a173d2bdabfd6f2a77ac4d0 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | calculateBudgetUsage | 计算预算使用情况
@param bills 账单列表
@param budgets 预算列表
@param userId 用户ID
@param month 指定月份 | static calculateBudgetUsage(
bills: Bill[],
budgets: Budget[],
userId: number,
month: string
): BudgetUsageResult[] {
const categoryExpenses = HealthScoreUtils.calculateCategoryExpenses(bills, userId, month);
const results: BudgetUsageResult[] = [];
for (let i = 0; i < budgets.length; i... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateBudgetUsage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | static calculateBudgetUsage(
bills: Bill[],
budgets: Budget[],
userId: number,
month: string
): BudgetUsageResult[] {
const categoryExpenses = HealthScoreUtils.calculateCategoryExpenses(bills, userId, month);
const results: BudgetUsageResult[] = [];
for (let i = 0; i < budgets.length; i... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b1704eef449eae38d21f9cd8a246d5f7661cae19 | github |
xiebyapps/ClipLink | entry/src/main/ets/services/HttpClient.ets | arkts | getAuthHeader | Create authorization header | private getAuthHeader(): string {
if (this.username && this.password) {
const credentials = `${this.username}:${this.password}`;
const encoded = this.base64Encode(credentials);
return `Basic ${encoded}`;
}
return '';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getAuthHeader 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 AS... | private getAuthHeader(): string {
if (this.username && this.password) {
const credentials = `${this.username}:${this.password}`;
const encoded = this.base64Encode(credentials);
return `Basic ${encoded}`;
}
return '';
} | https://github.com/xiebyapps/ClipLink | 5538b7655004df59069b1ed30661916520ee6a8b | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/components/ItemDetailView.ets | arkts | stripHtml | Minimal HTML-to-plain-text. Zotero notes are typically short and use
only basic tags (<p>, <strong>, <em>, lists, line breaks). For richer
rendering, a Web component would be a better fit; for MVP, this gives
readable previews and matches Zoo for Zotero's read-only treatment. | function stripHtml(html: string): string {
let stripped: string = '';
let inTag: boolean = false;
for (let i = 0; i < html.length; i++) {
const c: string = html.charAt(i);
if (c === '<') {
inTag = true;
continue;
}
if (c === '>') {
inTag = false;
// Insert a space at tag bo... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left stripHtml AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function stripHtml(html: string): string {
let stripped: string = '';
let inTag: boolean = false;
for (let i = 0; i < html.length; i++) {
const c: string = html.charAt(i);
if (c === '<') {
inTag = true;
continue;
}
if (c === '>') {
inTag = false;
// Insert a space at tag bo... | https://github.com/Vincent-Leon/zotero-harmony | 33a15f2e436c12f476dd2f8913b9daa79e64fc6b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | of | Returns a new array from a set of elements.
@returns { Float32Array } - a new Float32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static of(): Float32Array {
return new Float32Array(0)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | public static of(): Float32Array {
return new Float32Array(0)
} | https://gitcode.com/iop123123/arkts-static-skills | 7fb28ba3ab015ce8a683ac2c56c26859e20b76ab | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnWeekCalendarViewModel.ets | arkts | setSelectedDate | 设置选中的日期
@param year 年
@param month 月
@param day 几号
@param dayOfWeek 星期几 | setSelectedDate(year: number, month: number, day: number, dayOfWeek: number): void {
this.currentYear = year;
this.currentMonth = month;
this.selectedDay = day;
this.selectedDayOfWeek = dayOfWeek;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSelectedDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left ,... | setSelectedDate(year: number, month: number, day: number, dayOfWeek: number): void {
this.currentYear = year;
this.currentMonth = month;
this.selectedDay = day;
this.selectedDayOfWeek = dayOfWeek;
} | https://github.com/codelably/tuniao-ui | ef763bedcbfa9d07c397deab4dbc6304799e9a32 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SourceContentCache.ets | arkts | clearSource | 清除指定图源的所有缓存 | clearSource(sourceId: number): void {
const keysToDelete: string[] = [];
this.cacheMap.forEach((value, key) => {
if (value.sourceId === sourceId) {
keysToDelete.push(key);
}
});
keysToDelete.forEach(key => this.cacheMap.delete(key));
logger.info(TAG, `已清除图源 ${sourceId} 的所... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#R... | clearSource(sourceId: number): void {
const keysToDelete: string[] = [];
this.cacheMap.forEach((value, key) => {
if (value.sourceId === sourceId) {
keysToDelete.push(key);
}
});
keysToDelete.forEach(key => this.cacheMap.delete(key));
logger.info(TAG, `已清除图源 ${sourceId} 的所... | https://github.com/DaLongZhuaZi/manxia | 3acd543c0b54cdf15c718afab3019a1d43e91899 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/OrderCacheStoreRepository.ets | arkts | clearAll | 清除所有订单缓存(carts 和 selectedGoodsList)
@returns {Promise<void>} Promise<void> | clearAll(): Promise<void> {
return this.dataSource.clearAll();
} | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident... | clearAll(): Promise<void> {
return this.dataSource.clearAll();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 15ca8362b2391dbcff8def520395bf50f38da888 | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | analyzeText | Analyze a text and return the highlight result for the entire text
@param text Full text content
@return Highlight result | public analyzeText(text: string): DocumentHighlight {
if (this.nativeHandle == 0) {
return new DocumentHighlight();
}
let buffer: Int32Array = lib.TextAnalyzer_AnalyzeText(this.nativeHandle, text);
return NativeBufferPack.readDocumentHighlight(buffer);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeText 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#Left stri... | public analyzeText(text: string): DocumentHighlight {
if (this.nativeHandle == 0) {
return new DocumentHighlight();
}
let buffer: Int32Array = lib.TextAnalyzer_AnalyzeText(this.nativeHandle, text);
return NativeBufferPack.readDocumentHighlight(buffer);
} | https://github.com/FinalScave/SweetLine | ff3ed90f399d9a056bbdfce4614054d9642eaf06 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets | arkts | showErrorBanner | Shows the top error banner. A new error replaces any banner currently
visible so rapid bursts do not stack. The banner auto-dismisses after
4 seconds; tap also dismisses immediately.
@param text - Multi-line text to render inside the banner. | showErrorBanner(text: string): void {
if (this.errorBannerTimer !== -1) {
clearTimeout(this.errorBannerTimer);
this.errorBannerTimer = -1;
}
this.errorBannerText = text;
this.errorBannerTimer = setTimeout(() => {
this.hideErrorBanner();
}, 4000);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showErrorBanner 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#Left string AST#identifier#Right AST#)#Left )... | showErrorBanner(text: string): void {
if (this.errorBannerTimer !== -1) {
clearTimeout(this.errorBannerTimer);
this.errorBannerTimer = -1;
}
this.errorBannerText = text;
this.errorBannerTimer = setTimeout(() => {
this.hideErrorBanner();
}, 4000);
} | https://github.com/AGenUI/AGenUI | 3ea063ea2154925373fc2213d9434c4f5eadef29 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/components/HomeView.ets | arkts | syncCollectionsOnce | ---------- sync helpers ---------- | async function syncCollectionsOnce(client: ZoteroClient, repo: ItemRepository): Promise<void> {
const state = await repo.getSyncState(SYNC_SCOPE_COLLECTIONS);
const opts: ListOptions = {
limit: 100,
start: undefined,
since: state !== undefined ? state.lastModifiedVersion : undefined,
q: undefined,
... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left syncCollectionsOnce AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left client AST#identifier#Right A... | async function syncCollectionsOnce(client: ZoteroClient, repo: ItemRepository): Promise<void> {
const state = await repo.getSyncState(SYNC_SCOPE_COLLECTIONS);
const opts: ListOptions = {
limit: 100,
start: undefined,
since: state !== undefined ? state.lastModifiedVersion : undefined,
q: undefined,
... | https://github.com/Vincent-Leon/zotero-harmony | be652a24d1ea51b376e8a3fd900c2964ee313eeb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets | arkts | notifyLoadComplete | 通知加载完成 | private notifyLoadComplete(pageId: string, pixelMap: image.PixelMap | null): void {
const callbacks = this.loadCompleteCallbacks.get(pageId);
if (callbacks) {
const callbacksSnapshot: Array<(pixelMap: image.PixelMap | null) => void> = callbacks.slice();
callbacksSnapshot.forEach(cb => cb(pixelMap)... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyLoadComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private notifyLoadComplete(pageId: string, pixelMap: image.PixelMap | null): void {
const callbacks = this.loadCompleteCallbacks.get(pageId);
if (callbacks) {
const callbacksSnapshot: Array<(pixelMap: image.PixelMap | null) => void> = callbacks.slice();
callbacksSnapshot.forEach(cb => cb(pixelMap)... | https://github.com/DaLongZhuaZi/manxia | 1db5d56e4511106e93d192e26e7b2ef9c7216226 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets | arkts | entries | Returns elements from the HashSet as an array of Entries
@returns an array of Entries | entries(): IterableIterator<[T, T]> {
return this.buckets.entries();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left entries 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#call_expression#Left AST... | entries(): IterableIterator<[T, T]> {
return this.buckets.entries();
} | https://gitcode.com/iop123123/arkts-static-skills | bea1416c4c6e40b125d3d48828161efff1039502 | gitcode |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | getNode | 新建或复用节点
@param type 节点类型
@param data 数据
@param builder 封装builder对象
@returns 新建或复用的节点 | public getNode(type: string, data: ESObject, builder: WrappedBuilder<ESObject>): NodeItem | undefined {
let node: NodeItem | undefined = this.nodePool.get(type)?.pop();
if (!node) {
node = new NodeItem(builder, data, type, this);
} else {
node.data = data;
}
node.isUsing = true;
th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | public getNode(type: string, data: ESObject, builder: WrappedBuilder<ESObject>): NodeItem | undefined {
let node: NodeItem | undefined = this.nodePool.get(type)?.pop();
if (!node) {
node = new NodeItem(builder, data, type, this);
} else {
node.data = data;
}
node.isUsing = true;
th... | https://gitee.com/openharmony-sig/node_pool.git | 13247c6dcddd0ca0ab80aa7cbf6648c23e78f9ac | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | Creates a new Float64Array from current Float64Array based on a condition fn.
@param fn the condition to apply for each element
@returns a new Float64Array with elements from current Float64Array that satisfy condition fn | public filter(fn: (val: double, index: int, array: Float64Array) => boolean): Float64Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resLen
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: double, index: int, array: Float64Array) => boolean): Float64Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resLen
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4052f4bbc2f1943424073962a8184b6de3db0ea5 | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/components/HomeCard.ets | arkts | getRankColor | 获取排名颜色 | getRankColor(index: number): ResourceStr {
if (index === 0) return '#FFD700' // 金色
if (index === 1) return '#C0C0C0' // 银色
if (index === 2) return '#CD7F32' // 铜色
return $r('app.color.text_secondary')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRankColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A... | getRankColor(index: number): ResourceStr {
if (index === 0) return '#FFD700' // 金色
if (index === 1) return '#C0C0C0' // 银色
if (index === 2) return '#CD7F32' // 铜色
return $r('app.color.text_secondary')
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 45554eda285f9fd32b7ba0a297c78444d24c589f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_byte.ets | arkts | main | ---
desc: check prefix increment for byte operand
--- | function main(): void {
let value: byte = {{v.value}}
let result: byte = ++value
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: byte = {{v.value}}
let result: byte = ++value
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a5e344566015a93bd1284d0d2a33edc17b002710 | gitee |
openharmony/web_webview | interfaces/kits/ani/webview/ets/@ohos.web.webview.ets | arkts | clearAllCookies | Remove all cookies Asynchronously.
@param { AsyncCallback<void> } callback - Called after the cookies have been deleted.
@throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
<br>2. Incorrect parameter types.
@syscap SystemCapability.Web.Webview.Core
@crossplatf... | static clearAllCookies(callback: AsyncCallback<void>): void {
let pCallback = taskpool.execute(():undefined => {
WebCookieManager.clearAllCookiesSync(); return undefined});
pCallback.then((e :NullishType)=>{
callback(null, undefined);
}, (err:... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearAllCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio... | static clearAllCookies(callback: AsyncCallback<void>): void {
let pCallback = taskpool.execute(():undefined => {
WebCookieManager.clearAllCookiesSync(); return undefined});
pCallback.then((e :NullishType)=>{
callback(null, undefined);
}, (err:... | https://gitee.com/openharmony/web_webview.git | 16a2f925e1395644134e892649d2774d55eefdb1 | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | getRecentDocuments | ============ 最近访问与推荐 ============
获取最近访问的文档 | async getRecentDocuments(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<{ documents: KnowledgeDocument[]; total: number }>> {
return this.client.get<{ documents: KnowledgeDocument[]; total: number }>('/api/v1/knowledge/recent', params as Record<string, any>)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecentDocuments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#typ... | async getRecentDocuments(params?: { page?: number; pageSize?: number }): Promise<ApiResponse<{ documents: KnowledgeDocument[]; total: number }>> {
return this.client.get<{ documents: KnowledgeDocument[]; total: number }>('/api/v1/knowledge/recent', params as Record<string, any>)
} | https://github.com/David8Idira/AI-OA | a686ec5d2fca083fd7b7b5be25552cc935dc9eed | github |
openharmony/codelabs | GraphicImage/GestureScreenshot/entry/src/main/ets/common/utils/DrawUtil.ets | arkts | drawLines | Draw box selection lines. | private drawLines() {
this.canvasContext.beginPath();
this.canvasContext.lineWidth = Constants.LINES_WIDTH;
this.canvasContext.strokeStyle = Constants.LINES_COLOR;
this.canvasContext.globalAlpha = Constants.LINES_ALPHA;
this.canvasContext.lineJoin = Constants.LINES_STYLE;
this.canvasContext.mo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawLines 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 { ... | private drawLines() {
this.canvasContext.beginPath();
this.canvasContext.lineWidth = Constants.LINES_WIDTH;
this.canvasContext.strokeStyle = Constants.LINES_COLOR;
this.canvasContext.globalAlpha = Constants.LINES_ALPHA;
this.canvasContext.lineJoin = Constants.LINES_STYLE;
this.canvasContext.mo... | https://gitee.com/openharmony/codelabs.git | 5286d8300fc1278c5ec7c887f5de81d240d2c83d | gitee |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets | arkts | getAccessibilityText | 获取无障碍文本
@param resource 资源
@param selected select state
@returns string | getAccessibilityText(resource: ResourceStr | undefined): string {
try {
let resourceString: string = '';
if (typeof resource === 'string') {
resourceString = resource as string;
} else {
let uiContent: common.Context | undefined = UIContext.resolveUIContext()?.getHostContext();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAccessibilityText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left Reso... | getAccessibilityText(resource: ResourceStr | undefined): string {
try {
let resourceString: string = '';
if (typeof resource === 'string') {
resourceString = resource as string;
} else {
let uiContent: common.Context | undefined = UIContext.resolveUIContext()?.getHostContext();
... | https://gitcode.com/openharmony/arkui_ace_engine | 9699eaa52ee492b0069e83d81ebddb61c8cb4b47 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onPinchEnd | Pinch end. | onPinchEnd(): void {
Logger.debug(TAG, 'onPinchEnd');
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let dis... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPinchEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onPinchEnd(): void {
Logger.debug(TAG, 'onPinchEnd');
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let dis... | https://gitee.com/openharmony/codelabs.git | dfcae0e06d719ed047e24f50964e723e4b86440f | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | deserialize | 从紧凑 JSON 反序列化为按键列表(兼容 v1、v2 和压缩格式)
@returns [profileName, keys] 或 null(解析失败) | static async deserialize(data: string): Promise<[string, CustomKeyDef[]] | null> {
let json = data;
if (isCompressedData(data)) {
try {
json = await decompressFromBase64(data);
} catch (e) {
console.error('[QrShareService] 解压失败:', JSON.stringify(e));
return null;
}
... | 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 deserialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:... | static async deserialize(data: string): Promise<[string, CustomKeyDef[]] | null> {
let json = data;
if (isCompressedData(data)) {
try {
json = await decompressFromBase64(data);
} catch (e) {
console.error('[QrShareService] 解压失败:', JSON.stringify(e));
return null;
}
... | https://github.com/AlkaidLab/moonlight-harmony | 0f5c0bb2ba0cb095b086a65ce7d6c88571023eb1 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/CryptoUtils.ets | arkts | generateKeyItem | 生成RSA加密密钥
@returns 结果 | private static generateKeyItem(): Promise<boolean> {
return huks.generateKeyItem(CryptoUtils.KeePassHO_AES_KEY_ALIAS, CryptoUtils.getGenerateProperties()).then(() => {
return true;
}).catch((error: BusinessError) => {
hilog.error(DOMAIN, TAG, 'generate key item failed,message is' + JSON.stringify(... | 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 generateKeyItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private static generateKeyItem(): Promise<boolean> {
return huks.generateKeyItem(CryptoUtils.KeePassHO_AES_KEY_ALIAS, CryptoUtils.getGenerateProperties()).then(() => {
return true;
}).catch((error: BusinessError) => {
hilog.error(DOMAIN, TAG, 'generate key item failed,message is' + JSON.stringify(... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CryptoUtils.ets#L81-L88 | f534078f6df09ac874525f4e32f879fab9e89109 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets | arkts | processPreloadQueue | 处理预加载队列 | private processPreloadQueue(): void {
// 检查并发数
while (this.loadingTasks.size < this.MAX_CONCURRENT_LOADS && this.preloadQueue.length > 0) {
const task = this.preloadQueue.shift();
if (task && !this.cache.has(task.pageId) && !this.loadingTasks.has(task.pageId)) {
// 异步加载,不等待结果
this.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processPreloadQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST... | private processPreloadQueue(): void {
// 检查并发数
while (this.loadingTasks.size < this.MAX_CONCURRENT_LOADS && this.preloadQueue.length > 0) {
const task = this.preloadQueue.shift();
if (task && !this.cache.has(task.pageId) && !this.loadingTasks.has(task.pageId)) {
// 异步加载,不等待结果
this.... | https://github.com/DaLongZhuaZi/manxia | c63108f668b0aca72191c0296755591dd4f23d24 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/parking/ParkingService.ets | arkts | getParkingSpaces | 获取指定停车场的车位列表 | async getParkingSpaces(lotId: string): Promise<ParkingSpace[]> {
return getMockParkingSpaces(lotId);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getParkingSpaces AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left lotId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getParkingSpaces(lotId: string): Promise<ParkingSpace[]> {
return getMockParkingSpaces(lotId);
} | https://github.com/LJ666-ui/harmony-health-care | be557dcffca597a4c5daa7bce94f6605b61d695b | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | watchStatus | Sets whether the screen is a constant based on the playback status. | watchStatus() {
let windowClass = GlobalContext.getContext().getObject('windowClass') as window.Window;
if (this.status === CommonConstants.STATUS_START) {
windowClass.setWindowKeepScreenOn(true);
} else {
windowClass.setWindowKeepScreenOn(false);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left watchStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | watchStatus() {
let windowClass = GlobalContext.getContext().getObject('windowClass') as window.Window;
if (this.status === CommonConstants.STATUS_START) {
windowClass.setWindowKeepScreenOn(true);
} else {
windowClass.setWindowKeepScreenOn(false);
}
} | https://gitee.com/openharmony/codelabs.git | fc5f2c3c221cd86efbff407a6f78c64a84a74d4d | gitee |
openharmony-sig/arkui_composite_component | source/TreeView/TreeView.ets | arkts | getClickNodeChildrenInfo | Obtains the subNode information of the currently clicked node.
@return Array Returns an array that stores the configuration information of each node.
If there is no child node, an empty array is returned.
@since 10 | public getClickNodeChildrenInfo(): Array<{ itemId: number, itemIcon: Resource, itemTitle: string,
isFolder: boolean }> {
let clickNodeId = this.listNodeDataSource.getClickNodeId();
return this.listNodeUtils.getClickNodeChildrenInfo(clickNodeId);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getClickNodeChildrenInfo 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#instantiation... | public getClickNodeChildrenInfo(): Array<{ itemId: number, itemIcon: Resource, itemTitle: string,
isFolder: boolean }> {
let clickNodeId = this.listNodeDataSource.getClickNodeId();
return this.listNodeUtils.getClickNodeChildrenInfo(clickNodeId);
} | https://gitee.com/openharmony-sig/arkui_composite_component.git | 87890cac3eddeeb20baf5c2b5a9e4615437ae4ef | gitee |
genjishare/snake-game | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onContinue | 应用接续处理 | onContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult {
try {
hilog.info(DOMAIN, TAG, '接续开始,同步方式获取游戏状态');
// 直接从GameStateManager获取当前游戏状态
const gameState = GameStateManager.getCurrentGameState();
if (gameState) {
hilog.info(DOMAIN, TAG, `成功获取游戏状态: ${JSON.... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onContinue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left wantParam AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ... | onContinue(wantParam: Record<string, Object>): AbilityConstant.OnContinueResult {
try {
hilog.info(DOMAIN, TAG, '接续开始,同步方式获取游戏状态');
// 直接从GameStateManager获取当前游戏状态
const gameState = GameStateManager.getCurrentGameState();
if (gameState) {
hilog.info(DOMAIN, TAG, `成功获取游戏状态: ${JSON.... | https://github.com/genjishare/snake-game | 745c3f1ffa41f58983483d383010577775cb4cd7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets | arkts | import | 执行PDF导入 | public async import(): Promise<PdfImportResult> {
try {
const importMode = this.config.importMode || PdfImportMode.TANKOUBON;
const isSingleChapter = importMode === PdfImportMode.SINGLE_CHAPTER;
logger.info(TAG, `开始导入PDF: ${this.config.pdfPath}, 模式: ${importMode}`);
this.reportProgr... | 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#import#Left AST#import#Left import AST#import#Right AST#import#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expre... | public async import(): Promise<PdfImportResult> {
try {
const importMode = this.config.importMode || PdfImportMode.TANKOUBON;
const isSingleChapter = importMode === PdfImportMode.SINGLE_CHAPTER;
logger.info(TAG, `开始导入PDF: ${this.config.pdfPath}, 模式: ${importMode}`);
this.reportProgr... | https://github.com/DaLongZhuaZi/manxia | 7faa5ce67270582f921a0af4d822957f22f00cf6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets | arkts | importFromJSON | 导入规则(从JSON) | async importFromJSON(jsonStr: string): Promise<DictRuleImportResult> {
const result: DictRuleImportResult = {
total: 0,
success: 0,
failed: 0,
errors: []
};
try {
const data: Object = SafeUtils.parseObj(jsonStr);
const rules: Object[] = Array.isArray(data) ? data as Ob... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importFromJSON AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left jsonStr AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async importFromJSON(jsonStr: string): Promise<DictRuleImportResult> {
const result: DictRuleImportResult = {
total: 0,
success: 0,
failed: 0,
errors: []
};
try {
const data: Object = SafeUtils.parseObj(jsonStr);
const rules: Object[] = Array.isArray(data) ? data as Ob... | https://github.com/DaLongZhuaZi/manxia | e32a48c05d5977b475af05523ed8dd5eea921933 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | regist | 注册 TODO 目前Axios框架有bug无法从header获取多个set-cookie,所以改用原生的请求实现
https://www.wanandroid.com/user/register
@param username
@param password
@param repassword
@param success
@param failure | public async regist(username: string, password: string, repassword: string,): Promise<LoginRegistResult> {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp()
try {
const response = await httpRequest.request(// 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
... | 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 regist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public async regist(username: string, password: string, repassword: string,): Promise<LoginRegistResult> {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp()
try {
const response = await httpRequest.request(// 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定
... | https://github.com/RedRackham-R/WanAndroidHarmoney | 8bda765cd3c3aa78cb62e131c593e799d305f14b | github |
Gramony/Gramony | features/home/src/main/ets/viewmodel/Chat/ChatPhotoNodeController.ets | arkts | createCircleLetterPixelMap | 生成圆形渐变背景字母图片
@param size 图片尺寸(宽高相等)
@param letter 要显示的字母
@param startColor 渐变起始颜色(RGB格式,例如:'#FF0000')
@param endColor 渐变结束颜色(RGB格式,例如:'#0000FF')
@returns Promise<PixelMap> | function createCircleLetterPixelMap(
letter: string,
myThis?: Object | undefined
): PixelMap {
const context: Context = getContext(myThis);
const resourceMgr : resourceManager.ResourceManager = context.resourceManager;
let data = resourceMgr.getMediaContentSync($r('app.media.fallback_vibrant_orange_gradient'... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createCircleLetterPixelMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left letter AST#identifier#Right AST#type_annotation#Left AST#:#... | function createCircleLetterPixelMap(
letter: string,
myThis?: Object | undefined
): PixelMap {
const context: Context = getContext(myThis);
const resourceMgr : resourceManager.ResourceManager = context.resourceManager;
let data = resourceMgr.getMediaContentSync($r('app.media.fallback_vibrant_orange_gradient'... | https://github.com/Gramony/Gramony | 77ccd0bb8e3c803abf01445ac5db3979b05ad660 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGEllipse.ets | arkts | addAttribute | 添加共通属性
@param key 主键
@param value 值 | public addAttribute(key: string, value: string): void {
this._ellipseResultObj[key] = value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addAttribute 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 stri... | public addAttribute(key: string, value: string): void {
this._ellipseResultObj[key] = value;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 97eaf28bed0b713bdf95f0e81935c1503c116d99 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | getAllSourceCoverStats | 获取所有图源的封面统计 | async getAllSourceCoverStats(): Promise<Map<number, CoverStats>> {
const stats = new Map<number, CoverStats>();
try {
if (!await this.ensurePathInitialized()) {
return stats;
}
if (!SafeFileUtils.accessSync(this.coverBasePath)) {
return stats;
}
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllSourceCoverStats 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 A... | async getAllSourceCoverStats(): Promise<Map<number, CoverStats>> {
const stats = new Map<number, CoverStats>();
try {
if (!await this.ensurePathInitialized()) {
return stats;
}
if (!SafeFileUtils.accessSync(this.coverBasePath)) {
return stats;
}
... | https://github.com/DaLongZhuaZi/manxia | 07b99138e7420e5571b1d1b8b6ac4a209f16e380 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | requestRepository | 请求订单详情数据
@returns {Promise<NetworkResponse<Order>>} 网络请求 Promise | protected requestRepository(): Promise<NetworkResponse<Order>> {
return this.repository.getOrderInfo(this.orderId);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestRepository 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... | protected requestRepository(): Promise<NetworkResponse<Order>> {
return this.repository.getOrderInfo(this.orderId);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 11908ae4ac13f861d2f46f7055a9144651070567 | github |
zcg741/chengyu-game | entry/src/main/ets/pages/DailyChallengePage.ets | arkts | getTodayQuestionType | 根据日期计算今日题型(4种题型每日轮换) | getTodayQuestionType(): string {
const now = new Date();
const dayOfMonth = now.getDate();
const typeKeys: string[] = [QUESTION_TYPE.PINYIN, QUESTION_TYPE.FILL_BLANK, QUESTION_TYPE.EXPLANATION, QUESTION_TYPE.DRAGON];
return typeKeys[dayOfMonth % typeKeys.length];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTodayQuestionType 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#s... | getTodayQuestionType(): string {
const now = new Date();
const dayOfMonth = now.getDate();
const typeKeys: string[] = [QUESTION_TYPE.PINYIN, QUESTION_TYPE.FILL_BLANK, QUESTION_TYPE.EXPLANATION, QUESTION_TYPE.DRAGON];
return typeKeys[dayOfMonth % typeKeys.length];
} | https://github.com/zcg741/chengyu-game | 03d7ee5a20294652108b94b929625d9c2c6442b6 | github |
OHPG/FinVideo | entry/src/main/ets/player/AppPlayerContext.ets | arkts | destroy | ─── 销毁 ────────────────────────────────────────────────────────────────── | async destroy(): Promise<void> {
this.reportPlaybackStop()
await super.destroy()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left destroy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#t... | async destroy(): Promise<void> {
this.reportPlaybackStop()
await super.destroy()
} | https://github.com/OHPG/FinVideo | 6aa2d8dc9b7e6c3d26a660ab59ce4313e7572076 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets | arkts | getSuwayomiCache | 获取Suwayomi Tab缓存 | getSuwayomiCache(): SuwayomiCacheData | null {
return this.suwayomiCache;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSuwayomiCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifier#Left SuwayomiCacheData ... | getSuwayomiCache(): SuwayomiCacheData | null {
return this.suwayomiCache;
} | https://github.com/DaLongZhuaZi/manxia | 8df2206774814727ad7e838c58eb2f63c1b37fb7 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/DateUtil.ets | arkts | formatDateChinese | 格式化日期显示 YYYY-MM-DD -> YYYY年MM月DD日 | static formatDateChinese(date: string): string {
if (!date || date.length < 10) {
return date;
}
const parts = date.split('-');
return `${parts[0]}年${parts[1]}月${parts[2]}日`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDateChinese AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static formatDateChinese(date: string): string {
if (!date || date.length < 10) {
return date;
}
const parts = date.split('-');
return `${parts[0]}年${parts[1]}月${parts[2]}日`;
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 2b6e4cc68d1c1185d4d55075695b3be24d8e1329 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/GlobalContext.ets | arkts | setContext | 设置全局上下文 | static setContext(context: common.Context): void {
GlobalContextStore.context = context;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#... | static setContext(context: common.Context): void {
GlobalContextStore.context = context;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0d5b77cf855b6a5045f93d33ac8fa7afa5d46e52 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/controller/MpvController/MpvController.ets | arkts | registerPlaybackCompleteListener | 注册播放完成监听器 | private registerPlaybackCompleteListener(pathStack: NavPathStack) {
this.currentPathStack = pathStack
// 避免重复注册回调
if (this.playbackCallbackRegistered) {
salmonLogger.addLog(TAG, "播放完成监听器已注册,跳过重复注册", false)
return
}
try {
mpvRegisterPlaybackCompleteCallback(() => {
const ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerPlaybackCompleteListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathStack AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | private registerPlaybackCompleteListener(pathStack: NavPathStack) {
this.currentPathStack = pathStack
// 避免重复注册回调
if (this.playbackCallbackRegistered) {
salmonLogger.addLog(TAG, "播放完成监听器已注册,跳过重复注册", false)
return
}
try {
mpvRegisterPlaybackCompleteCallback(() => {
const ... | https://github.com/Yebingiscn/SweetVideo | ff5e86e4b1eef48eb2bf2525a07d7e7b8dad4552 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildChapterListActions | 构建章节列表获取操作序列 | buildChapterListActions(config: MangaSourceConfig, mangaId: string): Action[] {
const workflow = this.getWorkflow(config, 'getChapterList');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少章节列表工作流配置'
);
}
return this.processActions(work... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildChapterListActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConf... | buildChapterListActions(config: MangaSourceConfig, mangaId: string): Action[] {
const workflow = this.getWorkflow(config, 'getChapterList');
if (!workflow) {
throw new MangaSourceError(
MangaSourceErrorCode.INVALID_CONFIG,
'缺少章节列表工作流配置'
);
}
return this.processActions(work... | https://github.com/DaLongZhuaZi/manxia | 34fb32b7f6c48ec6e21433f820c1566b67d88b06 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | concat | Creates a new `Array` from this `Array` instance and given `Array` instance.
@param other to concatenate into a new array.
@returns New `Array` instance, constructed from `this` and given `other` instances of `Array` class. | public concat(other: Array<T>): Array<T> {
if (other == null) {
return this;
}
let res = this.concatArray(other);
return new Array<T>(res);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left concat 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_expression... | public concat(other: Array<T>): Array<T> {
if (other == null) {
return this;
}
let res = this.concatArray(other);
return new Array<T>(res);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 49ed34f0c06c38bf9d57c650c1f6feb5d7b9724e | gitee |
HarmonyOS_Samples/BestPracticeSnippets | JSCrash/entry/src/main/ets/pages/utils.ets | arkts | isLoggable | Checks whether logs of the specified tag, and level can be printed.
@param tag Identifies the log tag.
@param level log level
@since 7 | private static isLoggable(tag: string, level: hilog.LogLevel): boolean {
return hilog.isLoggable(DOMAIN, tag, level);
} | 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 isLoggable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST... | private static isLoggable(tag: string, level: hilog.LogLevel): boolean {
return hilog.isLoggable(DOMAIN, tag, level);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 2fd95e33c0b8ad1d6c7ffc81f087d6a665016c98 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | checkAndRegisterDevice | 检查并注册设备 | private async checkAndRegisterDevice(deviceId: number): Promise<void> {
try {
const deviceInfo = await inputDevice.getDeviceInfo(deviceId);
const deviceNameLower = deviceInfo.name.toLowerCase();
const isUsbInForceUsbMode =
!this.useGameControllerKit &&
this.useUsbDriverMode &&
... | 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 checkAndRegisterDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left ... | private async checkAndRegisterDevice(deviceId: number): Promise<void> {
try {
const deviceInfo = await inputDevice.getDeviceInfo(deviceId);
const deviceNameLower = deviceInfo.name.toLowerCase();
const isUsbInForceUsbMode =
!this.useGameControllerKit &&
this.useUsbDriverMode &&
... | https://github.com/AlkaidLab/moonlight-harmony | d630020cbb5e9f10e74fccf8c22052fce273ae23 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | saveLocalCacheToGallery | 直接将本地缓存文件保存到相册
@param context 应用上下文
@returns 是否保存成功 | async saveLocalCacheToGallery(context: common.UIAbilityContext): Promise<boolean> {
if (!this.localCachePath) {
ToastQueue.show({ message: '没有可保存的图片' });
return false;
}
try {
// 检查缓存文件是否存在
const stat = fileIo.statSync(this.localCachePath);
if (!stat || stat.size === 0) ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveLocalCacheToGallery AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifie... | async saveLocalCacheToGallery(context: common.UIAbilityContext): Promise<boolean> {
if (!this.localCachePath) {
ToastQueue.show({ message: '没有可保存的图片' });
return false;
}
try {
// 检查缓存文件是否存在
const stat = fileIo.statSync(this.localCachePath);
if (!stat || stat.size === 0) ... | https://github.com/AlkaidLab/moonlight-harmony | c323e23b70af1b7ff0dd8a0418439cee646467eb | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getValueFormatter | Returns the formatter used for formatting the axis labels.
@return | public getValueFormatter(): IAxisValueFormatter {
if (!this.mAxisValueFormatter ||
(this.mAxisValueFormatter instanceof DefaultAxisValueFormatter &&
(this.mAxisValueFormatter as DefaultAxisValueFormatter).getDecimalDigits() != this.mDecimals))
this.mAxisValueFormatter = new DefaultAxisValueFormatte... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueFormatter 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 IAxi... | public getValueFormatter(): IAxisValueFormatter {
if (!this.mAxisValueFormatter ||
(this.mAxisValueFormatter instanceof DefaultAxisValueFormatter &&
(this.mAxisValueFormatter as DefaultAxisValueFormatter).getDecimalDigits() != this.mDecimals))
this.mAxisValueFormatter = new DefaultAxisValueFormatte... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d1d547412cbf29c650998a596b4b0cb466530dc8 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Byte.ets | arkts | unboxed | Returns value of this instance as a primitive
@returns value of this instance | public unboxed(): byte {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unboxed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left byte AST#ident... | public unboxed(): byte {
return this.value;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0f3c4984f95bb0ddd04ad78e6481ca1ef2e3bb85 | gitee |
YANGZX22/Voot | entry/src/main/ets/storage/OnboardingStorage.ets | arkts | acceptTermsOfService | 标记用户已接受最新的用户协议
@param ctx UI Ability Context | static async acceptTermsOfService(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_TERMS_VERSION, POLICY_VERSIONS.TERMS);
await prefs.flush();
} | 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 acceptTermsOfService AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left... | static async acceptTermsOfService(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_TERMS_VERSION, POLICY_VERSIONS.TERMS);
await prefs.flush();
} | https://github.com/YANGZX22/Voot | 2464fd509c2a9809075bdfb83b9fe3e48df97e87 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/BatchInsertResult.ets | arkts | isPartialSuccess | 检查是否部分成功
@returns 是否部分成功 | isPartialSuccess(): boolean {
return this.insertedCount > 0 && this.insertedCount < this.totalCount
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isPartialSuccess 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#st... | isPartialSuccess(): boolean {
return this.insertedCount > 0 && this.insertedCount < this.totalCount
} | https://github.com/offlinecat-dev/OCNetORM | c61e3dd8a33990f42eec6d13947a8df8e46bc203 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/KeywordRetriever.ets | arkts | bm25Score | BM25打分
@param queryTerms 查询词列表
@returns 文档得分映射 | private bm25Score(queryTerms: string[]): Map<string, number> {
const k1 = 1.5; // BM25参数
const b = 0.75; // BM25参数
const N = this.documents.size; // 文档总数
const scores = new Map<string, number>();
for (const term of queryTerms) {
// 获取包含该词的文档
const docsWithTerm = this.invertedIndex... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left bm25Score AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left queryTerms AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | private bm25Score(queryTerms: string[]): Map<string, number> {
const k1 = 1.5; // BM25参数
const b = 0.75; // BM25参数
const N = this.documents.size; // 文档总数
const scores = new Map<string, number>();
for (const term of queryTerms) {
// 获取包含该词的文档
const docsWithTerm = this.invertedIndex... | https://github.com/LJ666-ui/harmony-health-care | d6d672e4db46846f6d6fa8bba7ebe046341ecc70 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/core/Controller.ets | arkts | isAnimationRunning | 当前组件是否有动画运行,如果有,则不支持控制引导页
@returns 当前组件是否有动画在运行 | public isAnimationRunning(): boolean {
return this.animationRunning
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAnimationRunning 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 boolea... | public isAnimationRunning(): boolean {
return this.animationRunning
} | https://github.com/wuba/omni-ui | 20c5790b67a803783e9bfbd5418d5b2ad533ef2b | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/image/ImageUtil.ets | arkts | createImageSource | 创建ImageSource实例
@param {string | number | ArrayBuffer | resourceManager.RawFileDescriptor} src 图片数据源
{string} 当前应用沙箱的图片路径。
{number} 文件描述符fd。
{ArrayBuffer} 图像缓冲区数组。
{resourceManager.RawFileDescriptor} rawfile图片文件所在hap的descriptor信息。
@param {image.SourceOptions} options 图片属性(像素密度、像素格式、图片尺寸等)。
@returns {image.ImageSource} ... | private static createImageSource(src: string | number | ArrayBuffer | resourceManager.RawFileDescriptor, options?: image.SourceOptions): image.ImageSource {
if (typeof src === 'string') {
if (options) return image.createImageSource(src, options);
return image.createImageSource(src);
} else if (typ... | 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 createImageSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Lef... | private static createImageSource(src: string | number | ArrayBuffer | resourceManager.RawFileDescriptor, options?: image.SourceOptions): image.ImageSource {
if (typeof src === 'string') {
if (options) return image.createImageSource(src, options);
return image.createImageSource(src);
} else if (typ... | https://github.com/Joker-x-dev/CoolMallArkTS | 3797d11fb688e5bc48134d63a7f56999fe9af8a3 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets | arkts | connectSocket | 空实现
@param address
@param port | async connectSocket(address: string, port: number): Promise<boolean> {
return false;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left connectSocket AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left address AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async connectSocket(address: string, port: number): Promise<boolean> {
return false;
} | https://github.com/openharmony/applications_app_samples | eb18b3e15274136f95905dad73f29540966727ef | github |
openharmony/applications_mms | entry/src/main/ets/utils/DateUtil.ets | arkts | convertTimeStampToDateWeek | Converting Time
@param messageItem
@param is24HourTime
@param that
@return | convertTimeStampToDateWeek(messageItem, is24HourTime) {
let now = new Date();
let yearOfNow = now.getFullYear();
let monthOfNow = now.getMonth() + 1;
let dayOfNow = now.getDate();
let timeMillisecond = messageItem.timeMillisecond;
this.convertTimeStampToDate(messageItem, timeMillisecond, yearO... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left convertTimeStampToDateWeek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left messageItem AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left is24HourTime AST#identifier#Right AST#... | convertTimeStampToDateWeek(messageItem, is24HourTime) {
let now = new Date();
let yearOfNow = now.getFullYear();
let monthOfNow = now.getMonth() + 1;
let dayOfNow = now.getDate();
let timeMillisecond = messageItem.timeMillisecond;
this.convertTimeStampToDate(messageItem, timeMillisecond, yearO... | https://gitee.com/openharmony/applications_mms.git | a0e026397d1226f3529af25505699537a637ad01 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/UserAgentManager.ets | arkts | getUserAgent | 获取指定图源应使用的User-Agent
优先级:图源级别设置 > 全局设置 > 图源JSON配置 > 默认值
@param sourceId 图源ID
@param sourceConfigUA 图源JSON配置中的UA(可选)
@returns User-Agent字符串 | async getUserAgent(sourceId: number, sourceConfigUA?: string): Promise<string> {
try {
// 1. 检查图源级别的自定义UA设置
const sourceUA = await this.getSourceUserAgent(sourceId);
if (sourceUA) {
logger.debug(TAG, `使用图源级别UA: sourceId=${sourceId}`);
return sourceUA;
}
// 2. 检查全局自定义... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserAgent 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 AST#:#Left ... | async getUserAgent(sourceId: number, sourceConfigUA?: string): Promise<string> {
try {
// 1. 检查图源级别的自定义UA设置
const sourceUA = await this.getSourceUserAgent(sourceId);
if (sourceUA) {
logger.debug(TAG, `使用图源级别UA: sourceId=${sourceId}`);
return sourceUA;
}
// 2. 检查全局自定义... | https://github.com/DaLongZhuaZi/manxia | 0da32a33d3add2767c5c638dadaa3159674fc2f6 | github |
CLMC2025/Vignette | entry/src/main/ets/ui/ProgressCharts.ets | arkts | StatsGrid | 统计卡片网格组件 | @Builder
function StatsGrid(
stats: StatsCardData[]
): void {
Grid() {
ForEach(stats, (stat: StatsCardData, index: number) => {
GridItem() {
Column() {
Row() {
Text(stat.title)
.fontSize(12)
.fontColor(DesignTokens.Colors.TEXT_SECONDARY)
... | 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 StatsGrid AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#require... | @Builder
function StatsGrid(
stats: StatsCardData[]
): void {
Grid() {
ForEach(stats, (stat: StatsCardData, index: number) => {
GridItem() {
Column() {
Row() {
Text(stat.title)
.fontSize(12)
.fontColor(DesignTokens.Colors.TEXT_SECONDARY)
... | https://github.com/CLMC2025/Vignette | 318cd4a5bf01204703018fdab110809656c49d5f | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | unregisterNavStack | 从ZRouter解注册路由栈,通常情况使用不上
@param stackName | public static unregisterNavStack(stackName: string) {
ZRouter.getRouterMgr().unregisterNavStack(stackName)
} | 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 unregisterNavStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stackName AST#identifier#Right AST#ERROR#Left AST#:... | public static unregisterNavStack(stackName: string) {
ZRouter.getRouterMgr().unregisterNavStack(stackName)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L235-L237 | 41e49d8fbf3e220144a88dd3a8da997e6eb723c8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new LongBox instance with the specified initial value.
@param { long } value - The initial long value to be wrapped
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(value: long) {
this.value = value;
} | 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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier... | public constructor(value: long) {
this.value = value;
} | https://gitcode.com/iop123123/arkts-static-skills | 2e52f226827a7faf544109f5feb918848080e4c2 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/ShortcutManager.ets | arkts | updateShortcut | 更新快捷键 | async updateShortcut(id: string, name?: string, keys?: number[], icon?: string, color?: string, keySequence?: number[][]): Promise<boolean> {
const index = this.shortcuts.findIndex(s => s.id === id);
if (index === -1) return false;
const current = this.shortcuts[index];
this.shortcuts[index] = {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateShortcut AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async updateShortcut(id: string, name?: string, keys?: number[], icon?: string, color?: string, keySequence?: number[][]): Promise<boolean> {
const index = this.shortcuts.findIndex(s => s.id === id);
if (index === -1) return false;
const current = this.shortcuts[index];
this.shortcuts[index] = {
... | https://github.com/AlkaidLab/moonlight-harmony | 616df3f3c9729a4e22b75ce617eef0256f8d7b27 | github |
codelably/HCompass | packages/demo/src/main/ets/services/DemoNavSvcImpl.ets | arkts | toNavigationWithArgs | 跳转到带参跳转示例页
@param {number} goodsId - 商品 ID
@param {Resource} goodsName - 商品名称
@returns {void} 无返回值 | toNavigationWithArgs(goodsId: number, goodsName: Resource): void {
const params: DemoGoodsParam = { goodsId, goodsName };
const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService);
navigation?.navigateTo(DemoRoutes.NavigationWithArgs, params);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toNavigationWithArgs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left ,... | toNavigationWithArgs(goodsId: number, goodsName: Resource): void {
const params: DemoGoodsParam = { goodsId, goodsName };
const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService);
navigation?.navigateTo(DemoRoutes.NavigationWithArgs, params);
} | https://github.com/codelably/HCompass | 97d24dcda1c165fe957805479add2456ea4451e3 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/download/DownloadPaths.ets | arkts | buildFilename | title 清洗非法字符 + 截断 + 拼 id 与扩展名。 | static buildFilename(book: Book): string {
const ext: string = book.extension !== undefined && book.extension.length > 0 ? book.extension : 'epub';
const safeTitle: string = book.title.replace(/[\\\/:*?"<>|]/g, '_').slice(0, 80);
return `${safeTitle}_${book.id}.${ext}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildFilename AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left book AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bo... | static buildFilename(book: Book): string {
const ext: string = book.extension !== undefined && book.extension.length > 0 ? book.extension : 'epub';
const safeTitle: string = book.title.replace(/[\\\/:*?"<>|]/g, '_').slice(0, 80);
return `${safeTitle}_${book.id}.${ext}`;
} | https://github.com/LZZLHY/hlib | 0470e7056cd23a8b0b77e4d94f08d20d89b86a7f | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | isOperatorChar | is operator char
@param operator operator | isOperatorChar(operator: string): boolean {
return (operator === '-' || operator === '+' || operator === '×' || operator === '÷');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isOperatorChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operator AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#... | isOperatorChar(operator: string): boolean {
return (operator === '-' || operator === '+' || operator === '×' || operator === '÷');
} | https://gitee.com/openharmony-sig/applications_calculator.git | 7335bdce5372b39505bf9026c0d705d589750518 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/TotpService.ets | arkts | parseAlgorithm | 解析算法字符串
@param algorithm 算法字符串
@returns TOTP算法枚举值 | private parseAlgorithm(algorithm: string | null): TotpAlgorithm {
if (!algorithm) {
return TotpAlgorithm.SHA1;
}
switch (algorithm.toUpperCase()) {
case 'SHA256':
return TotpAlgorithm.SHA256;
case 'SHA512':
return TotpAlgorithm.SHA512;
case 'SHA1':
default:
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseAlgorithm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left algorithm AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | private parseAlgorithm(algorithm: string | null): TotpAlgorithm {
if (!algorithm) {
return TotpAlgorithm.SHA1;
}
switch (algorithm.toUpperCase()) {
case 'SHA256':
return TotpAlgorithm.SHA256;
case 'SHA512':
return TotpAlgorithm.SHA512;
case 'SHA1':
default:
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L452-L466 | 1cc173a1e502271eaf537f384aaac60084d07dc8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getLayoutParams | 获取当前布局参数 | public static getLayoutParams(): ResponsiveLayoutParams {
const deviceInfo = ResponsiveLayoutHelper.deviceManager.getDeviceInfo();
const breakpoint = deviceInfo.breakpoint;
switch (breakpoint) {
case Breakpoint.XS:
return ResponsiveLayoutHelper.getXSLayoutParams();
case Breakpoint.SM:... | 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 getLayoutParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public static getLayoutParams(): ResponsiveLayoutParams {
const deviceInfo = ResponsiveLayoutHelper.deviceManager.getDeviceInfo();
const breakpoint = deviceInfo.breakpoint;
switch (breakpoint) {
case Breakpoint.XS:
return ResponsiveLayoutHelper.getXSLayoutParams();
case Breakpoint.SM:... | https://github.com/DaLongZhuaZi/manxia | 823a45808feafa8cb70908ca7064a1e1d3957ae3 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/PullUpManager.ets | arkts | getFormCardType | Obtain different form cards. If 'ARTICLE_SERVICE_CARD' type, then entryAbility calls the update.
@param want
@returns FormCardEnum or void. | public static getFormCardType(want: Want): FormCardEnum | void {
// The serviceCard and Lock screen card all have formID. Short cut entry doesn't has formID.
if (!PullUpManager.checkAndHandleParams(want)) {
PullUpManager.formCardType = undefined;
return;
}
if (want?.parameters?.['formID'] ... | 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 getFormCardType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : ... | public static getFormCardType(want: Want): FormCardEnum | void {
// The serviceCard and Lock screen card all have formID. Short cut entry doesn't has formID.
if (!PullUpManager.checkAndHandleParams(want)) {
PullUpManager.formCardType = undefined;
return;
}
if (want?.parameters?.['formID'] ... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 8f14e51293d84f9006a519877dcbee5ef3bfcd8e | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/model/NavDestBuilder.ets | arkts | setLunchMode | 设置启动模式,api12起才会生效
@param mode
@returns | public setLunchMode(mode: LaunchMode): NavDestBuilder<T> {
this.optionsImpl.lunchMode = mode;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLunchMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Lau... | public setLunchMode(mode: LaunchMode): NavDestBuilder<T> {
this.optionsImpl.lunchMode = mode;
return this;
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L62-L65 | 46ca758366779fdddea5d3fc606871dee24243ab | github |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/NumberPassPage.ets | arkts | build | UI 构建方法: build
描述: 定义页面的 UI 结构。
布局结构: Header -> PasswordDisplay -> NumberPad -> BottomActions | build() {
// 垂直容器,无间距,占满全屏
Column({ space: 0 }) {
// 1. 顶部导航栏
this.buildHeader()
// 2. 密码显示区域 (圆点/明文)
this.buildPasswordDisplay()
// 3. 数字键盘区域
this.buildNumberPad()
// 4. 底部操作按钮区域
this.buildBottomActions()
}
.width('100%')
.height('100%')
// 浅... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 垂直容器,无间距,占满全屏 A... | build() {
// 垂直容器,无间距,占满全屏
Column({ space: 0 }) {
// 1. 顶部导航栏
this.buildHeader()
// 2. 密码显示区域 (圆点/明文)
this.buildPasswordDisplay()
// 3. 数字键盘区域
this.buildNumberPad()
// 4. 底部操作按钮区域
this.buildBottomActions()
}
.width('100%')
.height('100%')
// 浅... | https://gitcode.com/openharmony/codelabs | a67b80f0bbdbd65b498abf9b934e513b9b9b0d30 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | getFontSize | 获取指定场景的字体大小 | getFontSize(scene: FontScene): number {
switch (scene) {
case FontScene.APP_UI:
return this.settings.appFontSize;
case FontScene.NOVEL:
return this.settings.novelFontSize;
case FontScene.EBOOK:
return this.settings.ebookFontSize;
default:
return 1.0;
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FontScene AST#identifier#Right AST#)#Left )... | getFontSize(scene: FontScene): number {
switch (scene) {
case FontScene.APP_UI:
return this.settings.appFontSize;
case FontScene.NOVEL:
return this.settings.novelFontSize;
case FontScene.EBOOK:
return this.settings.ebookFontSize;
default:
return 1.0;
}
... | https://github.com/DaLongZhuaZi/manxia | d4bdf8f28c6e853fa5280feb57a9b251e29f2595 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentDetailStateViewModel.ets | arkts | getData | 获取数据
@param cardComponentId 卡片组件Id
@returns Promise<void> | async getData(componentId: number): Promise<ComponentDetailModel> {
this.componentDetailModel = await this.cardComponentDetailDataModel.init(componentId)
return this.componentDetailModel
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left comp... | async getData(componentId: number): Promise<ComponentDetailModel> {
this.componentDetailModel = await this.cardComponentDetailDataModel.init(componentId)
return this.componentDetailModel
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 0849d6b56d23d8031e026066516c1fc130d5aae2 | gitcode |
fbinba3955/Flymby | common/src/main/ets/utils/VolumeUtil.ets | arkts | getMinVolume | 获取最小音量值
@returns 最小音量值 0.0-1.0 | public static async getMinVolume(): Promise<number> {
try {
if (!VolumeUtil.audioVolumeGroupManager) {
LogUtil.error('VolumeUtil 音量组管理器未初始化');
return VolumeUtil.MIN_VOLUME;
}
// 使用音量组管理器获取最小音量
const minSystemVolume = await VolumeUtil.audioVolumeGroupManager.getMinVolume(au... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getMinVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#R... | public static async getMinVolume(): Promise<number> {
try {
if (!VolumeUtil.audioVolumeGroupManager) {
LogUtil.error('VolumeUtil 音量组管理器未初始化');
return VolumeUtil.MIN_VOLUME;
}
// 使用音量组管理器获取最小音量
const minSystemVolume = await VolumeUtil.audioVolumeGroupManager.getMinVolume(au... | https://github.com/fbinba3955/Flymby | 0cba43defda87c6420ff052ceec82050e19fb442 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | getCurrentData | 获取当前性能数据 | public getCurrentData(): HidebugPerformanceData | null {
if (!this.isEnabled) {
return null;
}
// 如果正在收集中,返回null避免冲突
if (this.isCollecting) {
return null;
}
// 同步收集当前数据
return this.collectPerformanceDataSync();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left ... | public getCurrentData(): HidebugPerformanceData | null {
if (!this.isEnabled) {
return null;
}
// 如果正在收集中,返回null避免冲突
if (this.isCollecting) {
return null;
}
// 同步收集当前数据
return this.collectPerformanceDataSync();
} | https://github.com/DaLongZhuaZi/manxia | 8807c5c7f86e945e65d731218fa368ed96e33434 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | unSubscribeLoginOutEvent | 取消订阅登出事件 | unSubscribeLoginOutEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_LOGIN_OUT, key);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unSubscribeLoginOutEvent 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#identi... | unSubscribeLoginOutEvent(key: string) {
EventBus.getInstance().unregistByKey(WanEventId.EVENT_LOGIN_OUT, key);
} | https://github.com/RedRackham-R/WanAndroidHarmoney | e31d2a5660e14e37a25a3cc6a1f2da072c9d608f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | resolveDependencies | 解析依赖项列表 | private async resolveDependencies(dependencies: string[], context: ResolutionContext): Promise<Map<string, object>> {
const resolved = new Map<string, object>();
for (const dep of dependencies) {
const instance: object = await this.resolveInternal<object>(dep, context);
resolved.set(dep, inst... | 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 resolveDependencies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dependencies AST#identifier#Right AST#ERROR#Left... | private async resolveDependencies(dependencies: string[], context: ResolutionContext): Promise<Map<string, object>> {
const resolved = new Map<string, object>();
for (const dep of dependencies) {
const instance: object = await this.resolveInternal<object>(dep, context);
resolved.set(dep, inst... | https://github.com/DaLongZhuaZi/manxia | 0b5093f47c59962982e1f0a6f258ef1995f32f8a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getLightModeGlassRadius | 获取浅色玻璃圆角半径(与页面默认R角统一) | public getLightModeGlassRadius(): number {
return this.getGlassRadiusForLevel(GlassLevel.CARD);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLightModeGlassRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left nu... | public getLightModeGlassRadius(): number {
return this.getGlassRadiusForLevel(GlassLevel.CARD);
} | https://github.com/DaLongZhuaZi/manxia | cb80caa7cecd50636593644f21f31fd88db4eb5b | github |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets | arkts | getTotalTimeMs | 获取音乐总时间 | getTotalTimeMs() {
return this.totalTimeMs
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTotalTimeMs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | getTotalTimeMs() {
return this.totalTimeMs
} | https://gitee.com/openharmony-sig/online_event.git | f3dd02c1f8efa7b0f6e77eaf8bb45f79305aaca9 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | clearCookieCache | 清除Cookie缓存(当Cookie更新时调用)
@param sourceId 可选,指定图源ID,不指定则清除所有 | public clearCookieCache(sourceId?: number): void {
if (sourceId !== undefined) {
this.cookieCache.delete(sourceId);
logger.debug(TAG, `清除Cookie缓存: sourceId=${sourceId}`);
} else {
this.cookieCache.clear();
logger.debug(TAG, '清除所有Cookie缓存');
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearCookieCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#nu... | public clearCookieCache(sourceId?: number): void {
if (sourceId !== undefined) {
this.cookieCache.delete(sourceId);
logger.debug(TAG, `清除Cookie缓存: sourceId=${sourceId}`);
} else {
this.cookieCache.clear();
logger.debug(TAG, '清除所有Cookie缓存');
}
} | https://github.com/DaLongZhuaZi/manxia | b24646f6a2fda912cfb50a143c0a6332a0da55e0 | github |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/features/musicComment/src/main/ets/viewmodel/CommentViewModel.ets | arkts | getNewComment | Obtain the latest comment data.
@returns Comment array. | getNewComment(): Comment[] {
let commentList: Comment[] = [];
commentList.push(
new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar9')));
commentList.push(new Comment('139******92', '最爱的歌之一啦,超好听', '2021年9月4日', $r('app.media.ic_avatar10')));
commentList.push(new C... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getNewComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Comment AST#identi... | getNewComment(): Comment[] {
let commentList: Comment[] = [];
commentList.push(
new Comment('139******92', '突然发现系统自带的音乐软件那么强大', '2021年9月7日', $r('app.media.ic_avatar9')));
commentList.push(new Comment('139******92', '最爱的歌之一啦,超好听', '2021年9月4日', $r('app.media.ic_avatar10')));
commentList.push(new C... | https://gitee.com/harmonyos/codelabs.git | 99eaa865350df7bf7562b6b53657abb2ca70ebcf | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | from | Creates an Int16Array from array-like argument
@param o array-like object to initialize Int16Array
@param mapFn function to apply for each
@returns new Int16Array | public from(o: Object, mapFn: (e: Object) => short): Int16Array {
let newF: (e: Object, index: int) => short =
(e: Object, index: int): short => { return mapFn(e) }
return this.from(o, newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public from(o: Object, mapFn: (e: Object) => short): Int16Array {
let newF: (e: Object, index: int) => short =
(e: Object, index: int): short => { return mapFn(e) }
return this.from(o, newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7405213b8cc1e98c2e8a3904ff873fe6a40e63e8 | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | writeInt32 | Writes the next signed integer.
@param value The value.
@param littleEndian If the value is little endian. | writeInt32(value: number, littleEndian?: boolean): void {
this.checkWriteCapacity(4)
this.setInt32(this.mByteOffset, value, littleEndian)
this.mByteOffset += 4
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeInt32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST... | writeInt32(value: number, littleEndian?: boolean): void {
this.checkWriteCapacity(4)
this.setInt32(this.mByteOffset, value, littleEndian)
this.mByteOffset += 4
} | https://gitee.com/openharmony-sig/flutter_engine.git | 55af7a0940888e28c617da965e59f467375c8f0e | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/StatisticsService.ets | arkts | calculateRecentTrend | 计算最近7天的运动趋势 | async calculateRecentTrend(days: number = 7): Promise<DailyRecord[]> {
const records = await this.historyService.getSportRecords();
const trendData: DailyRecord[] = [];
const now = new Date();
for (let i = days - 1; i >= 0; i--) {
const date = new Date(now);
date.setDate(now.getDate() - i... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left calculateRecentTrend AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left days AST#identifier#Right AST#type_annotation#Left AST#:#L... | async calculateRecentTrend(days: number = 7): Promise<DailyRecord[]> {
const records = await this.historyService.getSportRecords();
const trendData: DailyRecord[] = [];
const now = new Date();
for (let i = days - 1; i >= 0; i--) {
const date = new Date(now);
date.setDate(now.getDate() - i... | https://gitcode.com/openharmony/codelabs | 40a7448cdba3222d2b97ef0cdb99994bb45ab324 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_minus/unary_minus_ushort.ets | arkts | main | ---
desc: check unary minus operation for unsigned short integer operand
--- | function main(): void {
const value: ushort = {{v.value}}
assert -(value) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const value: ushort = {{v.value}}
assert -(value) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f0cc2d0d275c2039dd8204fc2c55889fc4e30a19 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets | arkts | postTask | Post task to EAWorker
@param { Task } task The task to post | public postTask(task: Task):void {
if (this.isMain()) {
EAWorker.postToMain<void>(task);
return;
}
if (!this.loopStarted.get()) {
throw new Error('EAWorker:: Cannot post task when worker is not started');
}
this.worker.run<void>(task);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left postTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Task AS... | public postTask(task: Task):void {
if (this.isMain()) {
EAWorker.postToMain<void>(task);
return;
}
if (!this.loopStarted.get()) {
throw new Error('EAWorker:: Cannot post task when worker is not started');
}
this.worker.run<void>(task);
... | https://gitcode.com/iop123123/arkts-static-skills | 6564072a040a0717501a07e63cf0146057ad34ec | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/DataView.ets | arkts | constructor | Constructs view
@param buffer underlying buffer
@param byteOffset offset to start from
@throws RangeError if offset is out of array | public constructor(buffer: Buffer, byteOffset: int) {
this(buffer, byteOffset, buffer.getByteLength() - byteOffset)
} | 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 buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bu... | public constructor(buffer: Buffer, byteOffset: int) {
this(buffer, byteOffset, buffer.getByteLength() - byteOffset)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | adbcdfd6e3f859c7f8ee2bc8676f72ff5c1ddb5a | gitee |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/viewmodel/HomeViewModel.ets | arkts | updateTask | 打卡核心方法 | updateTask(task: TaskInfo): Promise<TaskInfo> {
return new Promise((resolve, reject) => {
let taskID = task.taskID;
let targetValue = task.targetValue;
let finValue = task.finValue;
let updateTask = new TaskInfo(task.id, task.date, taskID, targetValue, task.isAlarm, task.startTime,
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left updateTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | updateTask(task: TaskInfo): Promise<TaskInfo> {
return new Promise((resolve, reject) => {
let taskID = task.taskID;
let targetValue = task.targetValue;
let finValue = task.finValue;
let updateTask = new TaskInfo(task.id, task.date, taskID, targetValue, task.isAlarm, task.startTime,
... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | b8db2f07136ea98c398e0058e923f6ffc0855b86 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts byte to JSON format
@param d: byte - byte to be converted to a JSON as a Number
@returns String - JSON representation of byte | public static stringify(d: byte): String {
return StringBuilder.toString(d)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: byte): String {
return StringBuilder.toString(d)
} | https://gitcode.com/iop123123/arkts-static-skills | 05217cffc5cbe162f5e77958f7e38fec54349871 | gitcode |
PollenWang6/HiXD | entry/src/main/ets/services/ExperimentService.ets | arkts | fetchSysjScheduleWithTgc | ===== 按周拉取实验数据(需已登录) ===== | async fetchSysjScheduleWithTgc(tgc: string, onProgress?: (week: number, total: number) => void): Promise<ExperimentData[]> {
console.info(TAG, 'fetchSysjScheduleWithTgc: start');
const loggedIn = await this.loginToSysjWithTgc(tgc);
if (!loggedIn) {
throw new Error('sysj login failed with TGC');
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchSysjScheduleWithTgc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tgc AST#identifier#Right AST#type_annotation#... | async fetchSysjScheduleWithTgc(tgc: string, onProgress?: (week: number, total: number) => void): Promise<ExperimentData[]> {
console.info(TAG, 'fetchSysjScheduleWithTgc: start');
const loggedIn = await this.loginToSysjWithTgc(tgc);
if (!loggedIn) {
throw new Error('sysj login failed with TGC');
... | https://github.com/PollenWang6/HiXD | e2e2084b4494de43ef1213113e36e83246f3c088 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorGreaterThan | Checks if this BigInt is greater than another.
@param { BigInt } other The value to compare with.
@returns { boolean } True if this is greater than other, false otherwise.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorGreaterThan(other: BigInt): boolean {
if (this.positive() && other.negative()) {
return true
}
if (this.negative() && other.positive()) {
return false
}
let sub = this.operatorSubtract(other)
if (sub.negative() || sub.isZero()... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorGreaterThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public operatorGreaterThan(other: BigInt): boolean {
if (this.positive() && other.negative()) {
return true
}
if (this.negative() && other.positive()) {
return false
}
let sub = this.operatorSubtract(other)
if (sub.negative() || sub.isZero()... | https://gitcode.com/iop123123/arkts-static-skills | e09e5a190d01797cfb84ad1d7828117484417e00 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectField.ets | arkts | isReadonly | Checks if the field is readonly.
@returns { boolean } Returns true if the field is readonly; otherwise returns false. | public isReadonly(): boolean {
return (this.attributes & Attributes.READONLY) != 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isReadonly 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#bo... | public isReadonly(): boolean {
return (this.attributes & Attributes.READONLY) != 0
} | https://gitcode.com/iop123123/arkts-static-skills | 2c1b906f98609e791ba116986e786cd2d2db9cf4 | gitcode |
lidaixian999/Smart_Car | entry/src/main/ets/model/SsapManager.ets | arkts | stopScan | 停止扫描设备 | public stopScan(): Promise<void> {
return new Promise((resolve, reject) => {
if (!this.isScanning) {
const message = 'Not scanning';
hilog.warn(this.domainId, this.logTag, message);
reject(new Error(message));
return;
}
hilog.info(this.domainId, this.logTag, 'Sto... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopScan 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#instantiation_expression#Left... | public stopScan(): Promise<void> {
return new Promise((resolve, reject) => {
if (!this.isScanning) {
const message = 'Not scanning';
hilog.warn(this.domainId, this.logTag, message);
reject(new Error(message));
return;
}
hilog.info(this.domainId, this.logTag, 'Sto... | https://github.com/lidaixian999/Smart_Car | 81569941501677469f36a954b75b4434588e7ccb | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/DataRenderer.ets | arkts | getPaintRender | Returns the Paint object used for rendering.
@return | public getPaintRender(): Paint {
return this.mRenderPaint;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPaintRender 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 Paint A... | public getPaintRender(): Paint {
return this.mRenderPaint;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6972f690469cc5f0f5a75a2a5793b89514ed2713 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.