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 | GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets | arkts | [Start builder_node_pool] 继承NodeController,创建可以复用的子组件 | export class NodeItem extends NodeController {
// [StartExclude builder_node_pool]
public builder: WrappedBuilder<ESObject> | null = null;
public node: BuilderNode<ESObject> | null = null;
public data: ESObject = {};
// Sub component type, when reused, the corresponding sub component will be searched for and ... | AST#export_declaration#Left export AST#class_declaration#Left class NodeItem extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // [StartExclude builder_node_pool] AST#property_declaration#Left public builder : AST#type_annotation... | export class NodeItem extends NodeController {
public builder: WrappedBuilder<ESObject> | null = null;
public node: BuilderNode<ESObject> | null = null;
public data: ESObject = {};
public type: string = '';
public id: number = 0;
aboutToDisappear(): void {
NodePool.getInstance().recycleNode(... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L22-L60 | c7e71418a517543448766809d04a3629bb38f95b | gitee | |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/tabcontent/HomeContent.ets | arkts | onSelectedChanged | @Watch 选中的日期更新后重新查找日期对应的代办列表 | onSelectedChanged() {
this.getCurrentDayTodo();
} | AST#method_declaration#Left onSelectedChanged 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 this AST#expression#Right . getCurrentDayTodo ... | onSelectedChanged() {
this.getCurrentDayTodo();
} | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/tabcontent/HomeContent.ets#L23-L25 | 466184e5da6c1ce9e51ee5061444c7fcb0221245 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets | arkts | ForEachItem | 循环遍历列表 | @Component
export struct ForEachItem {
// 需要遍历的数据数组
private dataGroup: ListConstruction[] = [];
build() {
Row() {
List({
space: LIST_SPACE
}) {
// TODO: 性能知识点:使用ForEach组件循环渲染数据
ForEach(this.dataGroup, (item: ListConstruction) => {
ListItem() {
UserIte... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ForEachItem AST#component_body#Left { // 需要遍历的数据数组 AST#property_declaration#Left private dataGroup : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ListConstruction [ ] AST#array_type#Right AST#pri... | @Component
export struct ForEachItem {
private dataGroup: ListConstruction[] = [];
build() {
Row() {
List({
space: LIST_SPACE
}) {
ForEach(this.dataGroup, (item: ListConstruction) => {
ListItem() {
UserItemView({ text: item });
}
}... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chinesetopinyin/src/main/ets/pages/ChineseToPinyin.ets#L154-L182 | 9c938bfbca74e4aa42fcff067689beb369109d59 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | Page begin event at the begin of web page loading.
@typedef OnPageBeginEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface OnPageBeginEvent {
/**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
url: string;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnPageBeginEvent AST#object_type#Left { /**
* The url of page.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/ AST#type_m... | export declare interface OnPageBeginEvent {
url: string;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L244-L254 | cc8cdc8000984863493fd56b5d7587ccc6dbc799 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets | arkts | deleteItem | 在指定索引位置增加一个元素 | public deleteItem(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
} | AST#method_declaration#Left public deleteItem AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | public deleteItem(index: number): void {
this.dataArray.splice(index, 1);
this.notifyDataDelete(index);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L131-L134 | a06f9d77ebbad86e727f25fb8b7c897cb8157258 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/social/CommunityService.ets | arkts | createDefaultUser | 创建默认用户 | private createDefaultUser(): UserProfile {
return {
id: `user_${Date.now()}`,
username: '用户' + Math.floor(Math.random() * 10000),
displayName: '新用户',
joinDate: new Date().toISOString(),
level: 1,
points: 0,
badges: [],
isVerified: false,
isOnline: true,
la... | AST#method_declaration#Left private createDefaultUser AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserProfile AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#... | private createDefaultUser(): UserProfile {
return {
id: `user_${Date.now()}`,
username: '用户' + Math.floor(Math.random() * 10000),
displayName: '新用户',
joinDate: new Date().toISOString(),
level: 1,
points: 0,
badges: [],
isVerified: false,
isOnline: true,
la... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L679-L710 | 2ef1d481f5aa9792da4d7502febc3a13e15ec29c | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Image/entry/src/main/ets/pages/example/ImageExample018.ets | arkts | aboutToAppear | 默认亮度为0 | aboutToAppear(): void {
// 获取资源管理器中的媒体资源
let img = this.getUIContext().getHostContext()?.resourceManager.getMediaByNameSync(this.imgUrl);
// 创建图片源并获取图片信息
let imageSource = image.createImageSource(img?.buffer.slice(0));
let imageInfo = imageSource.getImageInfoSync();
// 检查图片信息是否获取成功
if (image... | 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#block_statement#Left { // 获取资源管理器中的媒体资源 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#L... | aboutToAppear(): void {
let img = this.getUIContext().getHostContext()?.resourceManager.getMediaByNameSync(this.imgUrl);
let imageSource = image.createImageSource(img?.buffer.slice(0));
let imageInfo = imageSource.getImageInfoSync();
if (imageInfo == undefined) {
console.error(TAG, ... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Image/entry/src/main/ets/pages/example/ImageExample018.ets#L28-L42 | 418630abffbc5a8377119197d7592a4bf8a98a4b | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | getInstance | 获取单例实例 | public static getInstance(): FFmpegManager {
if (FFmpegManager.instance === null) {
FFmpegManager.instance = new FFmpegManager();
}
return FFmpegManager.instance;
} | AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegManager 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#expressio... | public static getInstance(): FFmpegManager {
if (FFmpegManager.instance === null) {
FFmpegManager.instance = new FFmpegManager();
}
return FFmpegManager.instance;
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegManager.ets#L51-L56 | 12ad3af4c916e603ca782fd0028a77d34484b028 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4.ets | arkts | generateSM4Key | 生成SM4的对称密钥
@returns SM4密钥 | static async generateSM4Key(): Promise<string> {
return CryptoUtil.generateSymKey('SM4_128');
} | AST#method_declaration#Left static async generateSM4Key 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 > A... | static async generateSM4Key(): Promise<string> {
return CryptoUtil.generateSymKey('SM4_128');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4.ets#L30-L32 | 250a91de8136ff11cd407fad262e70fca9234e28 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | loadAllEpisodes | 加载所有单集(倒序排列,分页) | async loadAllEpisodes() {
try {
const allEps = await this.dbService.getAllEpisodes();
// 按pubDate倒序排列(最新在前)
allEps.sort((a, b) => (b.pubDate || 0) - (a.pubDate || 0));
// 分页显示
const showCount = this.episodesPage * this.episodesPageSize;
this.allEpisodes = allEps.slice(0, showCoun... | AST#method_declaration#Left async loadAllEpisodes 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 allEps = AST#expression#Left AST#... | async loadAllEpisodes() {
try {
const allEps = await this.dbService.getAllEpisodes();
allEps.sort((a, b) => (b.pubDate || 0) - (a.pubDate || 0));
const showCount = this.episodesPage * this.episodesPageSize;
this.allEpisodes = allEps.slice(0, showCount);
this.episodesHasMo... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L179-L196 | 12bc1e32e90a45231836830488988fe2424ad5d5 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | validateSettings | 验证设置对象
@param settings 设置对象 | private validateSettings(settings: AppSettings): void {
if (!settings.theme || !settings.notification || !settings.reminder) {
throw new Error('设置数据不完整');
}
// 验证主题设置
const validThemeModes = [ThemeMode.LIGHT, ThemeMode.DARK, ThemeMode.AUTO];
if (!validThemeModes.includes(settings.theme.mode))... | AST#method_declaration#Left private validateSettings AST#parameter_list#Left ( AST#parameter#Left settings : AST#type_annotation#Left AST#primary_type#Left AppSettings 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... | private validateSettings(settings: AppSettings): void {
if (!settings.theme || !settings.notification || !settings.reminder) {
throw new Error('设置数据不完整');
}
const validThemeModes = [ThemeMode.LIGHT, ThemeMode.DARK, ThemeMode.AUTO];
if (!validThemeModes.includes(settings.theme.mode)) {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L904-L930 | 94c99574afb53571d6ce2624d44a68248a80e221 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets | arkts | initiatingUserAuthentication2 | [EndExclude authentication_example2] [End authentication_example1]
start-authentication.md
示例2:
发起用户认证,采用认证可信等级≥ATL3的人脸 + 锁屏密码 + 指纹认证 + 认证类型相关 + 复用设备解锁最大有效时长认证,获取认证结果 | initiatingUserAuthentication2() {
// 设置认证参数
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.AUTH_TYPE_RELEVANT,
reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION,
};
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
... | AST#method_declaration#Left initiatingUserAuthentication2 AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 设置认证参数 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left reuseUnlockResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left... | initiatingUserAuthentication2() {
let reuseUnlockResult: userAuth.ReuseUnlockResult = {
reuseMode: userAuth.ReuseMode.AUTH_TYPE_RELEVANT,
reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION,
};
try {
const rand = cryptoFramework.createRandom();
const len: number = 16;
con... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L213-L242 | 6fd83b523a6b6127e251beb6d37e61e50dabb359 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets | arkts | onDestroy | 弹框关闭时清除缓存数据 | onDestroy(dialogId?: string) {
if (dialogId && dialogId.length > 0) {
const key = `${CacheHelper.CACHE_LABEL}${dialogId}`;
if (CacheHelper.has(key)) {
CacheHelper.remove(key); //清除缓存
}
}
} | AST#method_declaration#Left onDestroy AST#parameter_list#Left ( AST#parameter#Left dialogId ? : 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#if_statement#Left if ( A... | onDestroy(dialogId?: string) {
if (dialogId && dialogId.length > 0) {
const key = `${CacheHelper.CACHE_LABEL}${dialogId}`;
if (CacheHelper.has(key)) {
CacheHelper.remove(key);
}
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L323-L330 | 1c12d9983c6cb88368d0b126ba3d3ae40f4ac2f8 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | replaceAll | 替换字符串中所有匹配的正则为给定的字符串
@param str 待替换的字符串
@param pattern 要匹配的内容正则或字符串
@param replaceValue 替换的内容
@returns 返回替换后的字符串 | static replaceAll(str: string, pattern: RegExp | string, replaceValue: string = ''): string {
return str.replaceAll(pattern, replaceValue);
} | AST#method_declaration#Left static replaceAll 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 pattern : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Re... | static replaceAll(str: string, pattern: RegExp | string, replaceValue: string = ''): string {
return str.replaceAll(pattern, replaceValue);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L142-L144 | 9852dbcf4f9c97d5496b7c8cbe88d7b2675bbb26 | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets | arkts | Declare CallbackParam
@typedef CallbackParam
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare CallbackParam
@typedef CallbackParam
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11 | export interface CallbackParam {
/**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
... | AST#export_declaration#Left export AST#interface_declaration#Left interface CallbackParam AST#object_type#Left { /**
* Get the currentNodeId.
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Get the currentNodeId.
* @type { number }
* @syscap Sy... | export interface CallbackParam {
currentNodeId: number;
parentNodeId?: number;
childIndex?: number;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.TreeView.d.ets#L249-L292 | bf0df73745bae0737786c9a81f406245c6985fda | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videoplaycomponents/VideoPlayController.ets | arkts | 视频播放控制器。用于控制视频的播放暂停及播放进度。 | export class VideoPlayController {
// 播放接口
public play = () => {
};
// 暂停接口
public pause = () => {
};
// 播放进度接口
public seek = (currentTime: number) => {
};
} | AST#export_declaration#Left export AST#class_declaration#Left class VideoPlayController AST#class_body#Left { // 播放接口 AST#property_declaration#Left public play = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object... | export class VideoPlayController {
public play = () => {
};
public pause = () => {
};
public seek = (currentTime: number) => {
};
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videoplaycomponents/VideoPlayController.ets#L19-L29 | 781cf94175884b3ff5940887b763a3f920b51801 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/A_ns.ets | arkts | ns | [End export_variable_a_ns] | export { ns }; | AST#export_declaration#Left export { ns } ; AST#export_declaration#Right | export { ns }; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/LazyImport/entry/src/main/ets/pages/A_ns.ets#L22-L22 | 8a8d1f27e17fb5f78a5de0362baef868374351ab | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | onCaptureStatusChange | 开启屏幕截屏、投屏、录屏状态变化的监听。
@param callback 回调函数。表示设备截屏、投屏或录屏时状态发生变化。true表示设备开始投屏或者录屏,false表示结束投屏或者录屏;截屏仅返回一次true。 | static onCaptureStatusChange(callback: Callback<boolean>) {
display.on('captureStatusChange', callback);
} | AST#method_declaration#Left static onCaptureStatusChange 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 boolean AST#primary_type#Right AST#type_annotation#Right... | static onCaptureStatusChange(callback: Callback<boolean>) {
display.on('captureStatusChange', callback);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L215-L217 | f8e2b84b2dda8ca18b401f42761d22ba88df69b6 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/LoginPage.ets | arkts | buildUserAgreementSection | 构建用户协议区域
@returns {void} 无返回值 | @Builder
private buildUserAgreementSection(): void {
UserAgreement({
centerAlignment: true,
onUserAgreementClick: (): void => {
CommonNavigator.toUserAgreement();
},
onPrivacyPolicyClick: (): void => {
CommonNavigator.toPrivacyPolicy();
}
});
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildUserAgreementSection 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#ui_custom_compon... | @Builder
private buildUserAgreementSection(): void {
UserAgreement({
centerAlignment: true,
onUserAgreementClick: (): void => {
CommonNavigator.toUserAgreement();
},
onPrivacyPolicyClick: (): void => {
CommonNavigator.toPrivacyPolicy();
}
});
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L181-L192 | bf82926a6bebe3a6d2e37e5e0ccaffa462c77e36 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 关系分布数据接口 | export interface RelationDistribution {
relation: string;
count: number;
percentage: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface RelationDistribution AST#object_type#Left { AST#type_member#Left relation : 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_ann... | export interface RelationDistribution {
relation: string;
count: number;
percentage: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L29-L33 | 722a9db7cdb8ba67008ec0fc82865d09862f393c | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/dialogv2/source/dialogv2.ets | arkts | getDividerColor | get divider color
@returns divider color | private getDividerColor(): ResourceColor {
if (!this.buttons || this.buttons.length === 0 || !DIALOG_DIVIDER_SHOW) {
return Color.Transparent;
}
if (this.buttons[0].buttonStyle === ButtonStyleMode.TEXTUAL || this.buttons[0].buttonStyle === undefined) {
if (this.buttons[HORIZON_BUTTON_MAX_COUNT ... | AST#method_declaration#Left private getDividerColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary... | private getDividerColor(): ResourceColor {
if (!this.buttons || this.buttons.length === 0 || !DIALOG_DIVIDER_SHOW) {
return Color.Transparent;
}
if (this.buttons[0].buttonStyle === ButtonStyleMode.TEXTUAL || this.buttons[0].buttonStyle === undefined) {
if (this.buttons[HORIZON_BUTTON_MAX_COUNT ... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1465-L1477 | 5dc95e151e61b21dc5e8d06e3988fda9c2cd6acd | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationCenterService.ets | arkts | updateConfig | 更新配置 | public updateConfig(newConfig: Partial<NotificationCenterConfig>): void {
if (newConfig.maxNotifications !== undefined) this.config.maxNotifications = newConfig.maxNotifications;
if (newConfig.autoDeleteAfterDays !== undefined) this.config.autoDeleteAfterDays = newConfig.autoDeleteAfterDays;
if (newConfig.g... | AST#method_declaration#Left public updateConfig AST#parameter_list#Left ( AST#parameter#Left newConfig : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left NotificationCenterConfig AST#primary_type#Right AST#type_annotati... | public updateConfig(newConfig: Partial<NotificationCenterConfig>): void {
if (newConfig.maxNotifications !== undefined) this.config.maxNotifications = newConfig.maxNotifications;
if (newConfig.autoDeleteAfterDays !== undefined) this.config.autoDeleteAfterDays = newConfig.autoDeleteAfterDays;
if (newConfig.g... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationCenterService.ets#L328-L339 | 1d1f7975e4280470e9d0e904f07fd48e8e3e3008 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets | arkts | setStateChangeCallback | 状态机上报回调函数 | async setStateChangeCallback(): Promise<void> {
this.avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
logger.info('stateChange callback function is triggered,state is:' + state + ',reason is :' + reason);
switch (state) {
// 闲置状态
case 'idle':
... | AST#method_declaration#Left async setStateChangeCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : 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_annota... | async setStateChangeCallback(): Promise<void> {
this.avPlayer.on('stateChange', async (state: string, reason: media.StateChangeReason) => {
logger.info('stateChange callback function is triggered,state is:' + state + ',reason is :' + reason);
switch (state) {
case 'idle':
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videolistautoplay/src/main/ets/view/XComponentVideo.ets#L213-L233 | 7b2f9d004548c801b6cfa7bfe645d368f61ab6b0 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ToolBarV2.d.ets | arkts | padding | Sets the left and right padding of the toolbarV2.
@param { LengthMetrics } padding - left and right padding.
@returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier.
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 18 | padding(padding: LengthMetrics): ToolBarV2Modifier; | AST#method_declaration#Left padding AST#parameter_list#Left ( AST#parameter#Left padding : AST#type_annotation#Left AST#primary_type#Left LengthMetrics AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarV2Modifier AST#p... | padding(padding: LengthMetrics): ToolBarV2Modifier; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L579-L579 | 3efc1f7ab272039675f69fbf171cca1f8046b0cb | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets | arkts | deleteSelected | Delete the selected item and exit the editing mode. | deleteSelected() {
DataModel.deleteData(this.selectArray);
this.targetData = DataModel.getData();
this.overAllProgressChanged = !this.overAllProgressChanged;
this.isEditMode = false;
} | AST#method_declaration#Left deleteSelected 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 DataModel AST#expression#Right . deleteData AST#m... | deleteSelected() {
DataModel.deleteData(this.selectArray);
this.targetData = DataModel.getData();
this.overAllProgressChanged = !this.overAllProgressChanged;
this.isEditMode = false;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/view/TargetList.ets#L127-L132 | b4f39a522fdf85ac4b07fff6459bbff074103d15 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/login/LoginView.ets | arkts | checkAggree | 检查是否同意协议 | private checkAggree(): boolean {
if (!this.isAgree) {
this.shakeCheckAgree()
Toast.showMessage($r('app.string.login_agree_tip'))
return false;
}
return true;
} | AST#method_declaration#Left private checkAggree AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean 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#Left AST#m... | private checkAggree(): boolean {
if (!this.isAgree) {
this.shakeCheckAgree()
Toast.showMessage($r('app.string.login_agree_tip'))
return false;
}
return true;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/login/LoginView.ets#L324-L331 | 6934e052832f9e8f6929f878ebf1f6db38b5b644 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets | arkts | transitionFromDown | 底部弹出动画
@param duration 动画时间
@returns | static transitionFromDown(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ dela... | AST#method_declaration#Left static transitionFromDown AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_an... | static transitionFromDown(duration: number = 200): TransitionEffect {
return TransitionEffect.asymmetric(
TransitionEffect.OPACITY.animation({ duration: duration }).combine(
TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: duration })),
TransitionEffect.OPACITY.animation({ dela... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets#L36-L43 | 41f5424815235ead950b04efb74624f872c65799 | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/an0n-chat-lib/0.1.5/package/build/postinstall.ets | arkts | exit | 模拟process.exit() | function exit(code: number): void {
// 使用ArkTS应用管理API终止应用
} | AST#function_declaration#Left function exit AST#parameter_list#Left ( AST#parameter#Left code : 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_type#Rig... | function exit(code: number): void {
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/postinstall.ets#L23-L25 | edcb66a98a4a5ab8c9e56e457ee8bc72ab8053d9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | setPositionXY | 设置坐标
@param { RaisedCircleSetPostionXYType } obj | setPositionXY(position: RaisedCircleSetPostionXYType): void {
if (position.x || position.x === 0) {
this.oldPositionX = this.positionX;
this.positionX = position.x;
}
if (position.y || position.y === 0) {
this.oldPositionY = this.positionY
this.positionY = position.y;
}
} | AST#method_declaration#Left setPositionXY AST#parameter_list#Left ( AST#parameter#Left position : AST#type_annotation#Left AST#primary_type#Left RaisedCircleSetPostionXYType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v... | setPositionXY(position: RaisedCircleSetPostionXYType): void {
if (position.x || position.x === 0) {
this.oldPositionX = this.positionX;
this.positionX = position.x;
}
if (position.y || position.y === 0) {
this.oldPositionY = this.positionY
this.positionY = position.y;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L139-L148 | 92c23f7f643976217a3e3697834301ca1b1b16f6 | gitee |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | onSessionErrorChange | 监听捕获会话错误变化
@param session - 相机捕获会话对象
@returns 无返回值 | onSessionErrorChange(session: camera.PhotoSession | camera.VideoSession): void {
try {
session.on('error', (captureSessionError: BusinessError): void => {
Logger.info(TAG,
'onCaptureSessionErrorChange captureSession fail: ' + JSON.stringify(captureSessionError.code));
});
} catch (... | AST#method_declaration#Left onSessionErrorChange AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left camera . PhotoSession AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left camera ... | onSessionErrorChange(session: camera.PhotoSession | camera.VideoSession): void {
try {
session.on('error', (captureSessionError: BusinessError): void => {
Logger.info(TAG,
'onCaptureSessionErrorChange captureSession fail: ' + JSON.stringify(captureSessionError.code));
});
} catch (... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L690-L699 | f1614717e56ed6dc52b36689be34ded45a0659b1 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/rssSourcesUtils.ets | arkts | getRssSourcesGroup | 获取订阅分组 | async getRssSourcesGroup(){
let rssSourcesGroup = await rssSourceGroupDao.search();
//根据排序顺序存储到string[]
let rssSourcesGroupName:string[] = [];
for(let i=0;i<rssSourcesGroup.length;i++){
rssSourcesGroupName.push(rssSourcesGroup[i].rssGroupName)
}
return rssSourcesGroupName
} | AST#method_declaration#Left async getRssSourcesGroup AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rssSourcesGroup = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#... | async getRssSourcesGroup(){
let rssSourcesGroup = await rssSourceGroupDao.search();
let rssSourcesGroupName:string[] = [];
for(let i=0;i<rssSourcesGroup.length;i++){
rssSourcesGroupName.push(rssSourcesGroup[i].rssGroupName)
}
return rssSourcesGroupName
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/rssSourcesUtils.ets#L43-L51 | 0f70d6756c96328b34c9ed8faebc652371f1f73d | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets | arkts | isDbOpenable | ========================================================== 判断数据库能否打开(取第一条记录检查) ========================================================== | async isDbOpenable(): Promise<boolean> {
return (await this.getBaseWordById(1)) !== null;
} | AST#method_declaration#Left async isDbOpenable 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_... | async isDbOpenable(): Promise<boolean> {
return (await this.getBaseWordById(1)) !== null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L71-L73 | 8b1ae24ef6fd3797919c7a4cfe377aa63168f4e7 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | disableShortcut | 禁用快捷方式 | async disableShortcut(shortcutId: string): Promise<void> {
try {
await shortcutManager.disableShortcut(shortcutId);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Shortcut disabled: ${shortcutId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Faile... | AST#method_declaration#Left async disableShortcut AST#parameter_list#Left ( AST#parameter#Left shortcutId : 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_t... | async disableShortcut(shortcutId: string): Promise<void> {
try {
await shortcutManager.disableShortcut(shortcutId);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Shortcut disabled: ${shortcutId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Faile... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L308-L315 | 9392d272632abc5c3f5ad9f163437f38eca18e6f | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | getWordsByIds | MARK: - Words from wordIds /获取指定[wordIds]的Words | getWordsByIds(wordIds: number[]): WordUser[] {
//过滤掉deleted状态的words
//使用SearchManager.shared.getAliveWords()获取所有活跃单词
const aliveWords = SearchManager.shared.getAliveWords();
//使用Set来提高查找效率
const wordIdSet = new Set(wordIds);
//过滤出包含在wordIds中的单词
return aliveWords.filter(word => word... | AST#method_declaration#Left getWordsByIds AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left A... | getWordsByIds(wordIds: number[]): WordUser[] {
const aliveWords = SearchManager.shared.getAliveWords();
const wordIdSet = new Set(wordIds);
return aliveWords.filter(word => wordIdSet.has(word.idx ?? 0));
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L381-L391 | d524158e60bef0ed0a64040aa8b5d5270e1a0ca7 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | route for secondPage | export const SECOND_PAGE: string = 'pages/Second'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SECOND_PAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/Second' AST#expression#Right AST#variable_declarator#Right ; AST#variable_... | export const SECOND_PAGE: string = 'pages/Second'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L19 | cc0cfff41071322f8f64ae388f813ac6b60cf024 | gitee | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets | arkts | themeItemBuilder | 构建个性主题下列表元素 | @Builder
themeItemBuilder(item: ThemeItem, index: number) {
Column({space: 8}) {
Column() {
if (this.activeIndex == index) {
Text('使用中')
.fontSize(9)
.fontColor('#fff')
.backgroundColor('#ef4444')
.textAlign(TextAlign.Center)
.lin... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right themeItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ThemeItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation... | @Builder
themeItemBuilder(item: ThemeItem, index: number) {
Column({space: 8}) {
Column() {
if (this.activeIndex == index) {
Text('使用中')
.fontSize(9)
.fontColor('#fff')
.backgroundColor('#ef4444')
.textAlign(TextAlign.Center)
.lin... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyThemeConfigComp.ets#L73-L106 | 0b8dfdf76e63260b69005284a56ec5caf63729ba | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets | arkts | Numbers.ets | export const one : number = 1; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left one : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST... | export const one : number = 1; | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment6.ets#L57-L57 | 8201300d28002c456a67dcfa2b86f9155d8cd6df | gitee | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | getPendingTasks | 获取未完成任务 | getPendingTasks(): TaskItem[] {
return this.tasks.filter(task => !task.completed);
} | AST#method_declaration#Left getPendingTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left... | getPendingTasks(): TaskItem[] {
return this.tasks.filter(task => !task.completed);
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L463-L465 | b2ed75acc984f9dca7d52e39c8234f2a51e0a867 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/AVPlayer/AVPlayerArkTSURL/entry/src/main/ets/pages/Index.ets | arkts | setAVPlayerCallback | 注册avplayer回调函数 | async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void, vType?: number): Promise<void> {
// seek操作结果回调函数
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init!`);
return;
}
this.avPlayer.on('seekDone', (seekDoneTime) => {
console.info(`${this.tag... | AST#method_declaration#Left async setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type... | async setAVPlayerCallback(callback: (avPlayer: media.AVPlayer) => void, vType?: number): Promise<void> {
if (this.avPlayer == null) {
console.info(`${this.tag}: avPlayer has not init!`);
return;
}
this.avPlayer.on('seekDone', (seekDoneTime) => {
console.info(`${this.tag}: setAVPlayerC... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVPlayer/AVPlayerArkTSURL/entry/src/main/ets/pages/Index.ets#L267-L307 | 929cffa67cbc5c59a4364d74c8203dad43a3818a | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | getHeight | 获取设备的屏幕高度,单位为px。
@returns | static getHeight(): number {
return DisplayUtil.getDefaultDisplaySync().height;
} | AST#method_declaration#Left static getHeight AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express... | static getHeight(): number {
return DisplayUtil.getDefaultDisplaySync().height;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L71-L73 | 52e415d0bdd2be038fa0677a4fb49e4ed7c9a4ff | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets | arkts | Defines toolBar symbolGlyph options.
@interface ToolBarSymbolGlyphOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 13 | export interface ToolBarSymbolGlyphOptions {
/**
* Modifier of toolbar's normal symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/
normal?: SymbolGlyphModifier;
/**
* Modifier of toolbar's activated s... | AST#export_declaration#Left export AST#interface_declaration#Left interface ToolBarSymbolGlyphOptions AST#object_type#Left { /**
* Modifier of toolbar's normal symbol.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 13
*/ AST#ty... | export interface ToolBarSymbolGlyphOptions {
normal?: SymbolGlyphModifier;
activated?: SymbolGlyphModifier;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L80-L99 | 3a31ba8176418feb35ecf464afd0cab97f609230 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets | arkts | getVp | Obtains the screen horizontal adaptation vp. | static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
} | AST#method_declaration#Left static getVp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | static getVp(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return px2vp(DimensionUtil.adaptDimension(beforeVp));
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/AnimateRefresh/entry/src/main/ets/common/utils/DimensionUtil.ets#L46-L49 | 1c26e02e8f9b4cb45571b2de4a9c54261e76193a | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/storage/StorageManager.ets | arkts | setContext | 设置 Context(需要在应用启动时调用) | setContext(context: common.UIAbilityContext): void {
this.context = context;
this.init();
} | AST#method_declaration#Left setContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty... | setContext(context: common.UIAbilityContext): void {
this.context = context;
this.init();
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L29-L32 | 85677b608d8243867dd2c40b8fc56e3bff048b86 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/builder/PlayerSettingBuilder.ets | arkts | CommonSettingView | 常用设置底部弹窗视图 | @Component
export struct CommonSettingView {
public config?:VHPlayerConfig;
scroller: Scroller = new Scroller();
getSecondSectionActionItems():ActionItem[]{
let actionItems:ActionItem[] =
[{ id: '1001', title: '弹幕', subTitle: $r('app.media.barrage') ,switchType:true,enable:this.config?.basic?.barrage... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonSettingView AST#component_body#Left { AST#property_declaration#Left public config ? : AST#type_annotation#Left AST#primary_type#Left VHPlayerConfig AST#primary_type#Right AST#type_annotation#Right ; AST#property... | @Component
export struct CommonSettingView {
public config?:VHPlayerConfig;
scroller: Scroller = new Scroller();
getSecondSectionActionItems():ActionItem[]{
let actionItems:ActionItem[] =
[{ id: '1001', title: '弹幕', subTitle: $r('app.media.barrage') ,switchType:true,enable:this.config?.basic?.barrage... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/PlayerSettingBuilder.ets#L137-L210 | b160f911c3970b0860fc964238f552bf0618751a | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/components/PaletteComponent.ets | arkts | 画板控制器 | export interface PaletteController {
refreshScale: (scale: number) => void;
refreshColor: (color: string) => void;
refreshBrushSize: (size: number) => void;
undo: (data: PaletteData) => void;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PaletteController AST#object_type#Left { AST#type_member#Left refreshScale : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | export interface PaletteController {
refreshScale: (scale: number) => void;
refreshColor: (color: string) => void;
refreshBrushSize: (size: number) => void;
undo: (data: PaletteData) => void;
} | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/PaletteComponent.ets#L25-L30 | a01d273ec9985ee1b6cf0081d3f79b6a720bf08c | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets | arkts | / 初始化时传入 PrefName | constructor(prefName: string) {
this.prefName = prefName;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left prefName : 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#expression_statemen... | constructor(prefName: string) {
this.prefName = prefName;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfoManager.ets#L14-L16 | dca3ed862524aea1bea5c1f032c1173c8d5a32e6 | github | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/function_var/function_var_001_T.ets | arkts | Introduction 变量函数 | export function function_var_001_T(taint_src : string){
let f = taint.Sink;
f(taint_src);
} | AST#export_declaration#Left export AST#function_declaration#Left function function_var_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | export function function_var_001_T(taint_src : string){
let f = taint.Sink;
f(taint_src);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/function_var/function_var_001_T.ets#L6-L9 | 8020912cc0ad1abd22a0851da351b6064c2d71f0 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_key_shortcuts.ets | arkts | load_string | Loads a string as a key combination, OVERWRITING whatever this combination was.
@param combination A string, containing the keys.
e.g. 'a ctrl shift' | load_string(combination: string) {
if (combination == '') {
return;
}
let keys_split = combination.split(' ');
this.load_string_array(keys_split);
} | AST#method_declaration#Left load_string AST#parameter_list#Left ( AST#parameter#Left combination : 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#if_statement#Left if ... | load_string(combination: string) {
if (combination == '') {
return;
}
let keys_split = combination.split(' ');
this.load_string_array(keys_split);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L228-L234 | 38ea14725a91c2eb4c9923613361f73fc7b9763c | gitee |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/utils/GestureUtils.ets | arkts | applyResistance | 应用阻力效果
@param delta - 原始位移
@param resistance - 阻力系数
@returns 应用阻力后的位移 | static applyResistance(delta: number, resistance: number): number {
return delta * resistance;
} | AST#method_declaration#Left static applyResistance AST#parameter_list#Left ( AST#parameter#Left delta : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resistance : AST#type_annotation#Left AST#primary_type#Left number AST#p... | static applyResistance(delta: number, resistance: number): number {
return delta * resistance;
} | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L223-L225 | 8fb9e9090f6e3ace4091b7326ab0e558fda99c07 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/view/CustomKeyboardToH5.ets | arkts | CustomKeyboardToH5 | Divider压缩比例
实现步骤:
1. 构建一个 Browser 对象,集成浏览器的方法。创建一个自定义组件 TabletTitle,构成浏览器的工具栏。
2. 自定义键盘传入js对象 WebKeyboardObj, 构建两个函数:点击登录按钮事件和输入法弹窗弹出事件。其中输入法弹出事件中使用CustomDialog修饰的组件,打开自定义弹窗。
3. 将webKeyboardObj对象通过webController.registerJavaScriptProxy注册到h5页面中,使页面中可以调用arkTS的方法。
4. 构建一个h5页面,在js层中调用注册进入的arkTS方法。 | @Component
export struct CustomKeyboardToH5 {
@State browser: Browser = new Browser(); // 浏览器对象
build() {
Column() {
TabletTitle({ browser: $browser })
Progress({ value: this.browser.progress, total: PROGRESS_TOTAL })
.color($r('app.color.custom_keyboard_to_h5_progress_color'))
.vis... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomKeyboardToH5 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right browser : AST#type_annotation#Left AST#primary_type#Left Browser AST#primary_type#Right AST#typ... | @Component
export struct CustomKeyboardToH5 {
@State browser: Browser = new Browser();
build() {
Column() {
TabletTitle({ browser: $browser })
Progress({ value: this.browser.progress, total: PROGRESS_TOTAL })
.color($r('app.color.custom_keyboard_to_h5_progress_color'))
.visibility(... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/view/CustomKeyboardToH5.ets#L30-L47 | 47aee4d07f0f7164bb99470ff21f057368f4cb36 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/pages/user/settings.ets | arkts | saveDefaultSite | 保存默认站点设置 | private async saveDefaultSite(isT: boolean) {
try {
await setDefaultSite(isT);
this.defaultSiteT = isT;
} catch (error) {
console.error("保存默认站点设置失败:", error);
}
} | AST#method_declaration#Left private async saveDefaultSite AST#parameter_list#Left ( AST#parameter#Left isT : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statem... | private async saveDefaultSite(isT: boolean) {
try {
await setDefaultSite(isT);
this.defaultSiteT = isT;
} catch (error) {
console.error("保存默认站点设置失败:", error);
}
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L138-L145 | 6f5101cba51e59f475575e2fca107615d7ecc3de | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_defaults.ets | arkts | Default animation params.
@returns An AnimateParam, reading the arguments from app settings. | export function animation_default() {
let animation_damping_coefficient = AppStorage.get('animation_damping_coefficient') as number;
let animation_response = AppStorage.get('animation_response') as number;
let spring = Curves.springMotion(animation_response / 100, (100 - animation_damping_coefficient) / 100);
l... | AST#export_declaration#Left export AST#function_declaration#Left function animation_default AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animation_damping_coefficient = AST#expression#Left AST#as_express... | export function animation_default() {
let animation_damping_coefficient = AppStorage.get('animation_damping_coefficient') as number;
let animation_response = AppStorage.get('animation_response') as number;
let spring = Curves.springMotion(animation_response / 100, (100 - animation_damping_coefficient) / 100);
l... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L65-L71 | b4249288d6043a53ed5bb9241f466d843d7aae33 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/4equest/6.9.2/package/index.ets | arkts | 应用约束60:使用ES模块导出语法代替CommonJS | export default escapeUtils; | AST#export_declaration#Left export default AST#expression#Left escapeUtils AST#expression#Right ; AST#export_declaration#Right | export default escapeUtils; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/4equest/6.9.2/package/index.ets#L30-L30 | 7138ffe25768df20bd2aacc4526f13f4a943f949 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets | arkts | deleteData | 在指定索引位置移除一个元素 | public deleteData(index: number): void {
this.originDataArray.splice(index, 1);
this.notifyDataReload();
} | AST#method_declaration#Left public deleteData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#... | public deleteData(index: number): void {
this.originDataArray.splice(index, 1);
this.notifyDataReload();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets#L52-L55 | aca4f392925a88883fa783ad098675b3813ec8ca | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/utils/HttpUtil.ets | arkts | HTTP工具类 | export class HttpUtil {
private static readonly BASE_URL = AppConstants.API_BASE_URL;
private static readonly TIMEOUT = AppConstants.REQUEST_TIMEOUT;
/**
* 发送HTTP请求
* @param url 请求URL
* @param config 请求配置
* @returns Promise<HttpResponse>
*/
static async request<T = Object>(url: string, config: R... | AST#export_declaration#Left export AST#class_declaration#Left class HttpUtil AST#class_body#Left { AST#property_declaration#Left private static readonly BASE_URL = AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . API_BASE_URL AST#member_expression#Right AST#expressi... | export class HttpUtil {
private static readonly BASE_URL = AppConstants.API_BASE_URL;
private static readonly TIMEOUT = AppConstants.REQUEST_TIMEOUT;
static async request<T = Object>(url: string, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const httpRequest = http.createHttp();
try {
... | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L20-L177 | 8bffa5b5619338bbfca0a2ade31c69f35b519059 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets | arkts | The percentage of 20. | export const PERCENTAGE_20 = '20%'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PERCENTAGE_20 = AST#expression#Left '20%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const PERCENTAGE_20 = '20%'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbilityDemo/entry/src/main/ets/common/constants/Constants.ets#L45-L45 | 0ba9e10503cff2ff766e89d5f2ec5b98a56eeb2d | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | CanvasDraw/entry/src/main/ets/pages/Index.ets | arkts | startDraw | Generate a list of 1000 random positions between 0 and 1, and draw circles at the corresponding positions. | startDraw(): void {
this.pointsToDraw = [];
for (let index = 0; index < 1000; index++) {
this.pointsToDraw.push([Math.random(), Math.random()]);
}
} | AST#method_declaration#Left startDraw AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left... | startDraw(): void {
this.pointsToDraw = [];
for (let index = 0; index < 1000; index++) {
this.pointsToDraw.push([Math.random(), Math.random()]);
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/CanvasDraw/entry/src/main/ets/pages/Index.ets#L32-L37 | 7cea23665ef80a623afbeb9fc6961d4d8e59d901 | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider22.ets | arkts | buildSlider22 | Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 l... | @Builder function buildSlider22(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildSlider22 AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left SliderConfiguration AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li... | @Builder function buildSlider22(config: SliderConfiguration) {
Row() {
Column({space: 30}) {
Button('增加').onClick(() => {
config.value = config.value + config.step
config.triggerChange(config.value, SliderChangeMode.Click)
})
.width(100)
.height(25)
.fontSize(10... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_picker/ace_ets_module_picker_api12/entry/src/main/ets/MainAbility/pages/Slider/XcomponentSlider/XcomponentSlider22.ets#L16-L67 | 59a569c3b42826b87d4f18f7a07ffee17e5e6140 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | isSoundLoaded | 检查音效是否已加载
@param type 音效类型 | public isSoundLoaded(type: SEType): boolean {
return this.soundMap.has(type) && this.soundMap.get(type)! > 0;
} | AST#method_declaration#Left public isSoundLoaded AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left SEType 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_... | public isSoundLoaded(type: SEType): boolean {
return this.soundMap.has(type) && this.soundMap.get(type)! > 0;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L155-L157 | 70a043204bd1b9bc61f3300bdb20a2a88940a9ae | github |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/lib/Pointer.ets | arkts | get | Returns true if this pointer is not used and inactive, false otherwise. | get isNotUsed(): boolean {
return !this.isUsed;
} | AST#method_declaration#Left get AST#ERROR#Left isNotUsed AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expre... | get isNotUsed(): boolean {
return !this.isUsed;
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L174-L176 | 0d016ca1c84e63f86a8f3891e9ee657d355b691e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/staticImport/src/main/ets/model/GoodsModel.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 class GoodResponse {
code: number = 0
data: Records = new Records()
error: string = ''
} | AST#export_declaration#Left export AST#class_declaration#Left class GoodResponse AST#class_body#Left { AST#property_declaration#Left code AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right data : AST#type_a... | export class GoodResponse {
code: number = 0
data: Records = new Records()
error: string = ''
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/staticImport/src/main/ets/model/GoodsModel.ets#L16-L20 | 09aeee107f38b7f34fd7f59fac0f6eb04d93035d | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ComponentReuse/entry/src/main/ets/pages/Index.ets | arkts | [EndExclude example] | build() {
Column() {
// [StartExclude example]
Navigation(this.pageInfos) {
List({ space: this.LIST_SPACE }) {
ForEach(this.navDestinationData, (item: NavDestinationItem) => {
ListItem() {
Button(item.detail)
.width(Constants.LAYOUT_MAX)
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // [StartExclude example] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Navigation ( AST#expression#L... | build() {
Column() {
Navigation(this.pageInfos) {
List({ space: this.LIST_SPACE }) {
ForEach(this.navDestinationData, (item: NavDestinationItem) => {
ListItem() {
Button(item.detail)
.width(Constants.LAYOUT_MAX)
.height(40)
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/pages/Index.ets#L39-L83 | 6285645de010c08c267e163bc12c1619dc5769eb | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | VideoPlayerSample/entry/src/main/ets/view/VideoSide.ets | arkts | changeLikeCount | The callback function for the click event of the like button.
@param isAdd | private changeLikeCount(isAdd: boolean): void {
let likeCountNum: number = Number(this.item.likeCount);
if (isAdd) {
likeCountNum++;
} else {
likeCountNum--;
}
this.item.likeCount = '' + likeCountNum;
this.getUIContext().animateTo({ duration: Const.DURATION, curve: Curve.EaseInOut },... | AST#method_declaration#Left private changeLikeCount AST#parameter_list#Left ( AST#parameter#Left isAdd : 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 AST#primar... | private changeLikeCount(isAdd: boolean): void {
let likeCountNum: number = Number(this.item.likeCount);
if (isAdd) {
likeCountNum++;
} else {
likeCountNum--;
}
this.item.likeCount = '' + likeCountNum;
this.getUIContext().animateTo({ duration: Const.DURATION, curve: Curve.EaseInOut },... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/view/VideoSide.ets#L30-L41 | 1a35a955d95973debe1ca78905ce4f3fd20cb3be | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | Q1/Animation/entry/src/main/ets/pages/ForEachTransition.ets | arkts | fet_text | 诗词文本样式 | @Extend(Text) function fet_text() {
.width(300)
.height(60)
.fontSize(18)
.margin({ top: 3 })
.backgroundColor(Color.Pink)
.textAlign(TextAlign.Center)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fet_text AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 300 AST#expres... | @Extend(Text) function fet_text() {
.width(300)
.height(60)
.fontSize(18)
.margin({ top: 3 })
.backgroundColor(Color.Pink)
.textAlign(TextAlign.Center)
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/Animation/entry/src/main/ets/pages/ForEachTransition.ets#L59-L66 | b0d71d19dbfd44975c5f5466b6b95bc32468bc0f | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets | arkts | getXMax | returns the maximum x-value this DataSet holds
@return | getXMax(): number {
return 0;
} | AST#method_declaration#Left getXMax 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 0 AST#expression#Right ; AS... | getXMax(): number {
return 0;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/BaseDataSet.ets#L483-L485 | 725d3dea4b8858e7810b2e6b9951cfefcfdaee31 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/huawei/utils/IapDataModel.ets | arkts | Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. | export interface PurchaseData {
type: number;
jwsPurchaseOrder?: string;
jwsSubscriptionStatus?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PurchaseData AST#object_type#Left { AST#type_member#Left type : 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 jwsPurchaseOrder ? : AST#type_an... | export interface PurchaseData {
type: number;
jwsPurchaseOrder?: string;
jwsSubscriptionStatus?: string;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/utils/IapDataModel.ets#L5-L9 | 3fad7e3bc73ae4923b8ef9b2100d4eb55132f093 | github | |
weboose/jellyfin-sdk-arkts.git | 826b1dabd29c5d4702d3d4a31e358114fb5b7c91 | entry/src/main/ets/viewmodel/OptionsViewModel.ets | arkts | validate | 检测是否参数有效 | validate(){
if(!this.server || this.server === ''){
return false;
}
if(!this.username || this.username === ''){
return false;
}
if(!this.password || this.password === ''){
return false;
}
if(!this.serverVersion || this.serverVer... | AST#method_declaration#Left validate 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 AST#binary_expression#Left AST#expression#L... | validate(){
if(!this.server || this.server === ''){
return false;
}
if(!this.username || this.username === ''){
return false;
}
if(!this.password || this.password === ''){
return false;
}
if(!this.serverVersion || this.serverVer... | https://github.com/weboose/jellyfin-sdk-arkts.git/blob/826b1dabd29c5d4702d3d4a31e358114fb5b7c91/entry/src/main/ets/viewmodel/OptionsViewModel.ets#L16-L31 | 18aa418824f84cdd82c1a4940eae9d4077e1cd69 | github |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/pages/SplashPage.ets | arkts | aboutToAppear | 新增状态,用于控制导航 | aboutToAppear() {
// 立即开始预加载天气数据
this.preloadData();
// 图片动画
animateTo({
duration: 1000,
curve: Curve.EaseOut,
}, () => {
this.logoScale = 1
this.logoOpacity = 1
})
// 文字动画,延迟500ms开始
setTimeout(() => {
animateTo({
duration: 800,
curve: ... | AST#method_declaration#Left aboutToAppear 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#Left this AST#expression#Ri... | aboutToAppear() {
this.preloadData();
animateTo({
duration: 1000,
curve: Curve.EaseOut,
}, () => {
this.logoScale = 1
this.logoOpacity = 1
})
setTimeout(() => {
animateTo({
duration: 800,
curve: Curve.EaseOut,
}, () => {
... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/SplashPage.ets#L18-L67 | 6bf6ec6d618af365d6b266077ec88516b4ed1aeb | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SimpleBirthdayApp.ets | arkts | aboutToAppear | 页面生命周期 - 页面即将出现 | async aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToAppear - starting');
console.log('[SimpleBirthdayApp] Page aboutToAppear called');
try {
await this.initializePage();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Simple... | AST#method_declaration#Left async aboutToAppear 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#Left hilog AST#expression#Right . in... | async aboutToAppear() {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'SimpleBirthdayApp page aboutToAppear - starting');
console.log('[SimpleBirthdayApp] Page aboutToAppear called');
try {
await this.initializePage();
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Simple... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L62-L73 | cc336c2eab526159c71b40758ceaee3d0cead439 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/FileUtility.ets | arkts | createFolderIfNeeds | 创建目录(递归) | static createFolderIfNeeds(path: string): void {
try {
if (!fs.accessSync(path)) {
fs.mkdirSync(path, true);
}
} catch (e) {
console.error(`创建目录失败: ${JSON.stringify(e)}`);
}
} | AST#method_declaration#Left static createFolderIfNeeds 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 void AST#prima... | static createFolderIfNeeds(path: string): void {
try {
if (!fs.accessSync(path)) {
fs.mkdirSync(path, true);
}
} catch (e) {
console.error(`创建目录失败: ${JSON.stringify(e)}`);
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L183-L192 | 8ed3ed25855ad0072a685c0d7b0aeafc692f231a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | generateYearMapping | 生成指定年份的完整映射数据 | async generateYearMapping(year: number): Promise<YearMappingData> {
if (this.mappingCache.has(year)) {
return this.mappingCache.get(year)!;
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[LunarSolarMapping] Generating mapping for year ${year}`);
const yearData: YearMappingData = {
... | AST#method_declaration#Left async generateYearMapping AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ... | async generateYearMapping(year: number): Promise<YearMappingData> {
if (this.mappingCache.has(year)) {
return this.mappingCache.get(year)!;
}
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[LunarSolarMapping] Generating mapping for year ${year}`);
const yearData: YearMappingData = {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L90-L152 | 3327c90085e1a2102f9c6d842bf413b6224f2a30 | github |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/api.ets | arkts | 收藏列表
@param date
@returns | export function getCollectList(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `lg/collect/list/${page}/json`,
showLoading:true
})
} | AST#export_declaration#Left export AST#function_declaration#Left function getCollectList 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 { AS... | export function getCollectList(page:number) {
return axiosClient.get<HomeArticleModel>({
url: `lg/collect/list/${page}/json`,
showLoading:true
})
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/api.ets#L313-L318 | 611f116a65f6374e021030f744586a47c7ead27a | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getCenterTextRadiusPercent | the rectangular radius of the bounding box for the center text, as a percentage of the pie
hole
default 1.f (100%) | public getCenterTextRadiusPercent(): number {
return this.mCenterTextRadiusPercent;
} | AST#method_declaration#Left public getCenterTextRadiusPercent 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 A... | public getCenterTextRadiusPercent(): number {
return this.mCenterTextRadiusPercent;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L799-L801 | 3a35a46ac03adc7927bbaebb04c18a1434125bc8 | gitee |
CQULeaf/HarmonyOS-App-Development.git | 91f6ab13be3dbf83f6c1c4d2958673f15faefe46 | Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets | arkts | setListener | 设置回调 | private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => {
}) {
// 创建回调对象
let setListener: speechRecognizer.RecognitionListener = {
// 开始识别成功回调
onStart(sessionId: string, eventMessage: string) {
console.log('识别开始', sessionId, eventMessage);
... | AST#method_declaration#Left private static setListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left srr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left speechRecognizer . SpeechRecognitionRes... | private static setListener(callback: (srr: speechRecognizer.SpeechRecognitionResult) => void = () => {
}) {
let setListener: speechRecognizer.RecognitionListener = {
onStart(sessionId: string, eventMessage: string) {
console.log('识别开始', sessionId, eventMessage);
},
onE... | https://github.com/CQULeaf/HarmonyOS-App-Development.git/blob/91f6ab13be3dbf83f6c1c4d2958673f15faefe46/Lab3/entry/src/main/ets/utils/SpeechRecognizerManager.ets#L49-L79 | 4de5abcbd179f9cc9b76c24ff1b60b9e0027e253 | github |
DompetApp/Dompet.harmony.git | ba5aae3d265458588a4866a71f9ac55bbd0a4a92 | entry/src/main/ets/configure/device.ets | arkts | updateWindowSize | @throws | updateWindowSize(_: window.Size) {
const displayClass = display.getDefaultDisplaySync()
this.foldDisplayMode = display.getFoldDisplayMode()
this.orientation = displayClass.orientation
this.foldStatus = display.getFoldStatus()
this.isFoldable = display.isFoldable()
this.height = displayClass.heig... | AST#method_declaration#Left updateWindowSize AST#parameter_list#Left ( AST#parameter#Left _ : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#... | updateWindowSize(_: window.Size) {
const displayClass = display.getDefaultDisplaySync()
this.foldDisplayMode = display.getFoldDisplayMode()
this.orientation = displayClass.orientation
this.foldStatus = display.getFoldStatus()
this.isFoldable = display.isFoldable()
this.height = displayClass.heig... | https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/device.ets#L100-L110 | 678dab8ef02d523f4ccb8b1300db81831f3aefb0 | github |
yangsongming/ArkTs-HuXiHelper.git | ed148299fc6dcf351bcc0f2863a5aee4885fbaf5 | ets/controller/MapController.ets | arkts | getResourceString | Obtains the resource name.
@param resource Resource file.
@returns Resource File Name. | getResourceString(resource: Resource): string {
let resourceString: string = '';
try {
resourceString = getContext(this).resourceManager.getStringSync(resource.id);
} catch (error) {
Logger.error(TAG, `getResourceString failed, error is ${JSON.stringify(error)}`);
}
return resourceString... | AST#method_declaration#Left getResourceString AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource 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#primar... | getResourceString(resource: Resource): string {
let resourceString: string = '';
try {
resourceString = getContext(this).resourceManager.getStringSync(resource.id);
} catch (error) {
Logger.error(TAG, `getResourceString failed, error is ${JSON.stringify(error)}`);
}
return resourceString... | https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/controller/MapController.ets#L129-L137 | 2123da0b61f702353a9608438fb143aefec406b0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets | arkts | SecondaryLinkExample | 每个TAG对应多少个元素
功能描述: 本示例主要介绍了List组件实现二级联动(Cascading List)的场景
推荐场景: 需要使用多级列表联合滚动的场景,如:外卖点单页面等
核心组件:
1. SecondaryLinkExample.tagListItemBuilder
实现步骤:
1. 一二级列表分别绑定不同的Scroller对象,一级列表(tagLists)绑定classifyScroller对象,二级列表绑定scroller对象
2. 点击一级列表后,通过一级列表的索引获取二级列表的索引,调用scrollToIndex方法将一二级列表滚动到指定索引值
3. 滑动二级列表触发组件滚动事件后,获取到列表可视区域第一... | @Component
export struct SecondaryLinkExample {
@State @Watch('onIndexChange') currentTagIndex: number = 0; // 一级列表焦点索引值
private tagLists: Array<string> = []; // 一级列表数据
@State contentData: MyDataSource = new MyDataSource(); // 二级列表数据
private records: Array<number> = []; // 二级列表分组count数量
// TODO:知识点: 1.级联列表分别绑... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SecondaryLinkExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onIndexChange' AST#expression#Right ) AST#d... | @Component
export struct SecondaryLinkExample {
@State @Watch('onIndexChange') currentTagIndex: number = 0;
private tagLists: Array<string> = [];
@State contentData: MyDataSource = new MyDataSource();
private records: Array<number> = [];
private classifyScroller: Scroller = new Scroller();
private s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets#L34-L263 | 6e779d5f4b7575e161580b3e7e96262ca138656e | gitee |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets | arkts | get | 应用约束1:添加返回类型注解 | get status(): number {
return this.client.ws.connection ? Constants.Status.IDLE : Constants.Status.IDLE;
} | AST#method_declaration#Left get AST#ERROR#Left status AST#ERROR#Right 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#expressio... | get status(): number {
return this.client.ws.connection ? Constants.Status.IDLE : Constants.Status.IDLE;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets#L41-L43 | cef80d40f41da7ad4a3e314e6c4143e1312b5907 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Connectivity/Bluetooth/entry/src/main/ets/constants/StyleConstants.ets | arkts | Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 l... | export default class StyleConstants {
/**
* navigation bar height
*/
public static readonly HEIGHT_NAVIGATION_BAR = 64;
} | AST#export_declaration#Left export default AST#class_declaration#Left class StyleConstants AST#class_body#Left { /**
* navigation bar height
*/ AST#property_declaration#Left public static readonly HEIGHT_NAVIGATION_BAR = AST#expression#Left 64 AST#expression#Right ; AST#property_declaration#Right } AST#class_body... | export default class StyleConstants {
public static readonly HEIGHT_NAVIGATION_BAR = 64;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/Bluetooth/entry/src/main/ets/constants/StyleConstants.ets#L16-L21 | 2c139226ad963d15416860edfd3ff15fcd8e7636 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/processes/init_process.ets | arkts | settings | Hosts
Inits both settings and tabs.
@param t0 Start time of the whole initialization process. | async function settings(storage: LocalStorage) {
await bunch_of_settings.init();
// DEV_MODE
AppStorage.setOrCreate('DEV_MODE', bunch_of_settings.get('DEV_MODE') as boolean);
// UI Status
AppStorage.setOrCreate('title_bar_position', bunch_of_settings.get('title_bar_position') as string);
AppStorage.setOrC... | AST#function_declaration#Left async function settings AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expre... | async function settings(storage: LocalStorage) {
await bunch_of_settings.init();
AppStorage.setOrCreate('DEV_MODE', bunch_of_settings.get('DEV_MODE') as boolean);
AppStorage.setOrCreate('title_bar_position', bunch_of_settings.get('title_bar_position') as string);
AppStorage.setOrCreate('tabs_style', bun... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L251-L404 | 86cddaed429b7802adc75f79156d25bc1c22a6b8 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | getDashPathEffect | returns the DashPathEffect that is set for this LimitLine
@return | public getDashPathEffect(): DashPathEffect {
return this.mDashPathEffect;
} | AST#method_declaration#Left public getDashPathEffect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DashPathEffect AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AS... | public getDashPathEffect(): DashPathEffect {
return this.mDashPathEffect;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets#L140-L142 | 9cecdfef2789f4099abbe3c6dc31764fdc2d25e5 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets | arkts | encodeText | Returns a QR Code representing the given Unicode text string at the given error correction level. As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible QR Code ... | public static encodeText(text: string, ecl: QrCode.Ecc): QrCode {
const segs: Array<QrSegment> = qrcodegen.QrSegment.makeSegments(text);
return QrCode.encodeSegments(segs, ecl);
} | AST#method_declaration#Left public static encodeText 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 ecl : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type... | public static encodeText(text: string, ecl: QrCode.Ecc): QrCode {
const segs: Array<QrSegment> = qrcodegen.QrSegment.makeSegments(text);
return QrCode.encodeSegments(segs, ecl);
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets#L61-L64 | 9310c961f79232b1b3ded5190cd036230590d00b | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | alignment | 弹窗滑出方向
@description 默认为true
@param autoCancel
@returns | alignment(alignment: DialogAlignment) {
this.builderOptions.alignment = alignment;
return this;
} | AST#method_declaration#Left alignment AST#parameter_list#Left ( AST#parameter#Left alignment : AST#type_annotation#Left AST#primary_type#Left DialogAlignment AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_state... | alignment(alignment: DialogAlignment) {
this.builderOptions.alignment = alignment;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L99-L102 | 8fce26d90526acdb683c2ffe9166f4ec1707e2cc | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets | arkts | getBuilderNode | 获取BuilderNode节点 | getBuilderNode(): BuilderNode<[Params]> | undefined | null {
return this.rootNode;
} | AST#method_declaration#Left getBuilderNode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#generic_type#Left BuilderNode AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left A... | getBuilderNode(): BuilderNode<[Params]> | undefined | null {
return this.rootNode;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativeembed/src/main/ets/view/NativeEmbedView.ets#L103-L105 | d9a206c8f95bc36c2fbdcade1a63d64bbac3a21b | gitee |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/Shoucang.ets | arkts | aboutToAppear | 页面加载时获取收藏数据 | aboutToAppear() {
this.getCollectData();
} | AST#method_declaration#Left aboutToAppear 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 this AST#expression#Right . getCollectData AST#mem... | aboutToAppear() {
this.getCollectData();
} | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/Shoucang.ets#L90-L92 | e59c589de7b27e7bc5b95a13bb71038e5e5228ea | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/MorseCode.ets | arkts | decode | 将摩斯密码转换为文本
@param morse 摩斯密码字符串
@returns 原始文本 | static decode(morse: string): string {
if (!morse) {
return '';
}
return morse.split(' ').map(code => {
const char = MorseCode.REVERSE_MORSE_CODE_MAP.get(code);
return char || code;
}).join('');
} | AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left morse : 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#Ri... | static decode(morse: string): string {
if (!morse) {
return '';
}
return morse.split(' ').map(code => {
const char = MorseCode.REVERSE_MORSE_CODE_MAP.get(code);
return char || code;
}).join('');
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/MorseCode.ets#L45-L54 | e5838059ed65023729b3cb0594b3f3aecc7d5d8c | github |
junw2024/hnchain-ArkTs.git | 0cc3c182ad418709b577fa24e9fe909a205232c6 | entry/src/main/ets/common/utils/http/HttpUtils.ets | arkts | handleResult | 导出httpRequest请求函数 | function handleResult(responseResult:Promise<http.HttpResponse>): Promise<Response> {
let response = new Response();
return responseResult.then((val: http.HttpResponse)=>{
if(val.responseCode === http.ResponseCode.OK) {
let res: Response = JSON.parse(`${val.result}`)
return res
}else {
res... | AST#function_declaration#Left function handleResult AST#parameter_list#Left ( AST#parameter#Left responseResult : 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 AST#qualified_type#Left http . HttpResponse AST#qualifie... | function handleResult(responseResult:Promise<http.HttpResponse>): Promise<Response> {
let response = new Response();
return responseResult.then((val: http.HttpResponse)=>{
if(val.responseCode === http.ResponseCode.OK) {
let res: Response = JSON.parse(`${val.result}`)
return res
}else {
res... | https://github.com/junw2024/hnchain-ArkTs.git/blob/0cc3c182ad418709b577fa24e9fe909a205232c6/entry/src/main/ets/common/utils/http/HttpUtils.ets#L8-L26 | 07781cae33cab2e0b6e923ce729eae1e461073d8 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets | arkts | signPKCS1 | 签名-PKCS1
@param str 需要签名的字符串
@param priKey 私钥
@returns OutDTO<string> 签名对象 | static async signPKCS1(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.sign(str, priKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024);
} | AST#method_declaration#Left static async signPKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static async signPKCS1(str: string, priKey: string): Promise<OutDTO<string>> {
return CryptoUtil.sign(str, priKey, 'RSA1024', 'RSA1024|PKCS1|SHA256', 1024);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/RSA.ets#L124-L126 | c1082b23cb4fdaae198b7bb24c4850363626b4bb | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | getDataSync | 读取系统剪贴板内容
@returns | static getDataSync(): pasteboard.PasteData {
return PasteboardUtil.getSystemPasteboard().getDataSync();
} | AST#method_declaration#Left static getDataSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left pasteboard . PasteData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#... | static getDataSync(): pasteboard.PasteData {
return PasteboardUtil.getSystemPasteboard().getDataSync();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L100-L102 | 33ae00c4a59453e69d16dc349579723c9307c113 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/storage/PreferencesService.ets | arkts | checkInitialized | 检查是否已初始化 | private checkInitialized(): void {
if (!this.initialized || !this.dataPreferences) {
throw new Error('PreferencesService not initialized. Call initialize() first.');
}
} | AST#method_declaration#Left private checkInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_express... | private checkInitialized(): void {
if (!this.initialized || !this.dataPreferences) {
throw new Error('PreferencesService not initialized. Call initialize() first.');
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L53-L57 | 2e6b5d886f944cb1caba757386392f8c6568f78a | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets | arkts | encodeAsym | 非对称加密
@param encodeStr 待加密的字符串
@param pubKey 给定秘钥规格公钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格 | static async encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
//将公钥转换
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
//生成加密器
let encoder = crypto.createCipher(symEncryptName);
//初始化加密环境
... | AST#method_declaration#Left static async encodeAsym 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#primar... | static async encodeAsym(str: string, pubKey: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> {
let pubPair = await CryptoUtil.convertPubKeyFromStr(pubKey, symAlgName, keyName);
let encoder = crypto.createCipher(symEncryptName);
await encoder.init(... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L223-L242 | 4ecccb5616415c08dfab0a5450f725afcfd80042 | gitee |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/pages/user/settings.ets | arkts | aboutToAppear | 页面显示时加载设置 | async aboutToAppear() {
initializeSettings();
await this.loadSettings();
isTSiteDev().then((val) => {
if (!val) {
return;
}
this.isTDev = true;
});
} | AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left initializeSettings ( ) ; AST#ui_custom_component_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#exp... | async aboutToAppear() {
initializeSettings();
await this.loadSettings();
isTSiteDev().then((val) => {
if (!val) {
return;
}
this.isTDev = true;
});
} | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L112-L121 | 7246fbe10b5fb3ab2d128e322cacf7484bd968ae | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets | arkts | drawMask | 绘制蒙层 | drawMask() {
this.maskContext.clearRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.fillStyle = 'rgba(0,0,0,0.7)';
this.maskContext.fillRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.clearRect(this.clipRect.x - this.imageArea.x, this.clipRect.y - this.... | AST#method_declaration#Left drawMask 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#member_expression#Left AST#expression#Left this AST... | drawMask() {
this.maskContext.clearRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.fillStyle = 'rgba(0,0,0,0.7)';
this.maskContext.fillRect(0, 0, this.imageArea.width, this.imageArea.height);
this.maskContext.clearRect(this.clipRect.x - this.imageArea.x, this.clipRect.y - this.... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/ImageProcessing-master/scenes/picture_beautification/src/main/ets/pages/PictureBeautification.ets#L288-L294 | 087523006f504644dcec441faadd1e116e6a19f3 | github |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/types/SwipeCardTypes.ets | arkts | 卡片滑动回调函数类型
@param direction - 滑动方向
@param data - 卡片数据对象
@param index - 卡片在数组中的索引 | export type OnCardSwipedCallback = (direction: SwipeDirection, data: object, index: number) => void; | AST#export_declaration#Left export AST#type_declaration#Left type OnCardSwipedCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left direction : AST#type_annotation#Left AST#primary_type#Left SwipeDirection AST#primary_type#Right AST#type_annotation#Right AST#parameter#R... | export type OnCardSwipedCallback = (direction: SwipeDirection, data: object, index: number) => void; | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L50-L50 | b9c341f66493eae7a7e6160b8ac90edfb1671af5 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/pages/WidgetCard2x2.ets | arkts | onWidgetClick | 点击事件处理 | private onWidgetClick(): void {
if (this.widgetData.hasData && this.widgetData.contactId) {
// 打开联系人详情
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'viewContact',
contactId: this.widgetData.contactId
}
}... | AST#method_declaration#Left private onWidgetClick 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#me... | private onWidgetClick(): void {
if (this.widgetData.hasData && this.widgetData.contactId) {
postCardAction(this, {
action: 'router',
abilityName: 'EntryAbility',
params: {
action: 'viewContact',
contactId: this.widgetData.contactId
}
});
} e... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x2.ets#L202-L223 | cd34dfc53e6ee400f01171f9b77f11acf7c890c8 | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/PodcastService.ets | arkts | addPodcastByUrl | 通过RSS URL添加播客 | async addPodcastByUrl(feedUrl: string): Promise<Podcast> {
// 获取RSS内容
const rssContent = await this.fetchRssFeed(feedUrl);
// 解析RSS
const podcast = this.parseRssFeed(rssContent, feedUrl);
// 保存到数据库
podcast.subscribeDate = Date.now();
podcast.isSubscribed = true;
await this.dbSe... | AST#method_declaration#Left async addPodcastByUrl AST#parameter_list#Left ( AST#parameter#Left feedUrl : 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... | async addPodcastByUrl(feedUrl: string): Promise<Podcast> {
const rssContent = await this.fetchRssFeed(feedUrl);
const podcast = this.parseRssFeed(rssContent, feedUrl);
podcast.subscribeDate = Date.now();
podcast.isSubscribed = true;
await this.dbService.insertPodcast(podcast... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L29-L45 | ec6b980b00a950ea588471d7adc5a31284b5418e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/DetailConstant.ets | arkts | Detail page constant description. | export class DetailConstant {
/**
* detail page day data.
*/
static readonly DAY_DATA: DayDataBean[] = [
{ timeType: 0, delSelect: 0, data: ['上午', '下午'] } as DayDataBean,
{ timeType: 1, delSelect: 0, data:
[
'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'
]
} a... | AST#export_declaration#Left export AST#class_declaration#Left class DetailConstant AST#class_body#Left { /**
* detail page day data.
*/ AST#property_declaration#Left static readonly DAY_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DayDataBean [ ] AST#array_type#Right AST#primary_type#... | export class DetailConstant {
static readonly DAY_DATA: DayDataBean[] = [
{ timeType: 0, delSelect: 0, data: ['上午', '下午'] } as DayDataBean,
{ timeType: 1, delSelect: 0, data:
[
'01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'
]
} as DayDataBean,
{ timeType: 2, de... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/DetailConstant.ets#L20-L81 | 14277d898f3e0367854205078badb52dde5c6972 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcp.ets | arkts | 私有化构造 | private constructor() {
} | AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right | private constructor() {
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L77-L78 | 99dc3bcaa283f1e7bf86715285a2a6a8369ff5a7 | gitee | |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/models/TaskModel.ets | arkts | clearAll | 清除所有数据 | static async clearAll(): Promise<void> {
if (!DataStorage.prefsInstance) {
console.error('Preferences not initialized');
return;
}
try {
await DataStorage.prefsInstance.clear();
await DataStorage.prefsInstance.flush();
console.info('All data cleared successfully');
} catch ... | AST#method_declaration#Left static 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 void AST#primary_type#Right AST#type_annotation#Right > AST#type_... | static async clearAll(): Promise<void> {
if (!DataStorage.prefsInstance) {
console.error('Preferences not initialized');
return;
}
try {
await DataStorage.prefsInstance.clear();
await DataStorage.prefsInstance.flush();
console.info('All data cleared successfully');
} catch ... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/TaskModel.ets#L102-L114 | 85f9a94b293959d8543f7bcfe4b6c503ef3a3bdb | github |
huang7855196/ArkTs-iLearn.git | 08590adaca7a58d5284416ba5cfc09117122af84 | HomeModule/src/main/ets/view/BannerView.ets | arkts | BannerView | @desc:广告
@author:hxy
@date:2024/2/17 | @Component
export struct BannerView {
build() {
Swiper() {
Flex() {
Image('/images/banner_ai.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
Flex() {
Image('/images/banner_pj.png')
.objectFit(ImageFit.Fill)
}
.pad... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct BannerView AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Swiper ( ) AST#container_content_body#Left ... | @Component
export struct BannerView {
build() {
Swiper() {
Flex() {
Image('/images/banner_ai.png')
.objectFit(ImageFit.Fill)
}
.padding({ left: dp(15), right: dp(15) })
Flex() {
Image('/images/banner_pj.png')
.objectFit(ImageFit.Fill)
}
.pad... | https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/view/BannerView.ets#L7-L34 | 8aae57afd1d1708978d720c8eb7ae3f0a1102aec | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.