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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets | arkts | MyVideoComponent_opacity | [End buffer_power_case_2] [Start buffer_power_case_3] | @Component
export struct MyVideoComponent_opacity {
@State videoSrc: Resource | string = $r('app.media.test_video');
private controller: VideoController = new VideoController();
build() {
Column() {
Video({
src: this.videoSrc,
controller: this.controller,
})
.width(300)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyVideoComponent_opacity AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right videoSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AS... | @Component
export struct MyVideoComponent_opacity {
@State videoSrc: Resource | string = $r('app.media.test_video');
private controller: VideoController = new VideoController();
build() {
Column() {
Video({
src: this.videoSrc,
controller: this.controller,
})
.width(300)
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PowerAnalysis/LowerPowerSample/entry/src/main/ets/pages/buffer_power_example.ets#L89-L110 | 18639ddf6db84939d6ea07ed4780069b8e96040c | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/bookShelf/components/dialog/FolderInfoDialog.ets | arkts | dialogCatalogAddShelf | 书单弹窗 | @Builder dialogCatalogAddShelf(){
Column(){
catalogAddShelf({
onClickShelf:(val:boolean)=>{
this.isCatalogAddShelf = val
},
currentIndex:this.itemData.groupType,
ids:this.itemData.groupId?[this.itemData.groupId]:[],
bookOrFolder:1
})
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right dialogCatalogAddShelf 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 Column ( ) AST#container_content_body#Left { AST#ark... | @Builder dialogCatalogAddShelf(){
Column(){
catalogAddShelf({
onClickShelf:(val:boolean)=>{
this.isCatalogAddShelf = val
},
currentIndex:this.itemData.groupType,
ids:this.itemData.groupId?[this.itemData.groupId]:[],
bookOrFolder:1
})
}
} | 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/FolderInfoDialog.ets#L121-L132 | 2d96bb6ae385783c8516314e3596d94e6a241513 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/mod2.ets | arkts | [Start export_module_variable_02] | export let c = 'mod2 c executed'; | AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left c = AST#expression#Left 'mod2 c executed' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export let c = 'mod2 c executed'; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/mod2.ets#L17-L17 | 9c8fe9e6b31b51cc33c4eb7f40c820fe175e4a6a | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | existCookie | 获取是否存在cookie。
@param incognito true表示隐私模式下查询是否存在cookies,false表示正常非隐私模式下查询是否存在cookies。
@returns | static existCookie(incognito?: boolean): boolean {
return webview.WebCookieManager.existCookie(incognito);
} | AST#method_declaration#Left static existCookie AST#parameter_list#Left ( AST#parameter#Left incognito ? : 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 boolean AST#pr... | static existCookie(incognito?: boolean): boolean {
return webview.WebCookieManager.existCookie(incognito);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L189-L191 | 24a2aea75bdd93dd436f23da001da35e692b2521 | gitee |
conradsheeran/steam-totp.git | af0eba089e77ff73e6983ce61fa89190c628721e | src/main/ets/pages/SteamTOTP.ets | arkts | getDeviceID | 基于 SteamID 获取标准化的设备 ID
@param steamID - 你的 SteamID
@returns { string } | public static async getDeviceID(steamID: string): Promise<string> {
const hs = hash.createHash('sha1');
hs.update(SteamTOTP.SecretToBuffer(steamID).buffer)
const hashed = hs.digest().toLowerCase()
const id = [
hashed.slice(0, 8),
hashed.slice(8, 12),
hashed.slice(12, 16),
hashed.... | AST#method_declaration#Left public static async getDeviceID AST#parameter_list#Left ( AST#parameter#Left steamID : 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 AST#ge... | public static async getDeviceID(steamID: string): Promise<string> {
const hs = hash.createHash('sha1');
hs.update(SteamTOTP.SecretToBuffer(steamID).buffer)
const hashed = hs.digest().toLowerCase()
const id = [
hashed.slice(0, 8),
hashed.slice(8, 12),
hashed.slice(12, 16),
hashed.... | https://github.com/conradsheeran/steam-totp.git/blob/af0eba089e77ff73e6983ce61fa89190c628721e/src/main/ets/pages/SteamTOTP.ets#L146-L159 | ea17641138fa911c859231a5893466fd2590a197 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/SimpleLunarCalendar.ets | arkts | formatLunarDate | 格式化农历日期显示 | static formatLunarDate(lunarDate: SimpleLunarDate): string {
// 春节特殊处理
if (lunarDate.month === 1 && lunarDate.day === 1) {
return '春节';
}
return `${lunarDate.monthName}${lunarDate.dayName}`;
} | AST#method_declaration#Left static formatLunarDate AST#parameter_list#Left ( AST#parameter#Left lunarDate : AST#type_annotation#Left AST#primary_type#Left SimpleLunarDate AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left stri... | static formatLunarDate(lunarDate: SimpleLunarDate): string {
if (lunarDate.month === 1 && lunarDate.day === 1) {
return '春节';
}
return `${lunarDate.monthName}${lunarDate.dayName}`;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/SimpleLunarCalendar.ets#L139-L146 | 8546b59576b1d7d932174292f6c2df06485a6733 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowShortcuts.ets | arkts | refresh_homepage_shortcuts | Actions
Tries to retrieve homepage shortcuts from bunch_of_bookmarks. | refresh_homepage_shortcuts() {
let result = this.bunch_of_bookmarks.get_folder(this.homepage_shortcuts_dir)?.get_content();
if (result) {
this.homepage_shortcuts = Array.from(result);
console.log(`[Meow][meowWebView] Directory selected / refreshed for shortcuts: [${this.homepage_shortcuts_dir}] (${r... | AST#method_declaration#Left refresh_homepage_shortcuts AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AS... | refresh_homepage_shortcuts() {
let result = this.bunch_of_bookmarks.get_folder(this.homepage_shortcuts_dir)?.get_content();
if (result) {
this.homepage_shortcuts = Array.from(result);
console.log(`[Meow][meowWebView] Directory selected / refreshed for shortcuts: [${this.homepage_shortcuts_dir}] (${r... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowShortcuts.ets#L113-L131 | 3c2eae11d0d3badaee4f0ccdf8ba95ade5db8410 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/model/WindowModel.ets | arkts | createSubWindow | 创建验证码登录子窗口
Create sub window for login verification. | createSubWindow() {
if (this.windowStage === undefined) {
Logger.error('Failed to create the subWindow: windowStage is undefined.');
return;
}
this.windowStage.createSubWindow(LoginConstants.SUB_WINDOW_NAME, (err, data: window.Window) => {
if (err.code) {
Logger.error(`Failed to cr... | AST#method_declaration#Left createSubWindow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSt... | createSubWindow() {
if (this.windowStage === undefined) {
Logger.error('Failed to create the subWindow: windowStage is undefined.');
return;
}
this.windowStage.createSubWindow(LoginConstants.SUB_WINDOW_NAME, (err, data: window.Window) => {
if (err.code) {
Logger.error(`Failed to cr... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/model/WindowModel.ets#L60-L125 | e8615aa1b8912a050352a5c5cf25053c62b63da0 | github |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 置顶文章
@param date
@returns | export function getHotTopArticle() {
return axiosClient.get<Article[]>({
url: "article/top/json",
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getHotTopArticle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#e... | export function getHotTopArticle() {
return axiosClient.get<Article[]>({
url: "article/top/json",
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L41-L45 | e343a03974af37fd5fdc27ba2d355e2a4962914d | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/PickerUtils.ets | arkts | saveAudio | 通过保存模式拉起audioPicker界面(目前拉起的是documentPicker,audioPicker在规划中),用户可以保存一个或多个音频文件。
@param newFileNames
@returns | static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> {
try {
let audioPicker = new picker.AudioViewPicker();
if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) {
return await audioPicker.save();
} else {
let AudioSaveOptions =... | AST#method_declaration#Left static async saveAudio AST#parameter_list#Left ( AST#parameter#Left newFileNames ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > A... | static async saveAudio(newFileNames?: Array<string>): Promise<Array<string>> {
try {
let audioPicker = new picker.AudioViewPicker();
if (newFileNames == undefined || newFileNames == null || newFileNames.length == 0) {
return await audioPicker.save();
} else {
let AudioSaveOptions =... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L217-L232 | a53b2c76f2b86229f02ca3bd3e1626580dc30de7 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets | arkts | getInstance | 获取单例实例 | public static getInstance(): UserSession {
if (!UserSession.instance) {
console.info('UserSession: 创建实例');
UserSession.instance = new UserSession();
} else {
console.info('UserSession: 返回已有实例');
}
return UserSession.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserSession AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#... | public static getInstance(): UserSession {
if (!UserSession.instance) {
console.info('UserSession: 创建实例');
UserSession.instance = new UserSession();
} else {
console.info('UserSession: 返回已有实例');
}
return UserSession.instance;
} | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/auth/UserSession.ets#L52-L60 | 3dd90f1e415ee53c97d9df2ebe5d0d03e1fcc7aa | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets | arkts | getCameraManagerFn | 获取相机管理器实例 | getCameraManagerFn(): camera.CameraManager | undefined {
if (this.cameraManager) {
return this.cameraManager;
}
let cameraManager: camera.CameraManager | undefined = undefined;
try {
cameraManager = camera.getCameraManager(getContext(this));
logger.info(TAG, `getCameraManager success: ... | AST#method_declaration#Left getCameraManagerFn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right... | getCameraManagerFn(): camera.CameraManager | undefined {
if (this.cameraManager) {
return this.cameraManager;
}
let cameraManager: camera.CameraManager | undefined = undefined;
try {
cameraManager = camera.getCameraManager(getContext(this));
logger.info(TAG, `getCameraManager success: ... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dealstridesolution/src/main/ets/model/CameraService.ets#L144-L156 | e671a910070d01d6637eb1fba51d2345216efee8 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | dateStringOn | / 获取指定dayOf的日期 (字符串) | dateStringOn(dayOf: DayOf): ResourceStr | null {
let date = this.dateOn(dayOf);
if (date !== null) {
let now = new Date();
let daysToNow = this.daysTo(date, now);
if (daysToNow === 0) {//今天
return $r("app.string.plan_str_today");
} else if (daysToNow === 1) {//昨天
return $... | AST#method_declaration#Left dateStringOn AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource... | dateStringOn(dayOf: DayOf): ResourceStr | null {
let date = this.dateOn(dayOf);
if (date !== null) {
let now = new Date();
let daysToNow = this.daysTo(date, now);
if (daysToNow === 0) {
return $r("app.string.plan_str_today");
} else if (daysToNow === 1) {
return $r("app.s... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L127-L142 | 912bada5b3fa5221b78a15dfc646170e80a65cb8 | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/udp/UdpEchoServer/entry/src/main/ets/pages/Index.ets | arkts | sendMsg2Target | 发送消息到目的ip和端口 | sendMsg2Target(address: string, port: number, msg: string) {
//目的ip和端口
let remoteAddress = { address: address, port: port, family: 1 }
udpSocket.send({ data: msg, address: remoteAddress })
.then(async () => {
hilog.info(0x0000, 'sendMsg2Target', '%{public}s:%{public}d %{public}s',
re... | AST#method_declaration#Left sendMsg2Target AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#... | sendMsg2Target(address: string, port: number, msg: string) {
let remoteAddress = { address: address, port: port, family: 1 }
udpSocket.send({ data: msg, address: remoteAddress })
.then(async () => {
hilog.info(0x0000, 'sendMsg2Target', '%{public}s:%{public}d %{public}s',
remoteAddre... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/udp/UdpEchoServer/entry/src/main/ets/pages/Index.ets#L86-L98 | c3ad0699ec2e266b0f7e0ea062d0114bb2fe4fb1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/ArrayUtil.ets | arkts | removeEmpty | 去除字符串数组中的空值
@param arr 待处理的集合
@returns 处理后的集合 | static removeEmpty(arr: string[]): string[] {
return arr.filter((value) => StrUtil.isNotEmpty(value));
} | AST#method_declaration#Left static removeEmpty AST#parameter_list#Left ( AST#parameter#Left arr : 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 ... | static removeEmpty(arr: string[]): string[] {
return arr.filter((value) => StrUtil.isNotEmpty(value));
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L52-L54 | 74cb923cb5b9429b4e989172ac88d0f520acdaad | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 祝福语评分更新数据接口 | export interface GreetingRatingUpdateData {
rating: number;
updated_at: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingRatingUpdateData AST#object_type#Left { AST#type_member#Left rating : 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 updated_at : AST#t... | export interface GreetingRatingUpdateData {
rating: number;
updated_at: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L309-L312 | d647bdff53d8772b71c8b8b9de679f29bbce1bf3 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/DataSet.ets | arkts | toSimpleString | Returns a simple string representation of the DataSet with the type and
the number of Entries.
@return | public toSimpleString(): string {
let size = 0;
if (this.mEntries != null) {
size = this.mEntries.size();
}
let str: string = "DataSet, label: " + (!this.getLabel() ? "" : this.getLabel()) + ", entries: " + size + "\n";
return str
} | AST#method_declaration#Left public toSimpleString 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 siz... | public toSimpleString(): string {
let size = 0;
if (this.mEntries != null) {
size = this.mEntries.size();
}
let str: string = "DataSet, label: " + (!this.getLabel() ? "" : this.getLabel()) + ", entries: " + size + "\n";
return str
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/DataSet.ets#L199-L206 | d0a7f2f1a6a1189e693ff435e212b9094bea887e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/game/VirtualShopPage.ets | arkts | buildContent | 构建内容 | @Builder
buildContent() {
Scroll() {
Column({ space: 16 }) {
switch (this.selectedCategory) {
case 'featured':
this.buildFeaturedSection();
break;
case 'daily':
this.buildDailySection();
break;
default:
this.bu... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left Scroll AST#expression#Right AST#ERROR#Left ( ) { Column ( AST#component_parameter... | @Builder
buildContent() {
Scroll() {
Column({ space: 16 }) {
switch (this.selectedCategory) {
case 'featured':
this.buildFeaturedSection();
break;
case 'daily':
this.buildDailySection();
break;
default:
this.bu... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/game/VirtualShopPage.ets#L248-L261 | 669e1ec90ec3eee46db9c87a3c7e6187296630ac | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 祝福语方法统计接口 | export interface GreetingMethodStat {
method: string;
count: number;
percentage: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingMethodStat AST#object_type#Left { AST#type_member#Left method : 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 count : AST#type_annotat... | export interface GreetingMethodStat {
method: string;
count: number;
percentage: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L69-L73 | 5e566f28ebaafe65f45f56f5a10248cf34411606 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/TintImage.ets | arkts | TintImage | 支持着色(Tint)功能的png图片组件 | @ComponentV2
export struct TintImage {
// 组件参数:图片资源
@Param src: Resource | string | null = null;
// 组件参数:着色颜色字符串(例如:"#ff0000")
@Param colorStr: string = "#FF00b242"//ARGB
@Param iconSize: number | string = 22
@Param isSvg: boolean = false //默认是png
build() {
if(this.isSvg){
// svg直接使用fillCol... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TintImage AST#component_body#Left { // 组件参数:图片资源 AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#pri... | @ComponentV2
export struct TintImage {
@Param src: Resource | string | null = null;
@Param colorStr: string = "#FF00b242"
@Param iconSize: number | string = 22
@Param isSvg: boolean = false
build() {
if(this.isSvg){
Image(this.src)
.width(this.iconSize)
.height(thi... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/TintImage.ets#L4-L92 | db36aeec01f5a3766100e8edfc29c21dd746aafc | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/device/DeviceManager.ets | arkts | getScreenInfo | 获取屏幕信息 | getScreenInfo(): { width: number; height: number; density: number } {
try {
const displayInfo = display.getDefaultDisplaySync();
return {
width: displayInfo.width,
height: displayInfo.height,
density: displayInfo.densityDPI
};
} catch (error) {
Logger.error('Devic... | AST#method_declaration#Left getScreenInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#ERROR#Left AST#expression_statement#Left AST#expression#Left width AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AS... | getScreenInfo(): { width: number; height: number; density: number } {
try {
const displayInfo = display.getDefaultDisplaySync();
return {
width: displayInfo.width,
height: displayInfo.height,
density: displayInfo.densityDPI
};
} catch (error) {
Logger.error('Devic... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/device/DeviceManager.ets#L215-L227 | 98fbb72c78a17125e5e5595b5d0f41b9c890b28b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarCalendar.ets | arkts | getFestivals | 获取传统节日 | public getFestivals(date: Date, lunarInfo: LunarInfo): string[] {
const festivals: string[] = [];
// 公历节日
const month = date.getMonth() + 1;
const day = date.getDate();
const gregorianKey = `${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
const gregorianFestivals: Rec... | AST#method_declaration#Left public getFestivals 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#Left lunarInfo : AST#type_annotation#Left AST#primary_type#Left LunarInfo AST#prima... | public getFestivals(date: Date, lunarInfo: LunarInfo): string[] {
const festivals: string[] = [];
const month = date.getMonth() + 1;
const day = date.getDate();
const gregorianKey = `${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
const gregorianFestivals: Record<str... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarCalendar.ets#L222-L280 | 02ce270add0d752ebd0069f47e2b6e1911185086 | github |
zqf-dev/WAndroidHOS.git | e2e560a7c96110c43d13eb232826707601172b6d | entry/src/main/ets/view/ArticleList.ets | arkts | reqArticle | 请求文章列表数据 | reqArticle() {
getArticle(this.page).then((res: Article) => {
this.over = res.over
if (this.list && this.list.datas && this.list.datas.length > 0) {
this.list.datas = this.list.datas.concat(res.datas)
return
}
this.list.datas = res.datas
})
} | AST#method_declaration#Left reqArticle 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 getArticle ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . page... | reqArticle() {
getArticle(this.page).then((res: Article) => {
this.over = res.over
if (this.list && this.list.datas && this.list.datas.length > 0) {
this.list.datas = this.list.datas.concat(res.datas)
return
}
this.list.datas = res.datas
})
} | https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/view/ArticleList.ets#L26-L35 | f1858af97a3cf9ed4d90353d422fb1deb0585f93 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index_backup.ets | arkts | buildSettingRow | 构建设置行(带左右滑动开关) | @Builder
buildSettingRow(title: string, description: string, isEnabled: boolean, onToggle: (value: boolean) => void) {
Row() {
Column({ space: 4 }) {
Text(title)
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
Text(description)
.font... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingRow AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotat... | @Builder
buildSettingRow(title: string, description: string, isEnabled: boolean, onToggle: (value: boolean) => void) {
Row() {
Column({ space: 4 }) {
Text(title)
.fontSize(16)
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
Text(description)
.font... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L978-L1002 | 963ce56d4edc6dab956fe2e4f40ad05e8c6a347b | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/CombinedChartModel.ets | arkts | getBarData | @Override | public getBarData(): BarData | null {
if (this.mData == null)
return null;
return this.mData.getBarData();
} | AST#method_declaration#Left public getBarData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BarData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Le... | public getBarData(): BarData | null {
if (this.mData == null)
return null;
return this.mData.getBarData();
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L140-L144 | b0b97a5e7208eec53d3ef96b2334076bebc60914 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/model/JsonListData.ets | arkts | json数据列表 | export interface JsonItem {
name: string,
samples: samplesData[],
} | AST#export_declaration#Left export AST#interface_declaration#Left interface JsonItem AST#object_type#Left { AST#type_member#Left name : 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 samples : AST#type_annotation#Left A... | export interface JsonItem {
name: string,
samples: samplesData[],
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/model/JsonListData.ets#L29-L32 | 5ad9eb748c434cb571c467918abbd8f96ed99741 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | hasSync | 检查缓存的Preferences实例中是否包含名为给定Key的存储键值对
@param key
@returns | static hasSync(key: string, preferenceName: string = PreferencesUtil.defaultPreferenceName) {
return PreferencesUtil.getPreferencesSync(preferenceName).hasSync(key);
} | AST#method_declaration#Left static hasSync 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 preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static hasSync(key: string, preferenceName: string = PreferencesUtil.defaultPreferenceName) {
return PreferencesUtil.getPreferencesSync(preferenceName).hasSync(key);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L195-L197 | 63cc716f62e801d3e67111b94f736eb2045cc717 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/view/ProfilePage.ets | arkts | SectionTitle | 区块标题
@param {ResourceStr} title - 标题文本
@returns {void} 无返回值 | @Builder
private SectionTitle(title: ResourceStr): void {
TitleWithLine({
text: title,
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private SectionTitle AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann... | @Builder
private SectionTitle(title: ResourceStr): void {
TitleWithLine({
text: title,
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L241-L246 | 45d4be4a11901d1bc2369870863c17a32a3e0403 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/PageLoading/pageloading/src/main/ets/view/CommodityList.ets | arkts | CommodityList | 自上而下渐变 | @Component
export struct CommodityList {
private commodityData: CommodityDataSource = new CommodityDataSource();
aboutToAppear() {
this.commodityData.pushData(PRODUCTS_DATA)
}
build() {
Column() {
Column() {
Image($r('app.media.page_loading_light_mode_banner'))
.objectFit(Image... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommodityList AST#component_body#Left { AST#property_declaration#Left private commodityData : AST#type_annotation#Left AST#primary_type#Left CommodityDataSource AST#primary_type#Right AST#type_annotation#Right = AST#e... | @Component
export struct CommodityList {
private commodityData: CommodityDataSource = new CommodityDataSource();
aboutToAppear() {
this.commodityData.pushData(PRODUCTS_DATA)
}
build() {
Column() {
Column() {
Image($r('app.media.page_loading_light_mode_banner'))
.objectFit(Image... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PageLoading/pageloading/src/main/ets/view/CommodityList.ets#L28-L84 | d71560a2c60d256a0173ea5577d32dafe22886a1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | trimAll | 去除字符串里的所有空格
@param str
@returns | static trimAll(str: string): string {
return str.replace(/\s/g,"");
} | AST#method_declaration#Left static trimAll 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 string AST#primary_type#Rig... | static trimAll(str: string): string {
return str.replace(/\s/g,"");
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L105-L107 | 5f31eded633b9dd63ebb616cd89a5cb7d9437d28 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets | arkts | 滑块视图类 | export class SwiperModule {
imageSrc: Resource;
constructor(imageSrc: Resource) {
this.imageSrc = imageSrc;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class SwiperModule AST#class_body#Left { AST#property_declaration#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left const... | export class SwiperModule {
imageSrc: Resource;
constructor(imageSrc: Resource) {
this.imageSrc = imageSrc;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/model/DragToSwitchPicturesModule.ets#L19-L25 | 8cf8a614b70209c3d9aefdafb091f30c3ff45759 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_cbc_encryption_decryption/aes_cbc_encryption_decryption_asynchronous.ets | arkts | encryptMessagePromise | 加密消息 | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|CBC|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, iv);
let cipherData = await cipher.doFinal(plainText);
return cipherData;
... | AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | async function encryptMessagePromise(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) {
let cipher = cryptoFramework.createCipher('AES128|CBC|PKCS7');
await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, iv);
let cipherData = await cipher.doFinal(plainText);
return cipherData;
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_cbc_encryption_decryption/aes_cbc_encryption_decryption_asynchronous.ets#L38-L43 | 7ebc5ced86f1b5794ba235dc7a68711c5c2cdbac | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | encodeAsymSegment | 非对称分段加密
@param encodeStr 待加密的字符串
@param pubKey 给定秘钥规格公钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@param keyName 密钥长度
@param keyCoding 密钥编码方式(utf8/hex/base64)
@param resultCoding 返回结果编码方式(hex/base64)
@param isPem 是否为pem格式的key | static encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding,
isPem: boolean): OutDTO<string> {
//将公钥转换
let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgN... | AST#method_declaration#Left static encodeAsymSegment 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static encodeAsymSegment(str: string, pubKey: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding,
isPem: boolean): OutDTO<string> {
let pubPair = isPem ? CryptoSyncUtil.convertPemPubKeyFromStr(pubKey, symAlgName) :
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L306-L339 | 44f69540386dc98348ade70398a3d3a4e041c42d | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | syncCurrentAnimation | 同步当前选中项的动画播放,用于首次进入或生命周期回调
@returns {void} 无返回值 | syncCurrentAnimation(): void {
this.playSelectedAnimation(this.currentPageIndex);
} | AST#method_declaration#Left syncCurrentAnimation 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#exp... | syncCurrentAnimation(): void {
this.playSelectedAnimation(this.currentPageIndex);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L82-L84 | f71cb9b8a6c701792e8dcea41eef6ce6959f50c8 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | entry/src/main/ets/pages/example/lottie/LottieView.ets | arkts | playSegments | 设置仅播放指定范围的帧动画
@param segments 片段或片段数组; 若传入的是数组, 且当前loop!=0, 播放结束后, 仅循环播放最后一个片段
@param forceFlag 值为true立刻生效, 值为false循环下次播放的时候生效
@since 8
@design | playSegments(segments: AnimationSegment | AnimationSegment[], forceFlag?: boolean) {
this.animationItem?.playSegments(segments, forceFlag)
} | AST#method_declaration#Left playSegments AST#parameter_list#Left ( AST#parameter#Left segments : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AnimationSegment AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left AnimationSegment [ ] AST#array_type#Right AST#primary_type#Right AST#uni... | playSegments(segments: AnimationSegment | AnimationSegment[], forceFlag?: boolean) {
this.animationItem?.playSegments(segments, forceFlag)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/lottie/LottieView.ets#L270-L272 | 9d5bd2e28f46ddd23a1ea87287cdbda2f9013ce2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/collapsemenu/src/main/ets/model/ArticleNode.ets | arkts | 数据类型(开发者可以自行扩展数据属性)
@param {number} type - 数据类型
@param {string} title - 数据标题
@param {string} url - 文章地址
@param {ArticleNode[]} children - 子数据列表 | export class ArticleNode {
type: number = 0
title: string = ''
url?: string = ''
children?:ArticleNode[] = []
} | AST#export_declaration#Left export AST#class_declaration#Left class ArticleNode AST#class_body#Left { AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left 0 AS... | export class ArticleNode {
type: number = 0
title: string = ''
url?: string = ''
children?:ArticleNode[] = []
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/collapsemenu/src/main/ets/model/ArticleNode.ets#L25-L30 | f4a8edede9722ac34ca3b69133812ae89b0dcbb5 | gitee | |
Glace-Dev/Harmony_Projects.git | 845cef3c5fdf5d049c942fe62cbf083c2c78e84a | basis/entry/src/main/ets/pages/PropPage.ets | arkts | finishedTask | 任务完成样式 | @Extend(Text) function finishedTask() {
.decoration({ type: TextDecorationType.LineThrough })
.fontColor('#B1B2B1')
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function finishedTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . decoration ( AST#expression#Left AST#o... | @Extend(Text) function finishedTask() {
.decoration({ type: TextDecorationType.LineThrough })
.fontColor('#B1B2B1')
} | https://github.com/Glace-Dev/Harmony_Projects.git/blob/845cef3c5fdf5d049c942fe62cbf083c2c78e84a/basis/entry/src/main/ets/pages/PropPage.ets#L22-L25 | c3e9b2c3612f5c90b781e95befac250fd71f986c | github |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 广场数据
@param date
@returns | export function getSquareData(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `user_article/list/${page}/json`,
showLoading: page == 0
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getSquareData AST#parameter_list#Left ( AST#parameter#Left page : 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 getSquareData(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `user_article/list/${page}/json`,
showLoading: page == 0
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L217-L222 | 1d50602aac37ca8c2a19feef17d8ddb689112eee | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/DictSelectModal.ets | arkts | getActiveList | 获取当前选中列表
@returns {string[]} 选中列表 | private getActiveList(): string[] {
if (!this.selectedItem) {
return [];
}
return [this.getItemKey(this.selectedItem, 0)];
} | AST#method_declaration#Left private getActiveList AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#if_statement#Left... | private getActiveList(): string[] {
if (!this.selectedItem) {
return [];
}
return [this.getItemKey(this.selectedItem, 0)];
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L174-L179 | d8c9517ee7524ddc0f30e210f7c1e8a0010b0373 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/view/ChatUI.ets | arkts | ChatUI | 聊天信息显示组件类 | @Component
export struct ChatUI {
/**
* 标题
*/
@State title: string = '';
/**
* 是否显示返回按钮
*/
@State isBackButton: boolean = true;
/**
* 是否打开输入控制开关
*/
@State isInputControl: boolean = true;
/**
* 输入框提示文本
*/
@State inputTextPlaceHolder: string = '';
private listScroller: Scroller =... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChatUI AST#component_body#Left { /**
* 标题
*/ AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#... | @Component
export struct ChatUI {
@State title: string = '';
@State isBackButton: boolean = true;
@State isInputControl: boolean = true;
@State inputTextPlaceHolder: string = '';
private listScroller: Scroller = new Scroller();
@State userInput: string = '';
public isSubmitButton: boolea... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/view/ChatUI.ets#L16-L343 | 3b252aabe732091ec85a665d419d292c703f63ec | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/eventbus/EventBus.ets | arkts | once | 一次性订阅 | once(event: string, callback: EventCallback): void {
const wrapper: EventCallback = (data?: EventData) => {
callback(data);
this.off(event, wrapper);
};
this.on(event, wrapper);
} | AST#method_declaration#Left once AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left EventCallback AST#primary_type#R... | once(event: string, callback: EventCallback): void {
const wrapper: EventCallback = (data?: EventData) => {
callback(data);
this.off(event, wrapper);
};
this.on(event, wrapper);
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/eventbus/EventBus.ets#L87-L93 | 4b3d1badb6bd78e8af77467523e5d7910472e76e | github |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/view/Detail/dialog/DurationDialog.ets | arkts | 构建组件 | build() {
Flex() {
// 使用 CommonDialog 组件来构建通用对话框
CommonDialog({
title: $r('app.string.ring_duration'),
controller: this.controller
}) {
// 遍历响铃时长选项
ForEach(this.durations, (item: number) => {
Row() {
// 显示响铃时长和单位
Text(item + CommonC... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Flex ( ) AST#container_content_body#Left { // 使用 CommonDialog 组件来构建通用对话框 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CommonDialog ( AST#componen... | build() {
Flex() {
CommonDialog({
title: $r('app.string.ring_duration'),
controller: this.controller
}) {
ForEach(this.durations, (item: number) => {
Row() {
Text(item + CommonConstants.DEFAULT_STRING_SPACE + DetailConstants.DEFA... | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/view/Detail/dialog/DurationDialog.ets#L17-L51 | 2dca731cd42cc406f835b5a5a7589f48b3be0183 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeCategorySection.ets | arkts | buildColumnsTemplate | 获取列数模板
@returns {string} Grid 列模板 | private buildColumnsTemplate(): string {
const columns: number = this.getColumnsCount();
let template: string = "";
for (let index: number = 0; index < columns; index++) {
template = `${template}1fr${index === columns - 1 ? "" : " "}`;
}
return template;
} | AST#method_declaration#Left private buildColumnsTemplate 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 const AST#variable_declarator... | private buildColumnsTemplate(): string {
const columns: number = this.getColumnsCount();
let template: string = "";
for (let index: number = 0; index < columns; index++) {
template = `${template}1fr${index === columns - 1 ? "" : " "}`;
}
return template;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCategorySection.ets#L83-L90 | ad3e1234cba3967c4e91d40b43a499943006dfee | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/AudioCapturerHelper.ets | arkts | startRecord | 开始录音
@returns | static async startRecord(): Promise<string> {
let filePath = Helper.getCacheDirPath('audio', `audio_${Helper.getTodayStr('yyyyMMddHHmmssfff')}.pcm`); //pcm wav
await AudioCapturerHelper.createAudioCapturer();
AudioCapturerHelper.onReadDataCallback(filePath);
let start = await AudioCapturerHelper.start()... | AST#method_declaration#Left static async startRecord 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 string AST#primary_type#Right AST#type_annotation#Right > AST#... | static async startRecord(): Promise<string> {
let filePath = Helper.getCacheDirPath('audio', `audio_${Helper.getTodayStr('yyyyMMddHHmmssfff')}.pcm`);
await AudioCapturerHelper.createAudioCapturer();
AudioCapturerHelper.onReadDataCallback(filePath);
let start = await AudioCapturerHelper.start();
if ... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/AudioCapturerHelper.ets#L20-L29 | f52771a4a1243da646b7b3f5ba3f9f332a9cab0f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/goods/GoodsGridItem.ets | arkts | GoodsGridItem | @file 商品网格卡片组件
@author Joker.X | @ComponentV2
export struct GoodsGridItem {
/**
* 商品数据
*/
@Param
goods: Goods = new Goods();
/**
* 点击回调
*/
@Param
onItemClick: (id: number) => void = () => {
};
/**
* 构建商品网格卡片
* @returns {void} 无返回值
*/
build(): void {
Card({
heightValue: bp({ sm: 230, md: 250, lg: 270 })... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsGridItem AST#component_body#Left { /**
* 商品数据
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right goods : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#... | @ComponentV2
export struct GoodsGridItem {
@Param
goods: Goods = new Goods();
@Param
onItemClick: (id: number) => void = () => {
};
build(): void {
Card({
heightValue: bp({ sm: 230, md: 250, lg: 270 }),
paddingValue: $r("app.float.space_padding_small"),
onTap: (): void => thi... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/goods/GoodsGridItem.ets#L21-L81 | b24401ac522c2503c7bfc9ee808a6892e98f833a | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets | arkts | clearAll | 清空 Demo 表
@returns {Promise<number>} 受影响行数 | async clearAll(): Promise<number> {
return this.orm.query(DemoEntity).delete();
} | AST#method_declaration#Left async clearAll 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async clearAll(): Promise<number> {
return this.orm.query(DemoEntity).delete();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets#L70-L72 | 322d97ddf0c523c1873d7591c56d47d5f6fd2712 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/immersive/src/main/ets/view/WebImmersive.ets | arkts | WebImmersive | Web沉浸式适配
1、设置Web绘制延伸至状态栏和导航条
2、设置网页元素避让导航条 | @Component
export struct WebImmersive {
controller: webview.WebviewController = new webview.WebviewController();
@Consume navPathStack: NavPathStack;
build() {
Column() {
Web({ src: $rawfile('web_immersive.html'), controller: this.controller })
.width('100%')
.layoutWeight(1)// 设置Web绘制延... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WebImmersive AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary... | @Component
export struct WebImmersive {
controller: webview.WebviewController = new webview.WebviewController();
@Consume navPathStack: NavPathStack;
build() {
Column() {
Web({ src: $rawfile('web_immersive.html'), controller: this.controller })
.width('100%')
.layoutWeight(1)
.e... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/immersive/src/main/ets/view/WebImmersive.ets#L23-L38 | 6580791474ccf1287cf9ba1f53b99a75f2c32b73 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPIApplicationScenario/entry/src/main/ets/pages/ObjectUtils.ets | arkts | [Start napi_ark_runtime_utils] | export function Logger() {
console.log('print log');
} | AST#export_declaration#Left export AST#function_declaration#Left function Logger AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Lef... | export function Logger() {
console.log('print log');
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/NodeAPI/NodeAPIClassicUseCases/NodeAPIApplicationScenario/entry/src/main/ets/pages/ObjectUtils.ets#L16-L18 | c2a4893b0c6c63b2b9d5a7b0ddd1ee54df4ec99a | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/model/Message.ets | arkts | createChatMsgEntity_INCOME_SYSTEAMINFO | 构建一条系统消息对象。
@param senderId 单聊请填uid、群聊请用gid
@param message 消息内容
@param time 消息时间戳,0表示使用当前系统时间戳
@returns 新的消息对象 | static createChatMsgEntity_INCOME_SYSTEAMINFO(senderId: string,senderDisplayName: string, message: string, time: number): Message {
// 生成一个fp吧,这个只用于LayzyForEach时方便ui刷新逻辑时使用,别无他用!
return new Message(senderId, senderDisplayName, 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 senderDisplayName : AST#type_annotation#Left A... | static createChatMsgEntity_INCOME_SYSTEAMINFO(senderId: string,senderDisplayName: string, message: string, time: number): Message {
return new Message(senderId, senderDisplayName, time, message, MsgType.TYPE_SYSTEAM$INFO);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/Message.ets#L100-L103 | c71d2b74838894086d31ab40ca01dc9ba79a9b34 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/BusinessSample/entry/src/main/ets/view/CardItemComponent.ets | arkts | CardItemComponent | One row information of card content. | @Component
export struct CardItemComponent {
private cardItem: ListItemData;
build() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Center
}) {
Column() {
Text(this.cardItem.title)
.fontSize($r('app.float.card_c... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CardItemComponent AST#component_body#Left { AST#property_declaration#Left private cardItem : AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right ; AST#property_... | @Component
export struct CardItemComponent {
private cardItem: ListItemData;
build() {
Flex({
direction: FlexDirection.Row,
justifyContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Center
}) {
Column() {
Text(this.cardItem.title)
.fontSize($r('app.float.card_c... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/view/CardItemComponent.ets#L8-L40 | ec3dc5a346a4624437789859c6286a397b089865 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputConsumerUtil.ets | arkts | subscribe | 订阅组合按键
@param callback 回调
@param keyOptions 组合键选项 默认:a+b+e组合按键 | subscribe(callback: Callback<inputConsumer.KeyOptions>): void {
this.mCallback = callback
// 创建按键监听器
inputConsumer.on('key', this.mKeyOptionS, callback)
inputConsumer.on('key', this.mKeyOptionD, callback)
} | AST#method_declaration#Left subscribe AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left inputConsumer . KeyOptions AST#qualified_type#Right... | subscribe(callback: Callback<inputConsumer.KeyOptions>): void {
this.mCallback = callback
inputConsumer.on('key', this.mKeyOptionS, callback)
inputConsumer.on('key', this.mKeyOptionD, callback)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/InputConsumerUtil.ets#L38-L43 | cd34a373277ba5163cbdf59026985fa993619747 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/VoiceRegion.ets | arkts | 应用约束60:使用ES模块导入导出 | export default VoiceRegion; | AST#export_declaration#Left export default AST#expression#Left VoiceRegion AST#expression#Right ; AST#export_declaration#Right | export default VoiceRegion; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/VoiceRegion.ets#L37-L37 | c0bf9c761e4acaf8b5b8fd2024ac70445587a3a5 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/Index.ets | arkts | NewsDetailPage | 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 { NewsDetailPage } from './src/main/ets/view/NewsDetailPage'; | AST#export_declaration#Left export { NewsDetailPage } from './src/main/ets/view/NewsDetailPage' ; AST#export_declaration#Right | export { NewsDetailPage } from './src/main/ets/view/NewsDetailPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/Index.ets#L16-L16 | 1a23dff05e8205a8ae040a2765535efeaf69230c | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/pages/TaskReviewView.ets | arkts | loadTaskDetail | 加载任务详情 | async loadTaskDetail() {
try {
const httpRequest = http.createHttp();
const response = await httpRequest.request(`${AppConstants.API_BASE_URL}/agv/task/${this.taskId}`);
if (response.responseCode === 200) {
const data: Record<string, Object> = JSON.parse(response.result as string);
... | AST#method_declaration#Left async loadTaskDetail 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 const AST#variable_declarator#Left httpRequest = AST#expression#Left ... | async loadTaskDetail() {
try {
const httpRequest = http.createHttp();
const response = await httpRequest.request(`${AppConstants.API_BASE_URL}/agv/task/${this.taskId}`);
if (response.responseCode === 200) {
const data: Record<string, Object> = JSON.parse(response.result as string);
... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/pages/TaskReviewView.ets#L140-L160 | 3d952814a028078f6b3d5bd2c1b35dcd9a4a814c | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/CartRepository.ets | arkts | clearCart | 清空购物车
@returns {Promise<void>} Promise<void> | clearCart(): Promise<void> {
return this.dataSource.clearCart();
} | AST#method_declaration#Left clearCart 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#type_arguments#Ri... | clearCart(): Promise<void> {
return this.dataSource.clearCart();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L74-L76 | 25ea7d5b82bb031a6aaed6d137a60a3d52b8d898 | github |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/home/suggestion.ets | arkts | questionDescribe | **********************************问题描述****************************************// | @Builder
questionDescribe(){
Column({ space: 8 }) {
Text('问题描述')
.fontSize(16)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
TextArea({ placeholder: '输入你的问题' })
.width('100%')
.height(120)
.backgroundColor('#F5F5F5')
.borderRadius(8)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right questionDescribe 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 Column ( AST#component_parameters#Left { AST#component_pa... | @Builder
questionDescribe(){
Column({ space: 8 }) {
Text('问题描述')
.fontSize(16)
.fontColor('#333333')
.alignSelf(ItemAlign.Start)
TextArea({ placeholder: '输入你的问题' })
.width('100%')
.height(120)
.backgroundColor('#F5F5F5')
.borderRadius(8)
... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/suggestion.ets#L88-L109 | 2c399142c6d8998234c754f385ab3204288f80c6 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/TypeUtil.ets | arkts | isInt32Array | 检查是否为Int32Array数组类型。
@param value
@returns | static isInt32Array(value: Object): boolean {
return new util.types().isInt32Array(value);
} | AST#method_declaration#Left static isInt32Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object 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#primary_... | static isInt32Array(value: Object): boolean {
return new util.types().isInt32Array(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L219-L221 | 06a0f406c31ae28c6fb049676229cf63f6777706 | gitee |
yiyefangzhou24/hmwechat | 27d11056003843c7e331e683478720d8efa49d17 | entry/src/main/ets/default/common/components/bottomTabs.ets | arkts | getTabItems | 用于初始化TabItem的数组 | function getTabItems(): Array<TabItem> {
let itemsArray: Array<TabItem> = []
itemsArray.push(new TabItem($r('app.media.message_normal') , $r('app.media.message_press') ,$r('app.string.bottom_tab_wechat') ))
itemsArray.push(new TabItem($r('app.media.contacts_normal') , $r('app.media.contacts_press') ,$r('app.strin... | AST#function_declaration#Left function getTabItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TabItem AST#primary_type#Right AST#type_annotation#Right > AST#typ... | function getTabItems(): Array<TabItem> {
let itemsArray: Array<TabItem> = []
itemsArray.push(new TabItem($r('app.media.message_normal') , $r('app.media.message_press') ,$r('app.string.bottom_tab_wechat') ))
itemsArray.push(new TabItem($r('app.media.contacts_normal') , $r('app.media.contacts_press') ,$r('app.strin... | https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/common/components/bottomTabs.ets#L30-L37 | f407261f4a90ae47992e482810bcca51473c1956 | gitee |
from-north-to-north/OpenHarmony_p7885 | f6ea526c039db535a7c958fa154ccfcb3668b37c | hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets | arkts | SetWindowPrivacyMode | 设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。此接口可用于禁止截屏/录屏的场景。 需要权限: ohos.permission.PRIVACY_WINDOW https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/apis/js-apis-window.md#setwindowprivacymode9 | async SetWindowPrivacyMode() {
let isPrivacyMode: boolean = true;
let windowClass = await window.getLastWindow(this.context)
try {
windowClass.setWindowPrivacyMode(isPrivacyMode, (err: BusinessError) => {
const errCode: number = err.code;
if (errCode) {
console.error('Failed ... | AST#method_declaration#Left async SetWindowPrivacyMode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isPrivacyMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_... | async SetWindowPrivacyMode() {
let isPrivacyMode: boolean = true;
let windowClass = await window.getLastWindow(this.context)
try {
windowClass.setWindowPrivacyMode(isPrivacyMode, (err: BusinessError) => {
const errCode: number = err.code;
if (errCode) {
console.error('Failed ... | https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets#L121-L136 | 769f113bca3cb8ddaaf76eeb2fe252a7d94233a7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets | arkts | CommonText | column间隙
自定义封装公共文本组件 | @Component
export struct CommonText {
@State textFour: AttributeModifier<TextAttribute> = new TextModifier();
build() {
Row() {
Text($r('app.string.dynamicattributes_text_one'))
.attributeModifier(this.textFour)
Text($r('app.string.dynamicattributes_text_two'))
.attributeModifier(t... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right textFour : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#t... | @Component
export struct CommonText {
@State textFour: AttributeModifier<TextAttribute> = new TextModifier();
build() {
Row() {
Text($r('app.string.dynamicattributes_text_one'))
.attributeModifier(this.textFour)
Text($r('app.string.dynamicattributes_text_two'))
.attributeModifier(t... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dynamicattributes/src/main/ets/common/CommonText.ets#L22-L39 | fad50883cf15cbaaae0dec7c23f5d4f4e154fc3f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets | arkts | getCartCount | 获取购物车商品总数量
@returns {Promise<number>} 商品总数 | async getCartCount(): Promise<number> {
return this.orm.query(CartEntity).find().length;
} | AST#method_declaration#Left async getCartCount 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_a... | async getCartCount(): Promise<number> {
return this.orm.query(CartEntity).find().length;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets#L137-L139 | 6e35cb36498f509616fec77c10693a8e7366eb57 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/pages/music/ProfilePage.ets | arkts | checkLoginStatus | 检查登录状态并获取用户信息 | async checkLoginStatus() {
try {
// 初始化用户服务
await this.userService.initialize();
// 检查登录状态
this.isLoggedIn = this.userService.isLoggedIn();
if (this.isLoggedIn) {
const currentUser = this.userService.getCurrentUser();
if (currentUser) {
this.user... | AST#method_declaration#Left async checkLoginStatus 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express... | async checkLoginStatus() {
try {
await this.userService.initialize();
this.isLoggedIn = this.userService.isLoggedIn();
if (this.isLoggedIn) {
const currentUser = this.userService.getCurrentUser();
if (currentUser) {
this.userInfo = currentUser;... | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/music/ProfilePage.ets#L21-L43 | 61bcca4fb42a54f7cff1bb17e089c780c5e45aa2 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/buffer/AbstractBuffer.ets | arkts | feed | Builds up the buffer with the provided data and resets the buffer-index
after feed-completion. This needs to run FAST.
@param data | public abstract feed(data: T): void; | AST#method_declaration#Left public abstract feed AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T 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_type#Rig... | public abstract feed(data: T): void; | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L89-L89 | 90e481026fea781affd0acadd47e681598049c3e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | 聊天响应接口 | export interface ChatResponse {
id: string;
object: string;
created: number;
model: string;
choices: ChatChoice[];
usage?: ChatUsage;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ChatResponse 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 object : AST#type_annotation#Left ... | export interface ChatResponse {
id: string;
object: string;
created: number;
model: string;
choices: ChatChoice[];
usage?: ChatUsage;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L59-L66 | b37a9dd9d20aed595e4623049f35d43afd1a920d | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | buildGreetingResultItem | 构建祝福语结果项 | @Builder
buildGreetingResultItem(greeting: Greeting) {
Column({ space: 8 }) {
Text(greeting.content)
.fontSize(14)
.fontColor('#333333')
.lineHeight(20)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
Row({ space: 8 ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingResultItem AST#parameter_list#Left ( AST#parameter#Left greeting : AST#type_annotation#Left AST#primary_type#Left Greeting AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder... | @Builder
buildGreetingResultItem(greeting: Greeting) {
Column({ space: 8 }) {
Text(greeting.content)
.fontSize(14)
.fontColor('#333333')
.lineHeight(20)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.width('100%')
Row({ space: 8 ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L588-L633 | 1dd809cbe86e80669947937986bd1391dec6b10e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/RenderTxtBoxSameLayer_two.ets | arkts | [Start listen_peer_renders_life_cycle] [Start peer_renders_gesture_event] | build() {
Row() {
Column() {
Stack() {
ForEach(this.componentIdArr, (componentId: string) => {
NodeContainer(this.nodeControllerMap.get(componentId))
.position(this.positionMap.get(componentId))
.width(this.widthMap.get(componentId))
.hei... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Row() {
Column() {
Stack() {
ForEach(this.componentIdArr, (componentId: string) => {
NodeContainer(this.nodeControllerMap.get(componentId))
.position(this.positionMap.get(componentId))
.width(this.widthMap.get(componentId))
.hei... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseSameLayerRender/entry/src/main/ets/pages/RenderTxtBoxSameLayer_two.ets#L155-L253 | 16df6177813848405141eaed69e0013ff0d22c80 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets | arkts | formatDynasty | 给我一个汉字朝代 拼接前后括号 | formatDynasty(dynasty:string){
return dynasty.length === 0 ? '' : '[' + dynasty + ']'
} | AST#method_declaration#Left formatDynasty AST#parameter_list#Left ( AST#parameter#Left dynasty : 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 { AST#statement#Left AST#return_statement#Left r... | formatDynasty(dynasty:string){
return dynasty.length === 0 ? '' : '[' + dynasty + ']'
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets#L8-L10 | c180a8b5111319643a727a3383c46e7b6e93c7e3 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets | arkts | generateTransformedValuesBubble | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the BUBBLECHART.
@param data
@return | public generateTransformedValuesBubble(data: IBubbleDataSet, phaseY: number, froms: number, to: number): number[] {
const count = (to - froms + 1) * 2; // (int) Math.ceil((to - from) * phaseX) * 2;
if (this.valuePointsForGenerateTransformedValuesBubble.length != count) {
this.valuePointsForGenerateTransf... | AST#method_declaration#Left public generateTransformedValuesBubble AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IBubbleDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_typ... | public generateTransformedValuesBubble(data: IBubbleDataSet, phaseY: number, froms: number, to: number): number[] {
const count = (to - froms + 1) * 2;
if (this.valuePointsForGenerateTransformedValuesBubble.length != count) {
this.valuePointsForGenerateTransformedValuesBubble = new Array<number>(count);... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L143-L166 | e50c016b43c4a30421669bfd57d3d402c218b83c | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/CandleDataSet.ets | arkts | setShowCandleBar | Sets whether the candle bars should show?
@param showCandleBar | public setShowCandleBar(showCandleBar: boolean): void {
this.mShowCandleBar = showCandleBar;
} | AST#method_declaration#Left public setShowCandleBar AST#parameter_list#Left ( AST#parameter#Left showCandleBar : 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 void AS... | public setShowCandleBar(showCandleBar: boolean): void {
this.mShowCandleBar = showCandleBar;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L173-L175 | 789d0058339287f5b6579cf4f6ed23fc9a26d597 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/Part_Unit.ets | arkts | MARK: - 单元数据模型 | export class Unit {
unitId : number = 0;
unitName : string = '';
unitNo : number = 0;
partId : number = 0;
words : WordUser[] = [];
// 计算属性:获取活跃单词(未删除的单词)
get aliveWords(): WordUser[] {
return this.words.filter(word => !word.deleted);
}
// 计算属性:获取已学习的单词
get l... | AST#export_declaration#Left export AST#class_declaration#Left class Unit AST#class_body#Left { AST#property_declaration#Left unitId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#p... | export class Unit {
unitId : number = 0;
unitName : string = '';
unitNo : number = 0;
partId : number = 0;
words : WordUser[] = [];
get aliveWords(): WordUser[] {
return this.words.filter(word => !word.deleted);
}
get learnedWords(): WordUser[] {
return... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/Part_Unit.ets#L4-L43 | c719bdff023aa7a38fd979af18104602f1712cc5 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | calculateAge | 计算年龄
@param birthDate 出生日期
@param referenceDate 参考日期,默认为今天
@returns 年龄 | static calculateAge(birthDate: Date, referenceDate: Date = new Date()): number {
let age = referenceDate.getFullYear() - birthDate.getFullYear();
const monthDiff = referenceDate.getMonth() - birthDate.getMonth();
if (monthDiff < 0 || (monthDiff === 0 && referenceDate.getDate() < birthDate.getDate())) {... | AST#method_declaration#Left static calculateAge AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left referenceDate : AST#type_annotation#Left AST#primary_type#Left Date AST#p... | static calculateAge(birthDate: Date, referenceDate: Date = new Date()): number {
let age = referenceDate.getFullYear() - birthDate.getFullYear();
const monthDiff = referenceDate.getMonth() - birthDate.getMonth();
if (monthDiff < 0 || (monthDiff === 0 && referenceDate.getDate() < birthDate.getDate())) {... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L271-L280 | 644dfca67d45627a3c76dac44e03559f3aa77555 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/huawei/HwSubscriber.ets | arkts | queryPurchases | 查询已购买/未完成订单 | async queryPurchases(queryType: iap.PurchaseQueryType): Promise<void> {
const param: iap.QueryPurchasesParameter = {
productType : iap.ProductType.AUTORENEWABLE,
queryType : queryType
};
try {
const res = await iap.queryPurchases(this.context, param);
const purchaseDataList: strin... | AST#method_declaration#Left async queryPurchases AST#parameter_list#Left ( AST#parameter#Left queryType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left iap . PurchaseQueryType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Righ... | async queryPurchases(queryType: iap.PurchaseQueryType): Promise<void> {
const param: iap.QueryPurchasesParameter = {
productType : iap.ProductType.AUTORENEWABLE,
queryType : queryType
};
try {
const res = await iap.queryPurchases(this.context, param);
const purchaseDataList: strin... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L111-L127 | 167401be94e6dc300da904663fbb1961fbeb95a0 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/LanguageDetector.ets | arkts | calculateLanguageSimilarity | 获取语言相似度 | calculateLanguageSimilarity(lang1: SupportedLanguage, lang2: SupportedLanguage): number {
// 相同语言族的相似度较高
const languageFamilies: SupportedLanguage[][] = [
[SupportedLanguage.ZH_CN, SupportedLanguage.ZH_TW],
[SupportedLanguage.EN_US, SupportedLanguage.EN_GB],
// 可以添加更多语言族
];
if (la... | AST#method_declaration#Left calculateLanguageSimilarity AST#parameter_list#Left ( AST#parameter#Left lang1 : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lang2 : AST#type_annotation#Left AST#primary_type#Left S... | calculateLanguageSimilarity(lang1: SupportedLanguage, lang2: SupportedLanguage): number {
const languageFamilies: SupportedLanguage[][] = [
[SupportedLanguage.ZH_CN, SupportedLanguage.ZH_TW],
[SupportedLanguage.EN_US, SupportedLanguage.EN_GB],
];
if (lang1 === lang2) {
ret... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L350-L369 | 30dca91901a31fb57f154207eab4423132bc39e2 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/web/src/main/ets/BaseWebViewProxyImp.ets | arkts | @author open_9527
@date 2025/5/16
@desc web 包装层 | export class BaseWebViewProxyImp implements WebViewProxy {
} | AST#export_declaration#Left export AST#class_declaration#Left class BaseWebViewProxyImp AST#implements_clause#Left implements WebViewProxy AST#implements_clause#Right AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right | export class BaseWebViewProxyImp implements WebViewProxy {
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/BaseWebViewProxyImp.ets#L9-L11 | 3e28088704fef510f2bc89949dface592d02f64e | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_cbc_encryption_decryption/aes_cbc_encryption_decryption_synchronous.ets | arkts | decryptMessage | 解密消息 | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|CBC|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left c... | function decryptMessage(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('AES128|CBC|PKCS7');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, iv);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_cbc_encryption_decryption/aes_cbc_encryption_decryption_synchronous.ets#L46-L51 | 46d51429bf6ace3033b72b6396b1128e3d7f1f9a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets | arkts | aboutToAppear | 下载信息初始化 | aboutToAppear(): void {
// 初始化下载列表
this.loadInitializationDataSource();
// 下载数量,用于显示页面上下载队列数量
this.downloadCount = this.downloadFileArray.length;
} | AST#method_declaration#Left aboutToAppear 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... | aboutToAppear(): void {
this.loadInitializationDataSource();
this.downloadCount = this.downloadFileArray.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets#L117-L123 | bdd750264e2ce9033f0453d0b06a04b244f7471c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AuthUtil.ets | arkts | generateChallenge | 生成挑战值,用来防重放攻击。
@param len 最大长度为32
@returns | static generateChallenge(len: number = 16) {
const rand = cryptoFramework.createRandom();
const randData: Uint8Array = rand.generateRandomSync((len > 0 && len <= 32) ? len : 16).data;
return randData;
} | AST#method_declaration#Left static generateChallenge AST#parameter_list#Left ( AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | static generateChallenge(len: number = 16) {
const rand = cryptoFramework.createRandom();
const randData: Uint8Array = rand.generateRandomSync((len > 0 && len <= 32) ? len : 16).data;
return randData;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AuthUtil.ets#L142-L146 | cf0f8f0e714efa4e4cd60d05dc98b784e54975b1 | gitee |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/CardListModel.ets | arkts | Copyright (c) 2023 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 const CardList: Array<Resource> = [
$r('app.media.ic_card_A'),
$r('app.media.ic_card_B'),
$r('app.media.ic_card_C'),
$r('app.media.ic_card_D'),
$r('app.media.ic_card_E'),
$r('app.media.ic_card_F'),
$r('app.media.ic_card_G'),
$r('app.media.ic_card_H'),
$r('app.media.ic_card_J'),
$r('app.media.... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CardList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > A... | export const CardList: Array<Resource> = [
$r('app.media.ic_card_A'),
$r('app.media.ic_card_B'),
$r('app.media.ic_card_C'),
$r('app.media.ic_card_D'),
$r('app.media.ic_card_E'),
$r('app.media.ic_card_F'),
$r('app.media.ic_card_G'),
$r('app.media.ic_card_H'),
$r('app.media.ic_card_J'),
$r('app.media.... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/CardListModel.ets#L16-L29 | c9bf55c44c2af5ac8121c697543e6c3febe067b1 | github | |
wuyuanwuhui999/harmony-arkts-movie-app-ui.git | d5e9bebe1dca2759cba417d2b6b402941d3bc273 | entry/src/main/ets/pages/MovieDetailPage.ets | arkts | blockStyle | 推荐的电影 | @Styles blockStyle(){
.backgroundColor(colors.blockColor)
.borderRadius(size.blockBorderRaduis)
.padding(size.pagePadding)
.width('100%')
.margin({ top: size.pagePadding })
} | AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right blockStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left colors AST#expression#Righ... | @Styles blockStyle(){
.backgroundColor(colors.blockColor)
.borderRadius(size.blockBorderRaduis)
.padding(size.pagePadding)
.width('100%')
.margin({ top: size.pagePadding })
} | https://github.com/wuyuanwuhui999/harmony-arkts-movie-app-ui.git/blob/d5e9bebe1dca2759cba417d2b6b402941d3bc273/entry/src/main/ets/pages/MovieDetailPage.ets#L15-L21 | dab6cf92a138f98da0282c63ead6e81fb90ca883 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets | arkts | isConnected | 判断是否连接 | async isConnected(): Promise<boolean> {
if (!this.tcpSocket) {
return false;
}
try {
let state = await this.tcpSocket.getState();
if (state.isConnected) {
return true;
}
} catch (e) {
Logger.error(`${TAG} tcp getState error ${JSON.stringify(e)}}`);
}
return... | AST#method_declaration#Left async isConnected 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 > AST#type_a... | async isConnected(): Promise<boolean> {
if (!this.tcpSocket) {
return false;
}
try {
let state = await this.tcpSocket.getState();
if (state.isConnected) {
return true;
}
} catch (e) {
Logger.error(`${TAG} tcp getState error ${JSON.stringify(e)}}`);
}
return... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TcpSocket.ets#L119-L133 | 4b7e43140428ced7810b53ab1884ec8605a8401b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | onTabChange | Tab切换 | private onTabChange(tab: string): void {
this.activeTab = tab;
if (this.searchKeyword.trim()) {
this.performSearch(this.searchKeyword.trim());
}
} | AST#method_declaration#Left private onTabChange AST#parameter_list#Left ( AST#parameter#Left tab : 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 void AST#primary_type#... | private onTabChange(tab: string): void {
this.activeTab = tab;
if (this.searchKeyword.trim()) {
this.performSearch(this.searchKeyword.trim());
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L171-L176 | da25f825c525b096e22a0805cd6ea6fa47ea7888 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/AuthRepository.ets | arkts | @file 认证相关仓库类,封装认证模块请求
@author Joker.X | export class AuthRepository {
/**
* 认证网络数据源
*/
private networkDataSource: AuthNetworkDataSource;
/**
* 构造函数
* @param networkDataSource 可选的认证网络数据源实例
*/
constructor(networkDataSource?: AuthNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new AuthNetworkDataSourceImpl();
}
... | AST#export_declaration#Left export AST#class_declaration#Left class AuthRepository AST#class_body#Left { /**
* 认证网络数据源
*/ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left AuthNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_d... | export class AuthRepository {
private networkDataSource: AuthNetworkDataSource;
constructor(networkDataSource?: AuthNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new AuthNetworkDataSourceImpl();
}
async refreshToken(params: Record<string, string>): Promise<NetworkResponse<Aut... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/AuthRepository.ets#L8-L39 | c9068bc0d0685f6a51f4bfbb69ca7d2717232629 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets | arkts | MARK: - WordUser 数据库访问类 | export class WordUserDbAccess extends UserDbSuperAccess {
private static instance: WordUserDbAccess;
// private db: DBAccessor | null = null;
// 获取单例
public static get shared(): WordUserDbAccess {
if (!WordUserDbAccess.instance) {
WordUserDbAccess.instance = new WordUserDbAccess();
}
return ... | AST#export_declaration#Left export AST#class_declaration#Left class WordUserDbAccess extends AST#type_annotation#Left AST#primary_type#Left UserDbSuperAccess AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primar... | export class WordUserDbAccess extends UserDbSuperAccess {
private static instance: WordUserDbAccess;
public static get shared(): WordUserDbAccess {
if (!WordUserDbAccess.instance) {
WordUserDbAccess.instance = new WordUserDbAccess();
}
return WordUserDbAccess.instance;
}
private const... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L54-L628 | 7f7b39d26c0e8d1a29f1cc1bec8053fe96a4a44c | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/LunarTypes.ets | arkts | 二十四节气 | export interface SolarTerm {
// 节气名称
name: string;
// 节气时间
time: string;
// 节气描述
description: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SolarTerm AST#object_type#Left { // 节气名称 AST#type_member#Left name : 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 time : AST#type_ann... | export interface SolarTerm {
name: string;
time: string;
description: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/LunarTypes.ets#L51-L58 | be0458fcccfce2cd50cb59b99b7b919dd0e90e56 | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/CandleDataSet.ets | arkts | setNeutralColor | BELOW THIS COLOR HANDLING
Sets the one and ONLY color that should be used for this DataSet when
open == close.
@param color | public setNeutralColor(color: number): void {
this.mNeutralColor = color;
} | AST#method_declaration#Left public setNeutralColor AST#parameter_list#Left ( AST#parameter#Left color : 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_... | public setNeutralColor(color: number): void {
this.mNeutralColor = color;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L198-L200 | 683f962c6da5828b81f535cb992e114d92f359bc | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/capabilities/InputEventManager.ets | arkts | InputEventManager | 输入事件管理 | @Preview
@Component
export struct InputEventManager {
@State mIsShowTouchData: boolean = false // 是否显示触屏事件详情
@State mTouchData: string = '' // 触屏数据
@State mBtnBg: Resource = $r('app.color.btn_normal_bg')
aboutToDisappear() {
TouchManagerUtil.unregisterTouch()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct InputEventManager AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right mIsShowTouchData : AST#type_annotation#Left AST... | @Preview
@Component
export struct InputEventManager {
@State mIsShowTouchData: boolean = false
@State mTouchData: string = ''
@State mBtnBg: Resource = $r('app.color.btn_normal_bg')
aboutToDisappear() {
TouchManagerUtil.unregisterTouch()
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/capabilities/InputEventManager.ets#L20-L29 | 5285f7afdbdfdde7c24a1b60177ca43c1eef823c | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/DES.ets | arkts | encryptECB | 加密(ECB模式),异步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
@returns | static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = '3DES192|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, null, transformation);
} | AST#method_declaration#Left static async encryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym... | static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
transformation: string = '3DES192|ECB|PKCS7'): Promise<cryptoFramework.DataBlob> {
return DES.encrypt(data, symKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L34-L37 | 823aabdc5f44a54d8f7782d21d577d34f45e3f6e | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/core/media/FileUtil.ets | arkts | getRawFileContent | 获取resources/rawfile目录下对应的rawfile文件内容,使用Promise异步回调
@param path
@returns | static getRawFileContent(path: string): Promise<Uint8Array> {
let resourceManager = getContext().resourceManager;
return resourceManager.getRawFileContent(path);
} | AST#method_declaration#Left static getRawFileContent AST#parameter_list#Left ( AST#parameter#Left path : 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 AST#generic_type... | static getRawFileContent(path: string): Promise<Uint8Array> {
let resourceManager = getContext().resourceManager;
return resourceManager.getRawFileContent(path);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L244-L247 | 8817509361f4a83a931e2d797e2dcecb3e85a4b3 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | startTime | 设置开始时间 | public startTime(time: string): FFmpegCommandBuilder {
this.startTimeValue = time;
return this;
} | AST#method_declaration#Left public startTime AST#parameter_list#Left ( AST#parameter#Left time : 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 FFmpegCommandBuilder AST... | public startTime(time: string): FFmpegCommandBuilder {
this.startTimeValue = time;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L123-L126 | b867841baeafe9962f733e0eb14fc37e97f1b37c | github |
azhuge233/ASFShortcut-HN.git | d1669c920c56317611b5b0375aa5315c1b91211b | entry/src/main/ets/pages/Index.ets | arkts | handleResponse | 处理 ASF 响应 | private handleResponse(commandNickname: string, resp: http.HttpResponse | undefined) {
if (!resp) throw new Error(`空响应`);
try {
const result: Record<string, string> = JSON.parse(resp.result.toString());
if (resp.responseCode == 200) {
Logger.debug(this.LOG_TAG, ... | AST#method_declaration#Left private handleResponse AST#parameter_list#Left ( AST#parameter#Left commandNickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resp : AST#type_annotation#Left AST#union_type#Left AST#primar... | private handleResponse(commandNickname: string, resp: http.HttpResponse | undefined) {
if (!resp) throw new Error(`空响应`);
try {
const result: Record<string, string> = JSON.parse(resp.result.toString());
if (resp.responseCode == 200) {
Logger.debug(this.LOG_TAG, ... | https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L202-L219 | 1c5e16bb5dfb08e98fcc23ee774abd8c27be980c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/Base64Util.ets | arkts | encode | 编码,通过输入参数编码后输出Uint8Array对象。
@param array
@returns | static encode(array: Uint8Array): Promise<Uint8Array> {
const base64 = new util.Base64Helper();
return base64.encode(array);
} | AST#method_declaration#Left static encode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | static encode(array: Uint8Array): Promise<Uint8Array> {
const base64 = new util.Base64Helper();
return base64.encode(array);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/Base64Util.ets#L31-L34 | 8f01d4be99b11429875b8638c96225e0ac0d78a1 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Sync.ets | arkts | decryptMessage | 解密消息 | function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('RSA1024|PKCS1');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | AST#function_declaration#Left function decryptMessage AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le... | function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) {
let decoder = cryptoFramework.createCipher('RSA1024|PKCS1');
decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null);
let decryptData = decoder.doFinalSync(cipherText);
return decryptData;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Sync.ets#L28-L33 | b481033f4f6bd084ec7d1b0e831d892cebcf2f11 | gitee |
yinxing2008/note_hongmeng_ArkUI.git | 5c7459ca682903d9184539facc63136bbe6230b9 | entry/src/main/ets/data/UserDataStore.ets | arkts | init | 初始化用户数据 | public init() {
featureAbility.getContext().getFilesDir((error, path) => {
if (path) {
var storage = dataStorage.getStorageSync(path + "/" + STORAGE_FILE);
if (storage) {
var value = storage.getSync("token", "").toString();
if (value.length > 0) {
this.setToken(... | AST#method_declaration#Left public init 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 AST#call_expression#Left AST#expression#Left AST#mem... | public init() {
featureAbility.getContext().getFilesDir((error, path) => {
if (path) {
var storage = dataStorage.getStorageSync(path + "/" + STORAGE_FILE);
if (storage) {
var value = storage.getSync("token", "").toString();
if (value.length > 0) {
this.setToken(... | https://github.com/yinxing2008/note_hongmeng_ArkUI.git/blob/5c7459ca682903d9184539facc63136bbe6230b9/entry/src/main/ets/data/UserDataStore.ets#L38-L52 | 03188a9e010bdf465390a32b4a7c2de58b2dee7f | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/common/customizeDialog.ets | arkts | customizeDialogExample | 自定义标题和内容 | @CustomDialog
export default struct customizeDialogExample {
controller?: CustomDialogController
confirm: () => void = () => {
}
@Prop title:string = '标签锁'
@Prop content:string = '长按底部tab栏书架图标可锁定分组标签栏,再次长按解锁,锁定后左右滑动将直接切换小说,漫画,有声书分组大类'
// 主题颜色
@StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct customizeDialogExample AST#component_body#Left { AST#property_declaration#Left controller ? : AST#ERROR#Left CustomDialogController confirm : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left ... | @CustomDialog
export default struct customizeDialogExample {
controller?: CustomDialogController
confirm: () => void = () => {
}
@Prop title:string = '标签锁'
@Prop content:string = '长按底部tab栏书架图标可锁定分组标签栏,再次长按解锁,锁定后左右滑动将直接切换小说,漫画,有声书分组大类'
@StorageProp(ThemeStorageKey.THEME) theme: ThemeItem = {} as ThemeIt... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/common/customizeDialog.ets#L7-L44 | 79beb68900537c19338ca56c962eb19c24f20b41 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/CaesarCipher.ets | arkts | decrypt | 解密文本
@param text 要解密的文本
@param shift 偏移量
@returns 解密后的文本 | static decrypt(text: string, shift: number): string {
return CaesarCipher.encrypt(text, -shift);
} | AST#method_declaration#Left static decrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left shift : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri... | static decrypt(text: string, shift: number): string {
return CaesarCipher.encrypt(text, -shift);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/CaesarCipher.ets#L43-L45 | ffc5e9617dbe64d4af946324b69a0b5ee554ab7d | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | simulateStreamingGeneration | 模拟流式生成 | private async simulateStreamingGeneration(
prompt: string,
params: GreetingGenerateParams,
onChunk: StreamCallback
): Promise<string> {
const contact = params.contact;
const style = params.style;
const occasion = params.occasion;
const template = this.getGreetingTemplates(style, occasion)[... | AST#method_declaration#Left private async simulateStreamingGeneration AST#parameter_list#Left ( AST#parameter#Left prompt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#L... | private async simulateStreamingGeneration(
prompt: string,
params: GreetingGenerateParams,
onChunk: StreamCallback
): Promise<string> {
const contact = params.contact;
const style = params.style;
const occasion = params.occasion;
const template = this.getGreetingTemplates(style, occasion)[... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L340-L369 | c750d9d46c5b28cc8479ec9de3e7a968fc70a60a | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/product/entry/src/main/ets/common/breakpoint/BreakpointConstants.ets | arkts | Constants for breakpoint. | export class BreakpointConstants {
/**
* Breakpoints that represent small device types.
*/
static readonly BREAKPOINT_SM: string = 'sm';
/**
* Breakpoints that represent middle device types.
*/
static readonly BREAKPOINT_MD: string = 'md';
/**
* Breakpoints that represent large device types.
... | AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /**
* Breakpoints that represent small device types.
*/ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_... | export class BreakpointConstants {
static readonly BREAKPOINT_SM: string = 'sm';
static readonly BREAKPOINT_MD: string = 'md';
static readonly BREAKPOINT_LG: string = 'lg';
static readonly GRID_ROW_COLUMNS: number[] = [4, 8, 12];
static readonly GRID_COLUMN_SPANS: number[] = [0, 4, 8];
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/product/entry/src/main/ets/common/breakpoint/BreakpointConstants.ets#L19-L49 | 01b3cbd10f4a24cda7ef60e0b490a591dc755db0 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.SubHeaderV2.d.ets | arkts | Defines the action callback of the SubHeaderV2OperationItem.
@typedef { function } OnClicked
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | export type SubHeaderV2OperationItemAction = () => void; | AST#export_declaration#Left export AST#type_declaration#Left type SubHeaderV2OperationItemAction = AST#type_annotation#Left AST#function_type#Left 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#function_typ... | export type SubHeaderV2OperationItemAction = () => void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.SubHeaderV2.d.ets#L354-L354 | 537384e9bc05cb6b8fbe8ca8f406b51176be2ae6 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | picker_utils/src/main/ets/PickerUtil.ets | arkts | camera | 调用系统相机,拍照、录视频
@param options
@returns | static async camera(options: CameraOptions = new CameraOptions()): Promise<cameraPicker.PickerResult> {
const pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: options.cameraPosition ? options.cameraPosition : camera.CameraPosition.CAMERA_POSITION_BACK,
videoDuration: options.videoDuration,
... | AST#method_declaration#Left static async camera AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left CameraOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expressi... | static async camera(options: CameraOptions = new CameraOptions()): Promise<cameraPicker.PickerResult> {
const pickerProfile: cameraPicker.PickerProfile = {
cameraPosition: options.cameraPosition ? options.cameraPosition : camera.CameraPosition.CAMERA_POSITION_BACK,
videoDuration: options.videoDuration,
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PickerUtil.ets#L47-L55 | 3bb3684302411b8e0c59cb92218eaa985b6160de | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getRadioQuestionCount | 获取单选题数量
@returns | public getRadioQuestionCount(): number {
return this.examDetails.filter(item => item.questionType === QuestionTypeEnum.RADIO).length;
} | AST#method_declaration#Left public getRadioQuestionCount 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#me... | public getRadioQuestionCount(): number {
return this.examDetails.filter(item => item.questionType === QuestionTypeEnum.RADIO).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L252-L254 | d1f30a43b479e444f10ab34638cc08d7dac642da | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.