nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | 成就接口 | export interface Achievement {
id: string;
name: string;
description: string;
type: AchievementType;
rarity: AchievementRarity;
icon: string;
points: number;
requirements: AchievementRequirement[];
isUnlocked: boolean;
unlockedAt?: string;
progress: number;
maxProgress: number;
isHidden: boole... | AST#export_declaration#Left export AST#interface_declaration#Left interface Achievement AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST... | export interface Achievement {
id: string;
name: string;
description: string;
type: AchievementType;
rarity: AchievementRarity;
icon: string;
points: number;
requirements: AchievementRequirement[];
isUnlocked: boolean;
unlockedAt?: string;
progress: number;
maxProgress: number;
isHidden: boole... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L92-L107 | 80e98bf86ce24d052bcf3d990cc4732312780181 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets | arkts | loadContactDetail | 加载联系人详情 | private async loadContactDetail(): Promise<void> {
try {
this.loading = true;
// 加载联系人信息
this.contact = await this.contactService.getContactById(this.contactId);
if (this.contact) {
// 加载祝福语历史
this.greetingHistory = await this.greetingService.getGreetingHistory(... | AST#method_declaration#Left private async loadContactDetail AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right >... | private async loadContactDetail(): Promise<void> {
try {
this.loading = true;
this.contact = await this.contactService.getContactById(this.contactId);
if (this.contact) {
this.greetingHistory = await this.greetingService.getGreetingHistory(this.contactId, 10);... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L52-L68 | 4eafbe7aebfd05534d106212c392c0d394c66963 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/collapsemenu/src/main/ets/utils/CollapseMenuSection.ets | arkts | CollapseMenuSection | 功能描述:
1. 进入页面,呈现面板列表,点击普通面板,跳转到对应文章的网页。
2. 点击折叠面板,面板展开,再次点击,面板收起。
实现原理:
1. 使用List组件遍历折叠面板数据,如果数据含有children数据,使用ListGroup进行二次遍历渲染。(当前场景只支持嵌套层次为两级,多层级待扩展)
2. 点击ListGroup的header组件以及visibility来控制子列表的显示和隐藏。
@param {ArticleNode[]} articleNodes - 折叠面板列表数据
@param {(articleNode: ArticleNode)=>void} articleItemBuilder - 列表项视图
... | @Component
export struct CollapseMenuSection {
// ------------对外暴露变量------------
// 折叠面板列表数据
articleNodes: TreeNode[] = [];
// 列表项视图
@BuilderParam articleItemBuilder: (articleNode: TreeNode) => void;
// 列表项逻辑处理
@BuilderParam articleHeaderBuilder: (articleNode: TreeNode) => void;
// -------------私有变量----... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CollapseMenuSection AST#component_body#Left { // ------------对外暴露变量------------ // 折叠面板列表数据 AST#property_declaration#Left articleNodes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TreeNode [ ] ... | @Component
export struct CollapseMenuSection {
articleNodes: TreeNode[] = [];
@BuilderParam articleItemBuilder: (articleNode: TreeNode) => void;
@BuilderParam articleHeaderBuilder: (articleNode: TreeNode) => void;
@Provide articleSource: ArticleSource<TreeNode> = new ArticleSource();
aboutT... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/collapsemenu/src/main/ets/utils/CollapseMenuSection.ets#L36-L95 | 8c7ae8482d26dc2a60d296fb9e51b214c5fabb43 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/DatabaseService.ets | arkts | insert | 插入数据
@param tableName 表名
@param data 数据对象
@returns 插入的行ID | async insert(tableName: string, data: Record<string, relationalStore.ValueType>): Promise<number> {
try {
this.checkInitialized();
const valueBucket: relationalStore.ValuesBucket = {};
const dataEntries: [string, relationalStore.ValueType][] = Object.entries(data);
for (let i = 0; i <... | AST#method_declaration#Left async insert AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Re... | async insert(tableName: string, data: Record<string, relationalStore.ValueType>): Promise<number> {
try {
this.checkInitialized();
const valueBucket: relationalStore.ValuesBucket = {};
const dataEntries: [string, relationalStore.ValueType][] = Object.entries(data);
for (let i = 0; i <... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/DatabaseService.ets#L210-L238 | 235caafc19eb38aad5decc8a4d298b2c44210122 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/util/TimeTools.ets | arkts | 视频时长转换
@param time 视频总时长
@returns 返回值为时:分:秒形式 | export function getTimeString(time: number) {
if (time === -1 || time === undefined) {
time = 0;
}
const TIMESTAMP: number = 1000;
const TIME_UNIT: number = 60;
const MAX_HOURS: number = 24;
let hour = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT * MAX_HOURS) / (TIMESTAMP * TIME_UNIT * TIME_UNIT... | AST#export_declaration#Left export AST#function_declaration#Left function getTimeString AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST... | export function getTimeString(time: number) {
if (time === -1 || time === undefined) {
time = 0;
}
const TIMESTAMP: number = 1000;
const TIME_UNIT: number = 60;
const MAX_HOURS: number = 24;
let hour = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT * MAX_HOURS) / (TIMESTAMP * TIME_UNIT * TIME_UNIT... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/util/TimeTools.ets#L33-L47 | 0f39d884dfa1835a3a158739ace503f4a97189b3 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuildChannel.ets | arkts | 根据约束18,在类中声明字段而非构造函数参数 | constructor(client: any, data: GuildChannelData) {
// 根据约束67,使用标准属性赋值代替Object.defineProperty
this.client = client;
this.setup(data);
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left GuildChannelData AST#prima... | constructor(client: any, data: GuildChannelData) {
this.client = client;
this.setup(data);
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/PartialGuildChannel.ets#L20-L24 | 87982d758239d9e19e5ac840c0601374e6998cc6 | github | |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/ContactPage.ets | arkts | onPageShow | 页面显示时刷新 | onPageShow() {
console.log('页面显示,刷新数据');
this.loadFriendList();
} | AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_express... | onPageShow() {
console.log('页面显示,刷新数据');
this.loadFriendList();
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/ContactPage.ets#L43-L46 | 21497d2489baec4e9e2c4b8c0556168f7bd864ec | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/game/VirtualShopPage.ets | arkts | buildTabBar | 构建标签栏 | @Builder
buildTabBar() {
Scroll() {
Row({ space: 0 }) {
ForEach(this.tabs, (tab) => {
Column({ space: 4 }) {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedCategory === tab.id ? $r('app.colo... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
buildTabBar() {
Scroll() {
Row({ space: 0 }) {
ForEach(this.tabs, (tab) => {
Column({ space: 4 }) {
Image($r(`app.media.ic_${tab.icon}`))
.width('20vp')
.height('20vp')
.fillColor(this.selectedCategory === tab.id ? $r('app.colo... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/game/VirtualShopPage.ets#L205-L243 | e9ebf46e26eaa0fb5a84729a4da826f60da3ef52 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.TreeView.d.ets | arkts | Declare TreeController
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare TreeController
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export declare class TreeController {
/**
* Delete a node.
* Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Delete a node.
* Register an ON_ITEM... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TreeController AST#class_body#Left { /**
* Delete a node.
* Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes.
* @syscap SystemCapabil... | export declare class TreeController {
removeNode(): void;
modifyNode(): void;
addNode(nodeParam?: NodeParam): TreeController;
refreshNode(parentId: number, parentSubTitle: ResourceStr, currentSubtitle: ResourceStr): void;
buildDone(): void;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L499-L600 | c515015e111059659f953b8d34b255e4a87efa93 | gitee | |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/util/PixelMapResizer.ets | arkts | 像素图尺寸调整器,规则参考了标准钉,综合屏幕尺寸、原图尺寸比例、原图参数调整最终生成图尺寸 | export class PixelMapResizer {
private constructor() {
}
static async resize(pixelMap: PixelMap, option: PixelMapResizerOption): Promise<PixelMap> {
if (!pixelMap || !option) {
Logger.w(MODULE, TAG, 'resize param error!');
return pixelMap;
}
if (option.screenSize.width <= 0 || option.scr... | AST#export_declaration#Left export AST#class_declaration#Left class PixelMapResizer AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declarat... | export class PixelMapResizer {
private constructor() {
}
static async resize(pixelMap: PixelMap, option: PixelMapResizerOption): Promise<PixelMap> {
if (!pixelMap || !option) {
Logger.w(MODULE, TAG, 'resize param error!');
return pixelMap;
}
if (option.screenSize.width <= 0 || option.scr... | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/PixelMapResizer.ets#L46-L94 | d46bf842787973295163c5527dd719108faf62ae | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets | arkts | onWindowStageCreate | [EndExclude save_the_uiContext_to_localstorage_in_entry_ability] | onWindowStageCreate(windowStage: window.WindowStage) {
windowStage.loadContent('pages/Index', this.storage, (err, data) => {
if (err.code) {
return;
}
this.storage.setOrCreate<UIContext>('uiContext', windowStage.getMainWindowSync().getUIContext());
});
} | AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | onWindowStageCreate(windowStage: window.WindowStage) {
windowStage.loadContent('pages/Index', this.storage, (err, data) => {
if (err.code) {
return;
}
this.storage.setOrCreate<UIContext>('uiContext', windowStage.getMainWindowSync().getUIContext());
});
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L37-L45 | 45e93ca47b3bd375b8824be6bf667ba8e9dc27e9 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/ArkState.ets | arkts | Defines the subscribed abstract property.
@since 7
@systemapi | export interface SubscribedAbstractProperty<T> extends AbstractProperty<T> {
subscribe(listener: () => void): void
unsubscribe(listener: () => void): void
/**
* An app needs to call this function before the instance of SubscribedAbstractProperty
* goes out of scope / is subject to garbage collect... | AST#export_declaration#Left export AST#interface_declaration#Left interface SubscribedAbstractProperty AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#extends_clause#Left extends AST#generic_type#Left AbstractProperty AST#type_arguments#Left < AST#type_annot... | export interface SubscribedAbstractProperty<T> extends AbstractProperty<T> {
subscribe(listener: () => void): void
unsubscribe(listener: () => void): void
aboutToBeDeleted(): void
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/ArkState.ets#L42-L57 | 54774c6a9a81cd8fe3f8b7d6bdd2c5587fc9e7d9 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets | arkts | i2cSM2 | C1C2C3格式的字符串转换成ASN.1格式的字符
@param primal_data C1C2C3格式的字符
@returns ASN.1格式的字符 | i2cSM2(primal_data: string): string {
let sm2_sequence = new SM2Sequence();
sm2_sequence.C1x = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C1y = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C3 ... | AST#method_declaration#Left i2cSM2 AST#parameter_list#Left ( AST#parameter#Left primal_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | i2cSM2(primal_data: string): string {
let sm2_sequence = new SM2Sequence();
sm2_sequence.C1x = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C1y = primal_data.slice(0, 64);
primal_data = primal_data.slice(64, primal_data.length);
sm2_sequence.C3 ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L76-L97 | 009957bef89275ef08d036ccfe66b617be0dcc65 | gitee |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSMultiPictureUI/entry/src/main/ets/entryability/EntryAbility.ets | arkts | updateBreakpoint | 变更设备类型 | private updateBreakpoint(windowWidth: number) :void{
let windowWidthVp = 0;
try {
windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels;
} catch (error) {
hilog.error(0x0000, 'testTag', 'Cause: %{public}s', JSON.stringify(error) ?? '');
}
let curBp: string = '';
... | AST#method_declaration#Left private updateBreakpoint AST#parameter_list#Left ( AST#parameter#Left windowWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#... | private updateBreakpoint(windowWidth: number) :void{
let windowWidthVp = 0;
try {
windowWidthVp = windowWidth / display.getDefaultDisplaySync().densityPixels;
} catch (error) {
hilog.error(0x0000, 'testTag', 'Cause: %{public}s', JSON.stringify(error) ?? '');
}
let curBp: string = '';
... | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPictureUI/entry/src/main/ets/entryability/EntryAbility.ets#L46-L62 | a501a8d1039364c59ee0bc8f9a649866388364a9 | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/DatePickerBuilderProxy.ets | arkts | end | 范围选择 - 结束时间
@param date
@returns | end(date: Date) {
this.builderOptions.end = date
return this
} | AST#method_declaration#Left end AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expressi... | end(date: Date) {
this.builderOptions.end = date
return this
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/DatePickerBuilderProxy.ets#L46-L49 | c965d236efd1ad6ab1d25c65985b1f4cc45765e9 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/UserState.ets | arkts | persist | 持久化当前用户状态
@returns {void} 无返回值 | private persist(): void {
PersistenceV2.save(USER_STATE_KEY);
} | AST#method_declaration#Left private persist AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressi... | private persist(): void {
PersistenceV2.save(USER_STATE_KEY);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/UserState.ets#L170-L172 | cc0c9c449d32cbfc9b753ad539937d354999567c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/lunar/OnlineLunarService.ets | arkts | setCache | 设置缓存数据 | private setCache(key: string, data: OnlineLunarDate | OnlineLunarYear): void {
this.cache.set(key, {
data: data,
timestamp: Date.now()
});
} | AST#method_declaration#Left private setCache AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Online... | private setCache(key: string, data: OnlineLunarDate | OnlineLunarYear): void {
this.cache.set(key, {
data: data,
timestamp: Date.now()
});
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/OnlineLunarService.ets#L165-L170 | dbe2f76c47d3077862b5925578ca1309260aa0bd | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringUtils.ets | arkts | containsPunctuations | 是否包含标点符号
@param str 输入字符串
@returns 是否包含 | static containsPunctuations(str: string): boolean {
const chars = Array.from(str);
for (const c of chars) {
if (punkMarks.has(c)) {
return true;
}
}
return false;
} | AST#method_declaration#Left static containsPunctuations AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#pr... | static containsPunctuations(str: string): boolean {
const chars = Array.from(str);
for (const c of chars) {
if (punkMarks.has(c)) {
return true;
}
}
return false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringUtils.ets#L58-L66 | 57c5b2027c46de2e3e7f0b2ab04f31c18ddd24a2 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/BindSheet/entry/src/main/ets/utils/ComponentAttrUtils.ets | arkts | getRectInfoById | 根据组件的id获取组件的位置信息 | public static getRectInfoById(context: UIContext, id: string): RectInfoInPx {
if (!context || !id) {
throw Error('object is empty');
}
let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id);
if (!componentInfo) {
throw Error('object is empty');
... | AST#method_declaration#Left public static getRectInfoById AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string A... | public static getRectInfoById(context: UIContext, id: string): RectInfoInPx {
if (!context || !id) {
throw Error('object is empty');
}
let componentInfo: componentUtils.ComponentInfo = context.getComponentUtils().getRectangleById(id);
if (!componentInfo) {
throw Error('object is empty');
... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/BindSheet/entry/src/main/ets/utils/ComponentAttrUtils.ets#L21-L50 | ec8207cc18720f0ae722dc5ed641fb5052a8d95a | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceSearch.d.ets | arkts | Defines the SearchButton parameters.
@typedef SearchButtonParams
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 18 | export interface SearchButtonParams {
/**
* Indicates the text of the search button.
*
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/
searchButtonValue: ResourceStr;
/**
* Indicates the fontSize and fontColor of the search button.
*
... | AST#export_declaration#Left export AST#interface_declaration#Left interface SearchButtonParams AST#object_type#Left { /**
* Indicates the text of the search button.
*
* @type { ResourceStr }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 18
*/ AST#type_member#Left searchButto... | export interface SearchButtonParams {
searchButtonValue: ResourceStr;
options?: SearchButtonOptions;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceSearch.d.ets#L100-L119 | eb56a8990d041340c5ee0d5c0ceab1a9f6c1d1c1 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/Logger.ets | arkts | debug | debug级别日志【入参为两个字符串,第一个为提示消息,第二个为错误原因】
@param args 错误信息 | static debug(...args: string[]): void {
let content: string = args.join();
if (content.length <= Logger.maxSize) {
// 长度小于等于限制直接打印
hilog.debug(Logger.domain, Logger.prefix, Logger.format, args);
} else {
// 循环分段打印
let newPrefix = Logger.prefix + "[" + IdUtil.randomUUID() + "]"
... | AST#method_declaration#Left static debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | static debug(...args: string[]): void {
let content: string = args.join();
if (content.length <= Logger.maxSize) {
hilog.debug(Logger.domain, Logger.prefix, Logger.format, args);
} else {
let newPrefix = Logger.prefix + "[" + IdUtil.randomUUID() + "]"
while (content.length > ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Logger.ets#L69-L85 | 9e1ac8f8c6202decda4a27bff514a61d67fb5d60 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | setupStaticShortcuts | 设置静态快捷方式 | private async setupStaticShortcuts(): Promise<void> {
// 静态快捷方式在module.json5中配置,这里记录配置信息
const staticShortcuts: ShortcutConfig[] = [
{
id: 'add_contact',
type: ShortcutType.ADD_CONTACT,
label: '添加联系人',
description: '快速添加新的联系人',
icon: 'ic_add_person',
targetP... | AST#method_declaration#Left private async setupStaticShortcuts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Righ... | private async setupStaticShortcuts(): Promise<void> {
const staticShortcuts: ShortcutConfig[] = [
{
id: 'add_contact',
type: ShortcutType.ADD_CONTACT,
label: '添加联系人',
description: '快速添加新的联系人',
icon: 'ic_add_person',
targetPage: 'pages/contact/AddContactPage... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L77-L108 | 32973c9ced624ceabcdca9f176ba2f9fadf2272c | github |
zhuanyongtester/Cpay_arkts.git | 4402a8a06963d0757952513d3cbf7d5919ceb74f | entry/src/main/ets/utils/DetailData.ets | arkts | 模拟评论数据 | export function mockData(): CommentData {
const commentList: CommentData = new CommentData();
commentList.pushData(new CommentModel("1", $r('app.media.music'), '你若安好便是晴天', '', '', '和描述相符很喜欢,做工细致,颜色好看,原装正品', new Date('2024-11-01 23:00:00'), new CommentData()))
commentList.pushData(new CommentModel("2", $r('app.me... | AST#export_declaration#Left export AST#function_declaration#Left function mockData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommentData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Lef... | export function mockData(): CommentData {
const commentList: CommentData = new CommentData();
commentList.pushData(new CommentModel("1", $r('app.media.music'), '你若安好便是晴天', '', '', '和描述相符很喜欢,做工细致,颜色好看,原装正品', new Date('2024-11-01 23:00:00'), new CommentData()))
commentList.pushData(new CommentModel("2", $r('app.me... | https://github.com/zhuanyongtester/Cpay_arkts.git/blob/4402a8a06963d0757952513d3cbf7d5919ceb74f/entry/src/main/ets/utils/DetailData.ets#L19-L32 | cfc872a51bb4df1baa22978b35a0a890492567b8 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets | arkts | notifyDataMove | 通知LazyForEach组件将from索引和to索引处的子组件进行交换
@param {number} from - 起始值。
@param {number} to - 终点值。 | notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right... | notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => {
listener.onDataMove(from, to);
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/components/MonthDataSource.ets#L107-L111 | b8dd6e98dad772d31eab19ba6392038b902f0716 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets | arkts | VideoListAutoplayComponent | 视频列表权重
功能描述: 利用onScrollIndex获取List显示区域内中间子组件索引值的能力来判断播放,利用懒加载场景会预加载List显示区域外cachedCount的内容的能力来实现视频连续播放的功能。
推荐场景:视频列表滑动到屏幕中间自动播放场景
核心组件:
1. XComponentVideo
实现步骤:
1.首先加载图片,使用Stack将Image覆盖在XComponent上,并使用visibility来控制图片的显示。
2.使用LoadingProgress来表示视频正在加载中,当AVPlayer走到playing隐藏LoadingProgress。
3.使用onScrollIndex来获取List显示区域... | @Component
export struct VideoListAutoplayComponent {
@State currentIndex: TabBarType = TabBarType.DISCOVER; // Tab组件当前选中index值
private newsList: NewsListDataSource = new NewsListDataSource(); // 视频信息集合
@Provide isLoading: boolean = true; // 视频是否加载中
@State centerIndex: number = -1; // List显示区域内中间子组件索引值
@Stora... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoListAutoplayComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_ty... | @Component
export struct VideoListAutoplayComponent {
@State currentIndex: TabBarType = TabBarType.DISCOVER;
private newsList: NewsListDataSource = new NewsListDataSource();
@Provide isLoading: boolean = true;
@State centerIndex: number = -1;
@StorageLink('avoidAreaTopToModule') avoidAreaTopToModule: numb... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/VideoListAutoplay.ets#L42-L190 | 58676d7a22a7fa60a9501ba5fff1bd78c7f0b7cb | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | Generic empty checker for strings and arrays.
@param val Any value.
@returns Whether the value is considered empty. | export function isEmpty(val: ESObject): boolean {
if (val === null || val === undefined) {
return true;
}
if (typeof val === 'string') {
return val.length === 0;
}
if (Array.isArray(val)) {
return val.length === 0;
}
return false;
} | AST#export_declaration#Left export AST#function_declaration#Left function isEmpty AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim... | export function isEmpty(val: ESObject): boolean {
if (val === null || val === undefined) {
return true;
}
if (typeof val === 'string') {
return val.length === 0;
}
if (Array.isArray(val)) {
return val.length === 0;
}
return false;
} | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/utils/CommonUtils.ets#L28-L39 | e22228b0bebabaa0c1d5786df125790af58326c1 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | zoom | Post-scales by the specified scale factors.
@param scaleX
@param scaleY
@return | public zoom(scaleX: number, scaleY: number, x?: number, y?: number, outputMatrix?: Matrix): Matrix | void {
let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix();
save.reset();
save.set(this.mMatrixTouch);
if (x != undefined && x != null && y != undefined ... | AST#method_declaration#Left public zoom AST#parameter_list#Left ( AST#parameter#Left scaleX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left scaleY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri... | public zoom(scaleX: number, scaleY: number, x?: number, y?: number, outputMatrix?: Matrix): Matrix | void {
let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix();
save.reset();
save.set(this.mMatrixTouch);
if (x != undefined && x != null && y != undefined ... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ViewPortHandler.ets#L230-L243 | d87f6fdde27c56fdd173a2303682bf3135c54519 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/strings/StringEncrypt.ets | arkts | 字符串扩展工具类
提供Base64编码/解码和加盐/去盐功能 | export class StringEncoder {
/**
* 将字符串进行Base64编码
* @param str 要编码的字符串
* @returns Base64编码后的字符串或null
*/
static encodedToBase64(str: string | null): string | null {
return new Base64Encoder(str).encodedString();
}
/**
* 将Base64字符串解码
* @param str Base64编码的字符串
* @returns 解码后的原始字符串或null
... | AST#export_declaration#Left export AST#class_declaration#Left class StringEncoder AST#class_body#Left { /**
* 将字符串进行Base64编码
* @param str 要编码的字符串
* @returns Base64编码后的字符串或null
*/ AST#method_declaration#Left static encodedToBase64 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AS... | export class StringEncoder {
static encodedToBase64(str: string | null): string | null {
return new Base64Encoder(str).encodedString();
}
static decodedFromBase64(str: string | null): string | null {
return new Base64Encoder(str).decodedString();
}
static addedSalt(str: string | null): stri... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L9-L65 | 2006cda898f15de164e84b225ff1317ebadf6ae3 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.Dialog.d.ets | arkts | CustomContentDialog | Declare custom content dialog
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | @CustomDialog
export declare struct CustomContentDialog {
/**
* Sets the CustomContentDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
controller: CustomDialogController;
/**
* Sets the Custo... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct CustomContentDialog AST#component_body#Left { /**
* Sets the CustomContentDialog Controller.
* @type { CustomDialogController }.
* @syscap SystemCapability.ArkUI.ArkU... | @CustomDialog
export declare struct CustomContentDialog {
controller: CustomDialogController;
primaryTitle?: ResourceStr;
secondaryTitle?: ResourceStr;
@BuilderParam contentBuilder: () => void;
contentAreaPadding?: Padding;
localizedContentAreaPadding?: LocalizedPadding;
buttons?: But... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Dialog.d.ets#L1086-L1171 | 4cd45d96ca6880399f4b59e11ae0a01b7881a751 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | delete_old_temp_files | Deletes old temp directories. (They are all moved to tempDir after Nov. 4, 2025) | function delete_old_temp_files(context: common.UIAbilityContext) {
try {
if (fileIo.accessSync(context.filesDir + '/web-drag-image-cache')) {
fileIo.rmdirSync(context.filesDir + '/web-drag-image-cache');
fileIo.rmdirSync(context.filesDir + '/downloads');
fileIo.rmdirSync(context.filesDir + '/har... | AST#function_declaration#Left function delete_old_temp_files AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramet... | function delete_old_temp_files(context: common.UIAbilityContext) {
try {
if (fileIo.accessSync(context.filesDir + '/web-drag-image-cache')) {
fileIo.rmdirSync(context.filesDir + '/web-drag-image-cache');
fileIo.rmdirSync(context.filesDir + '/downloads');
fileIo.rmdirSync(context.filesDir + '/har... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L233-L243 | 7196a114972991d4eca868a3225e3a94b65f386c | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/ScreenUtils.ets | arkts | getScreenHeight | 获取屏幕高度 | static getScreenHeight(): number {
return ScreenUtils.getScreenInfo().height;
} | AST#method_declaration#Left static getScreenHeight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_e... | static getScreenHeight(): number {
return ScreenUtils.getScreenInfo().height;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/ScreenUtils.ets#L31-L33 | 82afcbbf837fe736a21a4edb364c89b89e9ecad0 | github |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/service/Index.ets | arkts | @description: 根据token获取用户信息
@date: 2023-12-1 23:39
@author wuwenqiang | export const getUserDataService = (token:string):Promise<types.MyAwesomeData<types.UserDataType>>=> {
httpRequest.setToken(token);
return httpRequest.get<types.UserDataType>(api.getUserData);
}
/**
* @description: 注册
* @date: 2024-01-21 14:48
* @author wuwenqiang
*/ | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left getUserDataService = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right... | export const getUserDataService = (token:string):Promise<types.MyAwesomeData<types.UserDataType>>=> {
httpRequest.setToken(token);
return httpRequest.get<types.UserDataType>(api.getUserData);
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/service/Index.ets#L10-L19 | 090a2072b240ed27027d588a20ab2348e5e29091 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets | arkts | 单例模型私有化构造函数,使用getInstance静态方法获得单例 | private constructor() {
} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | private constructor() {
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/PermissionModel.ets#L24-L25 | 956c4a052b056d4ec23be04f9cfe36baccbef2dc | gitee | |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/SettingsStorage.ets | arkts | 震感反馈设置 | export async function getVibrationEnabled(): Promise<boolean> {
const settings = getSettingsInstance();
// true = 开, false = 关
return (await settings.get("vibrationON", true)) as boolean;
} | AST#export_declaration#Left export AST#function_declaration#Left async function getVibrationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#pri... | export async function getVibrationEnabled(): Promise<boolean> {
const settings = getSettingsInstance();
return (await settings.get("vibrationON", true)) as boolean;
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/SettingsStorage.ets#L35-L39 | e7d2ccd6dfedac0bcb14eb846d5e0aa65e903c89 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/otherCharts/CandlestickChartPage.ets | arkts | menuCallback | 标题栏菜单回调 | @Monitor("titleModel.index")
menuCallback() {
if (this.titleModel == null || this.titleModel == undefined) {
return
}
let index: number = this.titleModel.getIndex()
if (index == undefined || index == -1) {
return
}
if (this.model == null || this.model == undefined) {
return... | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST... | @Monitor("titleModel.index")
menuCallback() {
if (this.titleModel == null || this.titleModel == undefined) {
return
}
let index: number = this.titleModel.getIndex()
if (index == undefined || index == -1) {
return
}
if (this.model == null || this.model == undefined) {
return... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/otherCharts/CandlestickChartPage.ets#L63-L91 | d46e79e33c3a1fd2250b34169c761726628af7e5 | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/TaskService.ets | arkts | 任务管理服务类
提供任务的增删改查、启动、结束、上传等功能 | export class TaskService {
/**
* 获取任务列表
* @param params 分页和筛选参数
* @returns 任务列表数据
*/
static async listTask(params: PageParam): Promise<TableDataInfo<AgvTask>> {
try {
console.info('[TaskService] 🔍 获取任务列表,参数:', JSON.stringify(params));
let queryString = `pageNum=${params.pageNu... | AST#export_declaration#Left export AST#class_declaration#Left class TaskService AST#class_body#Left { /**
* 获取任务列表
* @param params 分页和筛选参数
* @returns 任务列表数据
*/ AST#method_declaration#Left static async listTask AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Le... | export class TaskService {
static async listTask(params: PageParam): Promise<TableDataInfo<AgvTask>> {
try {
console.info('[TaskService] 🔍 获取任务列表,参数:', JSON.stringify(params));
let queryString = `pageNum=${params.pageNum}&pageSize=${params.pageSize}`;
if (params.taskCode) qu... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/TaskService.ets#L53-L105 | 2812676f76271350c6181ecb753d1ec4f6bee443 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Subscription/IndexSubscription.ets | arkts | IndexSubscription | import router from '@ohos.router'; // 引入路由管理器 | @Component
export default struct IndexSubscription {
MoreList: string[] = ['粘贴导入', '网络导入', '本地导入', '新建订阅', '新建分组', '批量管理']
NovelList: string[] = ['起点中文网', '小说']
CartoonList: string[] = ['卡通']
CollectList: string[] = ['起点中文网', '收藏', '收藏', '收藏']
@State SearchValue: string = ""
@State ShowEditManage: Boolean ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct IndexSubscription AST#component_body#Left { AST#ERROR#Left MoreList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotati... | @Component
export default struct IndexSubscription {
MoreList: string[] = ['粘贴导入', '网络导入', '本地导入', '新建订阅', '新建分组', '批量管理']
NovelList: string[] = ['起点中文网', '小说']
CartoonList: string[] = ['卡通']
CollectList: string[] = ['起点中文网', '收藏', '收藏', '收藏']
@State SearchValue: string = ""
@State ShowEditManage: Boolean ... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Subscription/IndexSubscription.ets#L3-L350 | a1a949396d3f5c8553a0759d0ee4442ff0b82b65 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/components/dialog/BookManageDialog.ets | arkts | BookManageDialog | 分组页面单击跳转页面 | @Component
export default struct BookManageDialog {
@Prop currentIndex: number
@State EXHIBIT: string = '标签'
@Prop title:string
@Prop bookTypeNumber:number
@StorageLink('topRectHeight') topRectHeight: number = 0
@StorageLink('bottomRectHeight') bottomRectHeight: number = 0
@State isAddShelfShow:boolean =... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct BookManageDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Righ... | @Component
export default struct BookManageDialog {
@Prop currentIndex: number
@State EXHIBIT: string = '标签'
@Prop title:string
@Prop bookTypeNumber:number
@StorageLink('topRectHeight') topRectHeight: number = 0
@StorageLink('bottomRectHeight') bottomRectHeight: number = 0
@State isAddShelfShow:boolean =... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/components/dialog/BookManageDialog.ets#L30-L97 | acdc32a1df7985edef603f11518fcb5885dcd8cd | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | notifyDataAdd | 通知LazyForEach组件需要在index对应索引处添加子组件函数
@param index | private notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
} | AST#method_declaration#Left private notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | private notifyDataAdd(index: number): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L135-L139 | a4a517e0126d0dfe99a1c494eb79578e7f5fc7ee | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | reqCameraPermission | 检测是否有相机权限,未授权尝试申请授权
@returns {Promise<boolean>} 相机权限/授权结果 | async reqCameraPermission(): Promise<boolean> {
const reqPermissionName = CommonConstants.PERMISSION_CAMERA;
// 优先检测是否已授权
let isGranted = await this.permissionModel.checkPermission(reqPermissionName);
if (isGranted) {
return true;
}
// 没有授权申请授权
isGranted = await this.permissionModel.re... | AST#method_declaration#Left async reqCameraPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AS... | async reqCameraPermission(): Promise<boolean> {
const reqPermissionName = CommonConstants.PERMISSION_CAMERA;
let isGranted = await this.permissionModel.checkPermission(reqPermissionName);
if (isGranted) {
return true;
}
isGranted = await this.permissionModel.requestPermission(reqPerm... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L139-L149 | f5f87f962fec1126cffd2d125d10ce4192564873 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/ButtonUtil.ets | arkts | buildFunctionBtn | 场景按钮UI
@param params 场景类型参数
@param callBack 按钮回调函数
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | @Builder
function buildFunctionBtn(params: functionalButtonComponentManager.FunctionalButtonParams,
callBack: (data: string) => void) {
if (params.openType === functionalButtonComponentManager.OpenType.GET_PHONE_NUMBER) {
//快速验证手机号
FunctionalButton({
params: params,
controller: new functionalBu... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildFunctionBtn AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left functionalButtonComponentManager . FunctionalButtonParams AST#qualified_type#Rig... | @Builder
function buildFunctionBtn(params: functionalButtonComponentManager.FunctionalButtonParams,
callBack: (data: string) => void) {
if (params.openType === functionalButtonComponentManager.OpenType.GET_PHONE_NUMBER) {
FunctionalButton({
params: params,
controller: new functionalButtonCompo... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/ButtonUtil.ets#L27-L189 | 0b21d082703199cf062b526aca097d9bb848948b | gitee |
Nuist666/Alzheimer.git | c171b8e739357bfc5a3fc71c90aaea6ce5d463d1 | entry/src/main/ets/pages/Register.ets | arkts | registerclick | 能否获取验证码 | registerclick(){
router.pushUrl({ url: 'pages/Registersuccess' })
} | AST#method_declaration#Left registerclick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl AST#member_e... | registerclick(){
router.pushUrl({ url: 'pages/Registersuccess' })
} | https://github.com/Nuist666/Alzheimer.git/blob/c171b8e739357bfc5a3fc71c90aaea6ce5d463d1/entry/src/main/ets/pages/Register.ets#L10-L12 | df073232c85e90becd5777524c3efb7e140204c1 | github |
ericple/ohos-weather | f197791bce462c5eb1b22945c25f5bcd5fcc9f7c | libNMC/src/main/ets/Data/WeatherDaily.ets | arkts | This file is part of libNMC, which is the foundation of ohos-weather. Copyright (C) 2023 Tingjin<dev@peercat.cn> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (... | export interface WeatherDaily {
fxDate: string;
sunrise: string;
sunset: string;
moonrise: string;
moonset: string;
moonPhase: string;
moonPhaseIcon: string;
tempMax: string;
tempMin: string;
iconDay: string;
textDay: string;
iconNight: string;
textNight: string;
wind360Day: string;
windDi... | AST#export_declaration#Left export AST#interface_declaration#Left interface WeatherDaily AST#object_type#Left { AST#type_member#Left fxDate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left sunrise : AST#type_annotation#... | export interface WeatherDaily {
fxDate: string;
sunrise: string;
sunset: string;
moonrise: string;
moonset: string;
moonPhase: string;
moonPhaseIcon: string;
tempMax: string;
tempMin: string;
iconDay: string;
textDay: string;
iconNight: string;
textNight: string;
wind360Day: string;
windDi... | https://github.com/ericple/ohos-weather/blob/f197791bce462c5eb1b22945c25f5bcd5fcc9f7c/libNMC/src/main/ets/Data/WeatherDaily.ets#L16-L43 | 6aa017359069e4d2406f67e2a239cddf9cd37777 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryInfoUtil.ets | arkts | getBatterySOC | 获取当前设备剩余电池电量百分比 | public getBatterySOC(): string {
let soc: number = this.disposeBatterySOC(batteryInfo.batterySOC)
logger.info(`${this.TAG} getChargingStatus: ${soc}`)
return soc.toString()
} | AST#method_declaration#Left public getBatterySOC AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left soc ... | public getBatterySOC(): string {
let soc: number = this.disposeBatterySOC(batteryInfo.batterySOC)
logger.info(`${this.TAG} getChargingStatus: ${soc}`)
return soc.toString()
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryInfoUtil.ets#L63-L67 | 248519b3338d807b8efd8811fea4505fd91d93f2 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | 65% 百分比 | export const P65: string = "65%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P65 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "65%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right... | export const P65: string = "65%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L74-L74 | 7bdb175d0624a3fe4f86131ac254a2857b84df40 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/lyric/LyricConst.ets | arkts | Lyrics initial position | export const enum LyricTopPosition {
Top,
Middle,
} | AST#export_declaration#Left export AST#enum_declaration#Left const enum LyricTopPosition AST#enum_body#Left { AST#enum_member#Left Top AST#enum_member#Right , AST#enum_member#Left Middle AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right | export const enum LyricTopPosition {
Top,
Middle,
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MusicHome-master/features/musicList/src/main/ets/lyric/LyricConst.ets#L44-L47 | 3ae26df0babfb02b8c4b9dc87448709d7415a8e9 | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | initializeOfflineManager | 初始化离线管理系统 | private initializeOfflineManager(): void {
try {
const offlineManager = SimpleOfflineManager.getInstance();
hilog.info(0x0000, 'EntryAbility', 'Offline manager initialized successfully');
} catch (error) {
hilog.error(0x0000, 'EntryAbility', 'Failed to initialize offline manager: %{public}s', ... | AST#method_declaration#Left private initializeOfflineManager AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST... | private initializeOfflineManager(): void {
try {
const offlineManager = SimpleOfflineManager.getInstance();
hilog.info(0x0000, 'EntryAbility', 'Offline manager initialized successfully');
} catch (error) {
hilog.error(0x0000, 'EntryAbility', 'Failed to initialize offline manager: %{public}s', ... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/entryability/EntryAbility.ets#L54-L61 | 539ae84b51e4da3a43fe5e94676260e881d080e2 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/closure_function/closure_function_002_F.ets | arkts | Introduction 闭包 | export function closure_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let z2 = f();
z2(_clean);
} | AST#export_declaration#Left export AST#function_declaration#Left function closure_function_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function closure_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let z2 = f();
z2(_clean);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/closure_function/closure_function_002_F.ets#L6-L11 | 3db11d8a346e51f3ae8ab4be3e3c7411f6048612 | github | |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/DimensionUtils.ets | arkts | adaptDimension | 获取屏幕水平适配值。
@param value 需要适配的值
@return 适配后的值 | static adaptDimension(value: number): number {
let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display;
let widthScale = deviceDisplay.width / DESIGN_WIDTH;
let virtualHeight = widthScale * DESIGN_HEIGHT;
let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN... | AST#method_declaration#Left static adaptDimension AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | static adaptDimension(value: number): number {
let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display;
let widthScale = deviceDisplay.width / DESIGN_WIDTH;
let virtualHeight = widthScale * DESIGN_HEIGHT;
let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESIGN... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/DimensionUtils.ets#L26-L33 | d5d275e892e8f0e5c355a52463c039d13b8c5b50 | github |
didi/dimina.git | 7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2 | harmony/dimina/src/main/ets/Utils/DMPContextUtils.ets | arkts | 因为系统限制,这个 Context 只在 worker 线程使用, https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs-V5/faqs-ability-30-V5 | export class DMPWorkerContext {
private static instance: DMPWorkerContext
context?: common.UIAbilityContext;
static sharedInstance() {
if (!DMPWorkerContext.instance) {
DMPWorkerContext.instance = new DMPWorkerContext();
}
return DMPWorkerContext.instance;
}
private constructor() {
}
} | AST#export_declaration#Left export AST#class_declaration#Left class DMPWorkerContext AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DMPWorkerContext AST#ERROR#Left context ? : common AST#ERROR#Right . UIAbilityContext ... | export class DMPWorkerContext {
private static instance: DMPWorkerContext
context?: common.UIAbilityContext;
static sharedInstance() {
if (!DMPWorkerContext.instance) {
DMPWorkerContext.instance = new DMPWorkerContext();
}
return DMPWorkerContext.instance;
}
private constructor() {
}
} | https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPContextUtils.ets#L34-L49 | 4142d047caa26da6729d5322b076b0ff25e790b3 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets | arkts | putFaultSign | 存储数据标识 | public static async putFaultSign(): Promise<void> {
logger.info(`putMessage start`);
try {
// TODO:知识点:通过 dataPreferencesManager.put方法存储数据
dataPreferencesManager.put('faultSign', JSON.stringify(true), async (err: BusinessError) => {
if (err) {
logger.error("Failed to put value of '... | AST#method_declaration#Left public static async putFaultSign AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ... | public static async putFaultSign(): Promise<void> {
logger.info(`putMessage start`);
try {
dataPreferencesManager.put('faultSign', JSON.stringify(true), async (err: BusinessError) => {
if (err) {
logger.error("Failed to put value of 'faultSign'. code =" + err.code + ", message =" ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/model/PreferencesManager.ets#L91-L106 | db4918fa782f54f446f14d733c3caf526eeccb8f | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets | arkts | decodePKCS1Segment | 解密-分段
@param decodeStr 待解密的字符串
@param priKey RSA私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@param isPem 秘钥是否为pem格式 - 默认为false | static decodePKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> {
return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding,
isPem);
} | AST#method_declaration#Left static decodePKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim... | static decodePKCS1Segment(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): OutDTO<string> {
return CryptoSyncUtil.decodeAsymSegment(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, dataCoding,
isPem);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSASync.ets#L123-L127 | 3f70f17c9c08c60ad59053d4d2c2f8a0aec2a884 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/extension_actions.ets | arkts | Gets the path of extension.
@param id The ID of extension.
@returns /extensions/${id}/${versions[0]}. | export function path_of_extension(id: string) {
let versions: string[] = [];
try {
versions = fileIo.listFileSync(meowContext().filesDir + '/extensions/' + id, { recursion: false });
} catch (e) {
return undefined;
}
if (versions.length == 0) {
return undefined;
}
let path = `/extensions/${id}... | AST#export_declaration#Left export AST#function_declaration#Left function path_of_extension AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { A... | export function path_of_extension(id: string) {
let versions: string[] = [];
try {
versions = fileIo.listFileSync(meowContext().filesDir + '/extensions/' + id, { recursion: false });
} catch (e) {
return undefined;
}
if (versions.length == 0) {
return undefined;
}
let path = `/extensions/${id}... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L290-L303 | faff67fd0030596fc4ee393a7c3b80e751c08bbe | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | getAvailableFontConfigs | 获取可用的字体配置 | getAvailableFontConfigs(): FontConfig[] {
return [...this.fontConfigs];
} | AST#method_declaration#Left getAvailableFontConfigs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FontConfig [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_stat... | getAvailableFontConfigs(): FontConfig[] {
return [...this.fontConfigs];
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L404-L406 | 0e944ad4aec75089dfebe6b60396aa3967a95c48 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/TextReaderHelper.ets | arkts | start | 朗读控件起播,拉起播放器面板并开始播放。播放失败返回对应错误码。
@param readInfoList 播放文章列表
@param articleId 文章id,articleId不传时,默认从文章列表中的第一篇开始播放;传参时,从传入articleId对应的文章开始依次往下播放。(文章id不能重复,否则从列表进入同id的文章,会自动选择同id的第一篇朗读)
@returns | static start(readInfoList: TextReader.ReadInfo[], articleId?: string): Promise<void> {
return TextReader.start(readInfoList, articleId);
} | AST#method_declaration#Left static start AST#parameter_list#Left ( AST#parameter#Left readInfoList : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left TextReader . ReadInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AST#ERROR#Rig... | static start(readInfoList: TextReader.ReadInfo[], articleId?: string): Promise<void> {
return TextReader.start(readInfoList, articleId);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L39-L41 | d932f2b8f5d5b77b6180ec066a88c37707fc79d1 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets | arkts | The constant of GoodsTitleComponent. | export class GoodsTitle {
/**
* The max lines of title text.
*/
static readonly MAX_LINE: number = 2;
/**
* The line height of title text.
*/
static readonly LINE_HEIGHT: number = 32;
}; | AST#export_declaration#Left export AST#class_declaration#Left class GoodsTitle AST#class_body#Left { /**
* The max lines of title text.
*/ AST#property_declaration#Left static readonly MAX_LINE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expressio... | export class GoodsTitle {
static readonly MAX_LINE: number = 2;
static readonly LINE_HEIGHT: number = 32;
}; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/DetailsConstants.ets#L19-L28 | 3890124c92a3c746b93c4e0d4a454e80fe597b07 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | dispose | 释放窗口监听
@returns {void} 无返回值 | dispose(): void {
if (!this.windowClass) {
return;
}
if (this.avoidAreaChangeHandler) {
this.windowClass.off("avoidAreaChange", this.avoidAreaChangeHandler);
}
if (this.windowSizeChangeHandler) {
this.windowClass.off("windowSizeChange", this.windowSizeChangeHandler);
}
} | AST#method_declaration#Left dispose AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expr... | dispose(): void {
if (!this.windowClass) {
return;
}
if (this.avoidAreaChangeHandler) {
this.windowClass.off("avoidAreaChange", this.avoidAreaChangeHandler);
}
if (this.windowSizeChangeHandler) {
this.windowClass.off("windowSizeChange", this.windowSizeChangeHandler);
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/adapter/WindowAdapter.ets#L233-L243 | 9f67d58082526e14fc981a573fea58f29329d3f7 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets | arkts | updateData | 更新数据库 | public async updateData(context: common.Context, Contact: Contact): Promise<void> {
logger.info(TAG, 'update begin');
if (!context) {
logger.info(TAG, 'context is null or undefined');
}
const predicates = new rdb.RdbPredicates(TABLE_NAME);
if (predicates === null || predicates === undefined) ... | AST#method_declaration#Left public async updateData AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left Contact : ... | public async updateData(context: common.Context, Contact: Contact): Promise<void> {
logger.info(TAG, 'update begin');
if (!context) {
logger.info(TAG, 'context is null or undefined');
}
const predicates = new rdb.RdbPredicates(TABLE_NAME);
if (predicates === null || predicates === undefined) ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/DatabaseConnection.ets#L256-L303 | bef9a389c8d4fa04e962e657a7439bde645409a7 | gitee |
zhangyuhang0914/ArkTs-HarmonyOs.git | c9773cad7ebeee413f98ee1a57cc8fba91fecf7d | entry/src/main/ets/components/CommonComponents.ets | arkts | CommonHeader | 通用Header组件 | @Component
export struct CommonHeader{
@State statusBarHeight: number = 0
aboutToAppear() {
this.setSystemStatusBar()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonHeader AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right statusBarHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#ty... | @Component
export struct CommonHeader{
@State statusBarHeight: number = 0
aboutToAppear() {
this.setSystemStatusBar()
} | https://github.com/zhangyuhang0914/ArkTs-HarmonyOs.git/blob/c9773cad7ebeee413f98ee1a57cc8fba91fecf7d/entry/src/main/ets/components/CommonComponents.ets#L8-L14 | 9252730bcc012992b79d33d702e374becfdfe9bf | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/model/WindowModel.ets | arkts | 窗口管理模型 | export default class WindowModel {
// 默认的顶部导航栏高度
public static readonly STATUS_BAR_HEIGHT = 38.8;
// 默认的底部导航条高度
public static readonly BOTTOM_AVOID_HEIGHT = 10;
// WindowModel 单例
private static instance?: WindowModel;
/**
* 获取WindowModel单例实例
* @returns {WindowModel} WindowModel
*/
static getIn... | AST#export_declaration#Left export default AST#class_declaration#Left class WindowModel AST#class_body#Left { // 默认的顶部导航栏高度 AST#property_declaration#Left public static readonly STATUS_BAR_HEIGHT = AST#expression#Left 38.8 AST#expression#Right ; AST#property_declaration#Right // 默认的底部导航条高度 AST#property_declaration#Left ... | export default class WindowModel {
public static readonly STATUS_BAR_HEIGHT = 38.8;
public static readonly BOTTOM_AVOID_HEIGHT = 10;
private static instance?: WindowModel;
static getInstance(): WindowModel {
if (!WindowModel.instance) {
WindowModel.instance = new WindowModel();
}
... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/model/WindowModel.ets#L22-L194 | 7c62d060b5453622d1a9b35186ef53b21c040fe1 | gitee | |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/prefer/AppPrefer.ets | arkts | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/9 18:36
@Version V1.0
@Description | export class AppPrefer {
public static readonly PREFER = "prefer"
private static readonly KEY_PRIVACY_GRANT = "privacy_grant"
private static readonly KEY_PLAYER_IMPL = "player_impl"
private static readonly KEY_SORT_ORDER = "sort_order"
private static readonly KEY_SORT_BY = "sort_by"
private static rea... | AST#export_declaration#Left export AST#ERROR#Left class AppPrefer { AST#property_declaration#Left public static readonly PREFER = AST#expression#Left "prefer" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private static readonly KEY_PRIVACY_GRANT = AST#expression#Left "privacy_grant... | export class AppPrefer {
public static readonly PREFER = "prefer"
private static readonly KEY_PRIVACY_GRANT = "privacy_grant"
private static readonly KEY_PLAYER_IMPL = "player_impl"
private static readonly KEY_SORT_ORDER = "sort_order"
private static readonly KEY_SORT_BY = "sort_by"
private static rea... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/prefer/AppPrefer.ets#L12-L28 | 5533146d8ac72dbccc7e58c9b1a45336248bf1d7 | github | |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/OfferModel.ets | arkts | getStatusText | 获取Offer状态显示文本 | getStatusText(): string {
switch (this.status) {
case OfferStatus.PENDING:
return '待定';
case OfferStatus.RECEIVED:
return '已收到';
case OfferStatus.ACCEPTED:
return '已接受';
case OfferStatus.REJECTED:
return '已拒绝';
case OfferStatus.EXPIRED:
return '已... | AST#method_declaration#Left getStatusText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left swit... | getStatusText(): string {
switch (this.status) {
case OfferStatus.PENDING:
return '待定';
case OfferStatus.RECEIVED:
return '已收到';
case OfferStatus.ACCEPTED:
return '已接受';
case OfferStatus.REJECTED:
return '已拒绝';
case OfferStatus.EXPIRED:
return '已... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L88-L103 | 7039ce401d9f22dba9d1bae1fb9f6416ce94db5f | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets | arkts | Constructs the file path of history records in which history in [year, month] should be.
@param year A number, the year, like 2024.
@param month A number, the month, like 12.
@returns A string, 'history/history_year_month.txt' | export function history_path_of_month(year: number, month: number) {
return 'history/' + history_file_name_of_month(year, month);
} | AST#export_declaration#Left export AST#function_declaration#Left function history_path_of_month AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#... | export function history_path_of_month(year: number, month: number) {
return 'history/' + history_file_name_of_month(year, month);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L269-L271 | cb1d74b6b3421e27aa15feec9ccb048dc502363a | gitee | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/viewmodel/AgreementViewModel.ets | arkts | onPageBegin | 页面开始加载 | onPageBegin(): void {
this.isLoading = true;
} | AST#method_declaration#Left onPageBegin AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member... | onPageBegin(): void {
this.isLoading = true;
} | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/viewmodel/AgreementViewModel.ets#L23-L25 | d17893059ee914102694722a8d2604efef670f6e | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/model/CommonModel.ets | arkts | requestLocationPermission | 获取位置授权 | public async requestLocationPermission():Promise<boolean | undefined> {
const permissions: Permissions[] = ['ohos.permission.APPROXIMATELY_LOCATION','ohos.permission.LOCATION'];
return PermissionUtil.requestPermissions(permissions);
} | AST#method_declaration#Left public async requestLocationPermission AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Rig... | public async requestLocationPermission():Promise<boolean | undefined> {
const permissions: Permissions[] = ['ohos.permission.APPROXIMATELY_LOCATION','ohos.permission.LOCATION'];
return PermissionUtil.requestPermissions(permissions);
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/model/CommonModel.ets#L30-L33 | f518677ab89f3095df85a7a32c7c15c78d202d43 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets | arkts | getData | Get the data corresponding to the index.
@param {number} index Data index.
@returns Return ProductItem. | public getData(index: number): MediaItem {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MediaItem AST#primary_typ... | public getData(index: number): MediaItem {
return this.dataArray[index];
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L54-L56 | 6c787af3891ef24ee0766a9b85e2ab4e965a842d | gitee |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/PermissionUtils.ets | arkts | 权限管理工具
@author www.icheny.cn | export class PermissionUtils {
// 检查是否授权
static check(permissions: Permissions[]): boolean {
// 程序访问控制管理
const atManager = abilityAccessCtrl.createAtManager();
// 获取 bundle 信息
const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
// ... | AST#export_declaration#Left export AST#class_declaration#Left class PermissionUtils AST#class_body#Left { // 检查是否授权 AST#method_declaration#Left static check AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right ... | export class PermissionUtils {
static check(permissions: Permissions[]): boolean {
const atManager = abilityAccessCtrl.createAtManager();
const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
const tokenID = bundleInfo.appInf... | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/PermissionUtils.ets#L8-L55 | a02a5fe10e2bcec7af98dff13221b2fdfb9767e1 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/efRcpConfig.ets | arkts | 下载相关事件 | export class downloadEvent {
/**
* 监听下载进度
*/
onDownloadProgress: (progress: number) => void = (progress: number) => {
};
} | AST#export_declaration#Left export AST#class_declaration#Left class downloadEvent AST#class_body#Left { /**
* 监听下载进度
*/ AST#property_declaration#Left onDownloadProgress : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primar... | export class downloadEvent {
onDownloadProgress: (progress: number) => void = (progress: number) => {
};
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L134-L140 | fbfce580e088d53a60fbe2e38aecf003575ade6e | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSASync.ets | arkts | @Author csx
@DateTime 2024/3/18 10:48:03
@TODO RS 同步操作类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto | export class RSASync {
/**
* 生成RSA的非对称密钥
* @param resultCoding 生成RSA秘钥的字符串格式(hex/base64)-默认不传为base64格式
* @returns RSA密钥{publicKey:公钥,privateKey:私钥}
*/
static generateRSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKey('RSA1024', resultCoding);
... | AST#export_declaration#Left export AST#class_declaration#Left class RSASync AST#class_body#Left { /**
* 生成RSA的非对称密钥
* @param resultCoding 生成RSA秘钥的字符串格式(hex/base64)-默认不传为base64格式
* @returns RSA密钥{publicKey:公钥,privateKey:私钥}
*/ AST#method_declaration#Left static generateRSAKey AST#parameter_list#Left ( AST#pa... | export class RSASync {
static generateRSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKey('RSA1024', resultCoding);
}
static generate2048RSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey {
return CryptoSyncUtil.generateCryptoKe... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L29-L235 | e7ba27b19956ccd7ba950af673e5b3d72dadb8b2 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ApplicationModels/AbilityStartMode/entry/src/main/ets/model/DataModels.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export enum CategoryId {
Fruit = 0,
Vegetable,
Nut,
Seafood,
Dessert
} | AST#export_declaration#Left export AST#enum_declaration#Left enum CategoryId AST#enum_body#Left { AST#enum_member#Left Fruit = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Vegetable AST#enum_member#Right , AST#enum_member#Left Nut AST#enum_member#Right , AST#enum_member#Left S... | export enum CategoryId {
Fruit = 0,
Vegetable,
Nut,
Seafood,
Dessert
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ApplicationModels/AbilityStartMode/entry/src/main/ets/model/DataModels.ets#L16-L22 | bcc3e37ccea36b840a0da742052365a3a7f27ac7 | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/Index.ets | arkts | MainItem | Copyright (c) 2021-2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | export { MainItem } from './src/main/ets/components/MainItem' | AST#export_declaration#Left export { MainItem } from './src/main/ets/components/MainItem' AST#export_declaration#Right | export { MainItem } from './src/main/ets/components/MainItem' | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/Settings/features/settingitems/Index.ets#L16-L16 | a0ab74eb52c7abf11712c0a4beb6c2b6741704f1 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/applicationexception/src/main/ets/view/ApplicationException.ets | arkts | getFaultMessage | 获取应用异常信息 | async getFaultMessage() {
logger.info(TAG, `getAppEventGroups start`);
if (this.appEventGroups && this.appEventGroups.length > 0) {
// 遍历事件组
this.appEventGroups.forEach((eventGroup: hiAppEvent.AppEventGroup) => {
// 遍历事件对象集合
eventGroup.appEventInfos.forEach(async (eventInfo: hiAppEve... | AST#method_declaration#Left async getFaultMessage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#mem... | async getFaultMessage() {
logger.info(TAG, `getAppEventGroups start`);
if (this.appEventGroups && this.appEventGroups.length > 0) {
this.appEventGroups.forEach((eventGroup: hiAppEvent.AppEventGroup) => {
eventGroup.appEventInfos.forEach(async (eventInfo: hiAppEvent.AppEventInfo) =>... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/applicationexception/src/main/ets/view/ApplicationException.ets#L91-L116 | 7080e3e30e29abc7ec636ac08645a5e22bb50d3e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/ShowData.ets | arkts | 所有车型部件对应的详细参数信息 | export class PartInfo {
// 车型部件
part: string = '';
// 详细参数信息
info: string[] = [];
} | AST#export_declaration#Left export AST#class_declaration#Left class PartInfo AST#class_body#Left { // 车型部件 AST#property_declaration#Left part : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#... | export class PartInfo {
part: string = '';
info: string[] = [];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/datasource/ShowData.ets#L39-L44 | cea55b69a46301e161c8c084b116b7807084af53 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index.ets | arkts | log_head | The head of logging information.
@returns "[Meow][bunch_of_history_index]" | static log_head() {
return '[Meow][bunch_of_history_index]';
} | AST#method_declaration#Left static log_head AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left '[Meow][bunch_of_history_index]' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement... | static log_head() {
return '[Meow][bunch_of_history_index]';
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L220-L222 | c2df30eb278eed3ce18aa9843a29c27b5ac87dee | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/bigdata/src/main/ets/pages/sendable.ets | arkts | TestTypeA | [Start across_concurrent_instance_transfer_large_data] 将数据量较大的数据在Sendable class中组装 | @Sendable
export class TestTypeA {
public name: string = 'A';
constructor(name: string) {
this.name = name;
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Sendable AST#decorator#Right export class TestTypeA AST#class_body#Left { AST#property_declaration#Left public name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'A' AST#expression... | @Sendable
export class TestTypeA {
public name: string = 'A';
constructor(name: string) {
this.name = name;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/bigdata/src/main/ets/pages/sendable.ets#L18-L24 | 73e5cb2b66abbce909195bcf0297823502944bac | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | actionCancel | 点击操作时,是否自动取消
@description 默认为true
@param autoCancel
@returns | actionCancel(actionCancel: boolean) {
this.builderOptions.actionCancel = actionCancel;
return this;
} | AST#method_declaration#Left actionCancel AST#parameter_list#Left ( AST#parameter#Left actionCancel : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_stateme... | actionCancel(actionCancel: boolean) {
this.builderOptions.actionCancel = actionCancel;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L121-L124 | 68a3aa1660dc167faa9bb1e967ed1c4884afb261 | github |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/MusicClassifyListComponent.ets | arkts | useLike | @description: 添加点赞或取消点赞
@date: 2024-05-12 11:45
@author wuwenqiang | useLike(musicModel:MusicInterface,index:number){
if (this.loading) return;
this.loading = true;
if (musicModel.isLike === 1) {
deleteMusicLikeService(musicModel.id).then((res) => {
if (res.data > 0) {
musicModel.isLike = 0;// 取消点赞标志
// 对象解构之后,形成新的内存地址,相当于对象的浅拷贝,再把旧的对象替换掉
... | AST#method_declaration#Left useLike AST#parameter_list#Left ( AST#parameter#Left musicModel : AST#type_annotation#Left AST#primary_type#Left MusicInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | useLike(musicModel:MusicInterface,index:number){
if (this.loading) return;
this.loading = true;
if (musicModel.isLike === 1) {
deleteMusicLikeService(musicModel.id).then((res) => {
if (res.data > 0) {
musicModel.isLike = 0;
this.musicList.splice(index,1,{...music... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicClassifyListComponent.ets#L33-L67 | 8d8b946d01d7822454bf4713299012a5ebfb6c36 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/AESSync.ets | arkts | decodeECB | 解密-ECB模式
@param str 加密的字符串
@param aesKey AES密钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns | static decodeECB(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256, keyCoding, dataCoding);
} | AST#method_declaration#Left static decodeECB AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeECB(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.decodeECB(str, aesKey, 'AES256', 'AES256|ECB|PKCS7', 256, keyCoding, dataCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L271-L274 | 2998a1b11dc303abc9f8775fd3e3369d988d2b24 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets | arkts | enableBluetooth | 开启蓝牙功能 | enableBluetooth(): void {
Log.showInfo(TAG, `enableBluetooth`);
try {
this.onBTStateChange();
access.enableBluetooth();
} catch (err) {
Log.showError(TAG, `enableBluetooth: err = ${err}`);
}
} | AST#method_declaration#Left enableBluetooth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left... | enableBluetooth(): void {
Log.showInfo(TAG, `enableBluetooth`);
try {
this.onBTStateChange();
access.enableBluetooth();
} catch (err) {
Log.showError(TAG, `enableBluetooth: err = ${err}`);
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets#L69-L77 | b09aed11ff793240aee5bead46ebcfc86f671ea9 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/paintcomponent/Index.ets | arkts | PaintComponentComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { PaintComponentComponent } from './src/main/ets/view/PaintComponent'; | AST#export_declaration#Left export { PaintComponentComponent } from './src/main/ets/view/PaintComponent' ; AST#export_declaration#Right | export { PaintComponentComponent } from './src/main/ets/view/PaintComponent'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/Index.ets#L16-L16 | a65340b2f50312722fa6723a7e2371a29bd1cdbe | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/RegisterPage.ets | arkts | RegisterContent | 注册页面内容视图
@returns {void} 无返回值 | @Builder
private RegisterContent(): void {
AnimatedAuthPage({ title: $r("app.string.welcome_register") }) {
PhoneInputField({
phone: this.phone,
onPhoneChange: (value: string): void => {
this.phone = value;
this.vm.updatePhone(value);
}
});
SpaceVerti... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RegisterContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#... | @Builder
private RegisterContent(): void {
AnimatedAuthPage({ title: $r("app.string.welcome_register") }) {
PhoneInputField({
phone: this.phone,
onPhoneChange: (value: string): void => {
this.phone = value;
this.vm.updatePhone(value);
}
});
SpaceVerti... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/RegisterPage.ets#L63-L141 | 46422d2da74a9813ac6d21ed6dd6f8318ce1acb2 | github |
hefengbao/jingmo-for-HarmonyOS.git | a208f3fdc95c0914749072e811301b9dfd6678d6 | commons/utils/src/main/ets/data/PrefUtil.ets | arkts | 在 products/default/src/main/ets/entryability/EntryAbility.ets 的 onCreate() 初始化 | export class PrefUtil {
preference?: preferences.Preferences;
logger: Logger = new Logger('PrefUtil');
init(context: Context) {
let options: preferences.Options = { name: PrefConst.PREF_NAME, storageType: preferences.StorageType.GSKV };
try {
this.preference = preferences.getPreferencesSync(context... | AST#export_declaration#Left export AST#class_declaration#Left class PrefUtil AST#class_body#Left { AST#property_declaration#Left preference ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST... | export class PrefUtil {
preference?: preferences.Preferences;
logger: Logger = new Logger('PrefUtil');
init(context: Context) {
let options: preferences.Options = { name: PrefConst.PREF_NAME, storageType: preferences.StorageType.GSKV };
try {
this.preference = preferences.getPreferencesSync(context... | https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/commons/utils/src/main/ets/data/PrefUtil.ets#L9-L267 | bfc1ae3f51512353a8be1b92a4faa811a6c17c66 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tcp/PacketHeadWithLen/entry/src/main/ets/pages/Index.ets | arkts | receiveMsgFromServer | 读取服务端发送过来的数据 | receiveMsgFromServer(value: socket.SocketMessageInfo) {
//把接收到的数据复制到缓冲区有效数据尾部
let copyCount = buffer.from(value.message).copy(this.receivedDataBuf, this.receivedDataLen)
this.receivedDataLen += copyCount
//至少写入了3个字节才需要解析
if (this.receivedDataLen < 3) {
return;
}
//当前数据包长度
let pack... | AST#method_declaration#Left receiveMsgFromServer AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . SocketMessageInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right... | receiveMsgFromServer(value: socket.SocketMessageInfo) {
let copyCount = buffer.from(value.message).copy(this.receivedDataBuf, this.receivedDataLen)
this.receivedDataLen += copyCount
if (this.receivedDataLen < 3) {
return;
}
let packLen = this.receivedDataBuf.readUInt16LE()
... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tcp/PacketHeadWithLen/entry/src/main/ets/pages/Index.ets#L134-L169 | 698da872bd72cc4e659c8ea9e12350848a4a5dbb | gitee |
openharmony/graphic_graphic_2d | 46a11e91c9709942196ad2a7afea2e0fcd1349f3 | interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets | arkts | Implements a matrix.
@syscap SystemCapability.Graphics.Drawing
@since 12 | export class Matrix {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | AST#export_declaration#Left export AST#class_declaration#Left class Matrix AST#ERROR#Left { static AST#ERROR#Right AST#class_body#Left { AST#method_declaration#Left loadLibraryWithPermissionCheck AST#parameter_list#Left ( AST#ERROR#Left "drawing_ani_core" , "@ohos.graphics.drawing" AST#ERROR#Right ) AST#parameter_list#... | export class Matrix {
static { loadLibraryWithPermissionCheck("drawing_ani_core", "@ohos.graphics.drawing"); } | https://github.com/openharmony/graphic_graphic_2d/blob/46a11e91c9709942196ad2a7afea2e0fcd1349f3/interfaces/kits/ani/drawing/ets/@ohos.graphics.drawing.ets#L1030-L1031 | 00718f9d4c94a71616aee4be52fc2158753af6a3 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | get_all_urls | Gets a list of all tabs' current viewing urls.
@returns A string[] array, the urls. | get_all_urls() {
let urls: string[] = [];
for (let index = 0; index < this.Tabs.length; index++) {
urls.push(this.Tabs[index].url);
}
return urls;
} | AST#method_declaration#Left get_all_urls AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left urls : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary... | get_all_urls() {
let urls: string[] = [];
for (let index = 0; index < this.Tabs.length; index++) {
urls.push(this.Tabs[index].url);
}
return urls;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L519-L526 | 5417ea23034d6224f8b7100573c905131352a2a3 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/AgentService.ets | arkts | clearHistory | Clear conversation history (keep only system prompt) | clearHistory(): void {
this.initSystemPrompt();
console.info('[AgentService] Conversation history cleared');
} | AST#method_declaration#Left clearHistory AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#... | clearHistory(): void {
this.initSystemPrompt();
console.info('[AgentService] Conversation history cleared');
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L619-L622 | d7abcc77196a7703d8887f67e6ad0d5b44d148e7 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | loadSubscriptions | 加载订阅列表 | async loadSubscriptions() {
this.isLoading = true;
try {
this.podcasts = await PodcastService.getInstance().getSubscribedPodcasts();
} catch (error) {
console.error('Failed to load subscriptions:', error);
} finally {
this.isLoading = false;
}
} | AST#method_declaration#Left async loadSubscriptions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST... | async loadSubscriptions() {
this.isLoading = true;
try {
this.podcasts = await PodcastService.getInstance().getSubscribedPodcasts();
} catch (error) {
console.error('Failed to load subscriptions:', error);
} finally {
this.isLoading = false;
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L334-L343 | 77dfa52776302ba3ea2a79622c8adbeeb8816d55 | github |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/event/WanEvents.ets | arkts | 收藏文章事件 | export class CollectEvent {
isSuccess: boolean
id: number
errMsg?: string
constructor | AST#export_declaration#Left export AST#ERROR#Left class CollectEvent { isSuccess : AST#ERROR#Left boolean id : number errMsg ? : AST#ERROR#Right string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declara... | export class CollectEvent {
isSuccess: boolean
id: number
errMsg?: string
constructor | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/event/WanEvents.ets#L81-L86 | f2b5a989ebdf768079dbfec3c83c5729a60da135 | github | |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/TlsDemo/entry/src/main/ets/pages/Index.ets | arkts | loadCA | 加载CA文件内容 | loadCA() {
try {
let buf = new ArrayBuffer(1024 * 4);
let file = fs.openSync(caFileUri, fs.OpenMode.READ_ONLY);
let readLen = fs.readSync(file.fd, buf, { offset: 0 });
this.ca = buf2String(buf.slice(0, readLen))
this.canConnect = true
fs.closeSync(file);
}
catch (e) {
... | AST#method_declaration#Left loadCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left buf = AST#expression#Left AST#call_expression#Left... | loadCA() {
try {
let buf = new ArrayBuffer(1024 * 4);
let file = fs.openSync(caFileUri, fs.OpenMode.READ_ONLY);
let readLen = fs.readSync(file.fd, buf, { offset: 0 });
this.ca = buf2String(buf.slice(0, readLen))
this.canConnect = true
fs.closeSync(file);
}
catch (e) {
... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TlsDemo/entry/src/main/ets/pages/Index.ets#L229-L241 | e5fe5caf2812739630c93fe8ec75bc51437d7ca5 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 趋势统计 | export interface TrendStats {
contactsGrowth: { period: string; count: number; change: number } | AST#export_declaration#Left export AST#interface_declaration#Left interface TrendStats AST#ERROR#Left { contactsGrowth : AST#ERROR#Right AST#object_type#Left { AST#type_member#Left period : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST... | export interface TrendStats {
contactsGrowth: { period: string; count: number; change: number } | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AnalyticsService.ets#L83-L84 | 8d25cb95abe09c23a98cee5a04ee5d4c28391e82 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | setDrawLimitLinesBehindData | If this is set to true, the LimitLines are drawn behind the actual data,
otherwise on top. Default: false
@param enabled | public setDrawLimitLinesBehindData(enabled: boolean): void {
this.mDrawLimitLineBehindData = enabled;
} | AST#method_declaration#Left public setDrawLimitLinesBehindData AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left vo... | public setDrawLimitLinesBehindData(enabled: boolean): void {
this.mDrawLimitLineBehindData = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L495-L497 | 77b06f9aaf31765280dbfe110a644e91d8f10d1a | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | getCommunityPosts | 获取社区帖子列表 | async getCommunityPosts(
type?: PostType,
topicId?: string,
authorId?: string,
limit: number = 20,
offset: number = 0
): Promise<CommunityPost[]> {
try {
// TODO: 实现真实的API调用
// 这里提供模拟数据
return this.getMockPosts(limit);
} catch (error) {
hilog.error(LogConstants.DOMA... | AST#method_declaration#Left async getCommunityPosts AST#parameter_list#Left ( AST#parameter#Left type ? : AST#type_annotation#Left AST#primary_type#Left PostType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left topicId ? : AST#type_annotation#Left AST#primary_type#Left string AS... | async getCommunityPosts(
type?: PostType,
topicId?: string,
authorId?: string,
limit: number = 20,
offset: number = 0
): Promise<CommunityPost[]> {
try {
return this.getMockPosts(limit);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L296-L312 | 1a33381a112491a9bd9b8975d93bbfc5e4cb3905 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/GreetingsPage.ets | arkts | buildSelectionActions | 构建选择模式操作栏 | @Builder
buildSelectionActions() {
Row({ space: 16 }) {
Button(`全选(${this.filteredGreetings.length})`)
.type(ButtonType.Capsule)
.fontSize(14)
.backgroundColor('#f0f0f0')
.fontColor('#333333')
.height(32)
.onClick(() => {
if (this.selectedGreetings.s... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSelectionActions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_... | @Builder
buildSelectionActions() {
Row({ space: 16 }) {
Button(`全选(${this.filteredGreetings.length})`)
.type(ButtonType.Capsule)
.fontSize(14)
.backgroundColor('#f0f0f0')
.fontColor('#333333')
.height(32)
.onClick(() => {
if (this.selectedGreetings.s... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/GreetingsPage.ets#L277-L310 | 91a6e2f6d87dddf48a9e06a64003d578a82ccf4a | github |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | onZoom | 缩放时间轴
@param event 手势事件,event.scale 缩放系数 | onZoom(event: GestureEvent | undefined) {
if (event) {
this.getInstance().onZoom(event.scale)
this.invalidate()
}
} | AST#method_declaration#Left onZoom AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left GestureEvent AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST... | onZoom(event: GestureEvent | undefined) {
if (event) {
this.getInstance().onZoom(event.scale)
this.invalidate()
}
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L326-L331 | d5ddccb7eb2965dda588785fd0563c2065e7f40a | gitee |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/models/MvModel.ets | arkts | MvUrlResponse | export interface MvUrlResponse {
code: number
data: MvUrl
message: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MvUrlResponse AST#object_type#Left { AST#type_member#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left data : AST#type_annotation#Left A... | export interface MvUrlResponse {
code: number
data: MvUrl
message: string
} | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/models/MvModel.ets#L78-L82 | b517e47d984ccdf8e0a56559d80b9daca61a5adb | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment2.ets | arkts | [EndExclude Case1] | build() {
Column() {
// Video Playback Component
}
.onAreaChange((old, newValue) => {
if (!this.isVideoInit) {
let positionY: number = newValue.position.y as number
if (positionY < screenHeight / 3) {
this.createComplexVideoPlayer();
this.isVideoInit = true;
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // Video Playback Component } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onAreaChange ( ... | build() {
Column() {
}
.onAreaChange((old, newValue) => {
if (!this.isVideoInit) {
let positionY: number = newValue.position.y as number
if (positionY < screenHeight / 3) {
this.createComplexVideoPlayer();
this.isVideoInit = true;
}
}
})
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment2.ets#L37-L50 | aced6183148854fa7d9065f1fd6f2ef980363170 | gitee | |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/model/Message.ets | arkts | createChatMsgEntity_INCOME_SYSTEAMINFO | 构建一条系统消息对象。
@param senderId 单聊请填uid、群聊请用gid
@param message 消息内容
@param time 消息时间戳,0表示使用当前系统时间戳
@returns 新的消息对象 | static createChatMsgEntity_INCOME_SYSTEAMINFO(senderId: string, message: string, time: number): Message {
// 生成一个fp吧,这个只用于LayzyForEach时方便ui刷新逻辑时使用,别无他用!
return new Message(senderId, Protocal.genFingerPrint(), time, message, MsgType.TYPE_SYSTEAM$INFO);
} | AST#method_declaration#Left static createChatMsgEntity_INCOME_SYSTEAMINFO AST#parameter_list#Left ( AST#parameter#Left senderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary... | static createChatMsgEntity_INCOME_SYSTEAMINFO(senderId: string, message: string, time: number): Message {
return new Message(senderId, Protocal.genFingerPrint(), time, message, MsgType.TYPE_SYSTEAM$INFO);
} | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/Message.ets#L113-L116 | 14e25d583b195adde6c552fef9019bc2d883d564 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/YAxis.ets | arkts | getMaxWidth | @return the maximum width that the axis can take (in vp). | public getMaxWidth(): number {
return this.mMaxWidth;
} | AST#method_declaration#Left public getMaxWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre... | public getMaxWidth(): number {
return this.mMaxWidth;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L211-L213 | cdc4c5feb4e1ea181edf27e0864d7dd9d29386be | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/PodcastDetailPage.ets | arkts | unsubscribePodcast | 执行取消订阅 | async unsubscribePodcast(): Promise<void> {
if (!this.podcast) return;
try {
await PodcastService.getInstance().unsubscribePodcast(this.podcast.id);
UIUtils.showToast(new ToastOptions('已取消订阅', 2000));
// 返回上一页
UIUtils.back();
} catch (error) {
console.error('Unsubscribe fa... | AST#method_declaration#Left async unsubscribePodcast AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#ty... | async unsubscribePodcast(): Promise<void> {
if (!this.podcast) return;
try {
await PodcastService.getInstance().unsubscribePodcast(this.podcast.id);
UIUtils.showToast(new ToastOptions('已取消订阅', 2000));
UIUtils.back();
} catch (error) {
console.error('Unsubscribe failed:', ... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/PodcastDetailPage.ets#L269-L281 | a23fa97f51649a91fa0868ac0b4fa79e43ac0cfc | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 生日信息接口 | export interface BirthdayInfo {
date: string; // YYYY-MM-DD格式或MM-DD格式(公历不知道年份时)
isLunar: boolean; // 是否农历生日
lunarDate?: string; // 农历日期字符串
year?: number; // 出生年份(可选)
month: number; // 出生月份
day: number; // 出生日期
age?: number; // 年龄
nextBirthday?: ... | AST#export_declaration#Left export AST#interface_declaration#Left interface BirthdayInfo AST#object_type#Left { AST#type_member#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // YYYY-MM-DD格式或MM-DD格式(公历不知道年份时) AST#type_member#Lef... | export interface BirthdayInfo {
date: string;
isLunar: boolean;
lunarDate?: string;
year?: number;
month: number;
day: number;
age?: number;
nextBirthday?: string;
daysUntilBirthday?: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L117-L127 | 3a34ce0d0ad6bd35383120d9f966357ddb770ad5 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.