nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FollowManager.ets | arkts | followUser | Follow a user | static async followUser(follower: string, followee: string, followeeId?: number): Promise<boolean> {
try {
if (!FollowManager.preferencesInstance) {
console.error('FollowManager: Preferences not initialized');
return false;
}
console.info(`FollowManager: followUser called - foll... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left followUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left follower AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | static async followUser(follower: string, followee: string, followeeId?: number): Promise<boolean> {
try {
if (!FollowManager.preferencesInstance) {
console.error('FollowManager: Preferences not initialized');
return false;
}
console.info(`FollowManager: followUser called - foll... | https://github.com/Harrisonls2004/WaterFlow | 6700912af43ffdad933bb49a93fb5c630ecf264e | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnWaterFallViewModel.ets | arkts | initLoadMoreData | 初始化加载更多数据 | private initLoadMoreData(): void {
const items: Object[] = [];
for (let i = 0; i < 10; i++) {
const height = 100 + Math.floor(Math.random() * 120);
const color = this.colors[i % this.colors.length];
items.push(new WaterFallDemoItem(i, height, color, `Load-${i + 1}`));
}
this.loadMore... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initLoadMoreData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST... | private initLoadMoreData(): void {
const items: Object[] = [];
for (let i = 0; i < 10; i++) {
const height = 100 + Math.floor(Math.random() * 120);
const color = this.colors[i % this.colors.length];
items.push(new WaterFallDemoItem(i, height, color, `Load-${i + 1}`));
}
this.loadMore... | https://github.com/codelably/tuniao-ui | b605679da40693e6efe0db42dc1c1c40e9c157f9 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | setHandleConfig | ==================== Handle Config ==================== | setHandleConfig(config: HandleConfig): EditorActionResult {
this.handleConfig = config;
const data = CoreProtocol.encodeHandleConfig(config);
return CoreProtocol.decodeEditorActionResult(native.editorSetHandleConfig(this.handle, data, data.byteLength));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHandleConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HandleConfig AST#identifier#Right AST#... | setHandleConfig(config: HandleConfig): EditorActionResult {
this.handleConfig = config;
const data = CoreProtocol.encodeHandleConfig(config);
return CoreProtocol.decodeEditorActionResult(native.editorSetHandleConfig(this.handle, data, data.byteLength));
} | https://github.com/FinalScave/SweetEditor | c9f35b2cd8e0654762caeb222b930452ab6d1c26 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Annotations/UnifiedAnnotationManager.ets | arkts | createThought | Create a thought annotation. | async createThought(input: CreateThoughtInput): Promise<UnifiedAnnotationRecord> {
await this.ensureSchema();
const anchor = input.anchor || {};
const safeText = input.textContent ?? '';
const linkedId = input.linkedAnnotationId ? input.linkedAnnotationId.trim() : '';
const contentType = input.con... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createThought AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left input AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async createThought(input: CreateThoughtInput): Promise<UnifiedAnnotationRecord> {
await this.ensureSchema();
const anchor = input.anchor || {};
const safeText = input.textContent ?? '';
const linkedId = input.linkedAnnotationId ? input.linkedAnnotationId.trim() : '';
const contentType = input.con... | https://github.com/DaLongZhuaZi/manxia | 9c943aa32488e12e99e0cb1fa7a2e5e7f65f40a4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | includes | Checks if specified argument is in Uint8ClampedArray
@param e search element
@returns true if e is in Uint8ClampedArray, false otherwise | public includes(e: number): boolean {
return this.includes(e as number, 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST... | public includes(e: number): boolean {
return this.includes(e as number, 0)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 24176795761d00590fff6d8140726ee507f48b28 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ThemeAware.ets | arkts | initializeThemeAware | 初始化主题感知功能 | public static async initializeThemeAware(
componentId: string,
state: ThemeAwareState,
callback?: (theme: ThemeType) => void,
stateUpdater?: (newState: ThemeAwareState) => void
): Promise<void> {
const themeManager = ThemeManager.getInstance();
// 创建主题变化回调
const themeChangeCallback = (t... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#identifier#Left initializeThemeAware AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:#Le... | public static async initializeThemeAware(
componentId: string,
state: ThemeAwareState,
callback?: (theme: ThemeType) => void,
stateUpdater?: (newState: ThemeAwareState) => void
): Promise<void> {
const themeManager = ThemeManager.getInstance();
// 创建主题变化回调
const themeChangeCallback = (t... | https://github.com/DaLongZhuaZi/manxia | 9866ff7ebcf29855ad1721a7acd97dd81b678d4c | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F003_list_rendering/entry/src/main/ets/utils/MockData.ets | arkts | generateProducts | 生成商品列表 | static generateProducts(count: number): Product[] {
const products: Product[] = [];
const productTypes: ProductType[] = [
{ name: '华为手机', icon: '📱', colorKey: 'brand_primary' },
{ name: '小米平板', icon: '💻', colorKey: 'brand_success' },
{ name: 'MacBook', icon: '⌨️', colorKey: 'brand_purple' ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateProducts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static generateProducts(count: number): Product[] {
const products: Product[] = [];
const productTypes: ProductType[] = [
{ name: '华为手机', icon: '📱', colorKey: 'brand_primary' },
{ name: '小米平板', icon: '💻', colorKey: 'brand_success' },
{ name: 'MacBook', icon: '⌨️', colorKey: 'brand_purple' ... | https://github.com/mqxu/HarmonyOS_In_Action | ba61605b19cac13ce85dc01c1ac51f59a63c9bda | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Image/CoverImageManager.ets | arkts | removeFromCache | 从缓存中移除指定URL | removeFromCache(url: string): void {
const pixelMap = coverCache.get(url);
if (pixelMap) {
releaseCoverPixelMap(pixelMap);
coverCache.delete(url);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeFromCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ... | removeFromCache(url: string): void {
const pixelMap = coverCache.get(url);
if (pixelMap) {
releaseCoverPixelMap(pixelMap);
coverCache.delete(url);
}
} | https://github.com/DaLongZhuaZi/manxia | 68a5c9834492af4386982bcf7b7198a4a66879a7 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets | arkts | onDidBuild | Lifecycle: stores the UIContext in AppStorage so child components can access it after the first build. | onDidBuild(): void {
AppStorage.setOrCreate<UIContext>('context', this.getUIContext());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDidBuild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onDidBuild(): void {
AppStorage.setOrCreate<UIContext>('context', this.getUIContext());
} | https://github.com/AGenUI/AGenUI | ad286b49549edadf601fdf252b5d91486a2c8473 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/interceptors/LogInterceptor.ets | arkts | safeStringify | 安全序列化
@param {Unknown} value - 待序列化的值
@returns {string} 序列化后的字符串 | function safeStringify(value: Unknown, pretty: boolean = false): string {
if (value === undefined) {
return "undefined";
}
if (typeof value === "string") {
return value;
}
try {
const result: string | undefined = JSON.stringify(value, null, pretty ? 2 : undefined);
return result !== undefined ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left safeStringify AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | function safeStringify(value: Unknown, pretty: boolean = false): string {
if (value === undefined) {
return "undefined";
}
if (typeof value === "string") {
return value;
}
try {
const result: string | undefined = JSON.stringify(value, null, pretty ? 2 : undefined);
return result !== undefined ... | https://github.com/Joker-x-dev/CoolMallArkTS | 69bd432d9b6a5da55dd62a7f94d1bec8ce972384 | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets | arkts | createPreviewOutputFn | 创建previewOutput输出对象 | createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile,
surfaceId: string): camera.PreviewOutput | undefined {
let previewOutput: camera.PreviewOutput | undefined = undefined;
try {
previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId);... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createPreviewOutputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#E... | createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile,
surfaceId: string): camera.PreviewOutput | undefined {
let previewOutput: camera.PreviewOutput | undefined = undefined;
try {
previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId);... | https://gitee.com/openharmony/multimedia_camera_framework.git | bc6ac216ec57e002874734f22b55ef2073d9110f | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/XAxis.ets | arkts | getCustomLabels | 获取自定义Labels
@returns labels数组 | public getCustomLabels(): number[] {
return this.customLabels;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres... | public getCustomLabels(): number[] {
return this.customLabels;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fec33d23c09fe1335da989d83ae2edcfcda058a3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets | arkts | deleteChapterList | 删除章节列表缓存 | deleteChapterList(sourceId: number, mangaId: string): void {
const key = this.generateKey(sourceId, mangaId);
this.chapterListCache.delete(key);
logger.info(TAG, `删除章节列表缓存: ${key}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteChapterList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , A... | deleteChapterList(sourceId: number, mangaId: string): void {
const key = this.generateKey(sourceId, mangaId);
this.chapterListCache.delete(key);
logger.info(TAG, `删除章节列表缓存: ${key}`);
} | https://github.com/DaLongZhuaZi/manxia | cb877284089585de9e0ac30f056022ada151ca2d | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/AsrDisplayManager.ets | arkts | isConverting | Check if a message is currently being converted | isConverting(messageID: string | undefined): boolean {
if (!messageID || messageID.length === 0) {
return false;
}
return this.convertingMessageIDs.has(messageID);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isConverting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left messageID AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERR... | isConverting(messageID: string | undefined): boolean {
if (!messageID || messageID.length === 0) {
return false;
}
return this.convertingMessageIDs.has(messageID);
} | https://github.com/Tencent-RTC/TUIKit_Harmony | d6e395f76b3eed4e8736dc337cbb0f62376747b4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies all elements of arr to the current Int8Array starting from insertPos.
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
@param { FixedArray<number> } arr - array to copy data from
@param { int } insertPos - start index where data from arr will be inserted
@th... | public set(arr: FixedArray<number>, insertPos: int): void {
const offset = insertPos
if (offset < 0 || offset + arr.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < arr.length; ++i) {
this.setUnsafe(offset + i, I... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<number>, insertPos: int): void {
const offset = insertPos
if (offset < 0 || offset + arr.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < arr.length; ++i) {
this.setUnsafe(offset + i, I... | https://gitcode.com/iop123123/arkts-static-skills | 4f3ff94d8ded376be44598d3d4e34926711715fe | gitcode |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | processUnknownWordsBatch | 批量处理未知词汇 | processUnknownWordsBatch(
contexts: Array<ContextItem>,
userLevel: number = 2
): Array<HandlingResultItem> {
const results: Array<HandlingResultItem> = [];
for (const item of contexts) {
const unknownWords = this.detectUnknownWords(
item.context,
item.knownWords,
item.... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left processUnknownWordsBatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left contexts AST#identifier#Right ... | processUnknownWordsBatch(
contexts: Array<ContextItem>,
userLevel: number = 2
): Array<HandlingResultItem> {
const results: Array<HandlingResultItem> = [];
for (const item of contexts) {
const unknownWords = this.detectUnknownWords(
item.context,
item.knownWords,
item.... | https://github.com/CLMC2025/Vignette | 6ef6e50a35ad794b2beb2aed4a2fa09da18a6148 | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/DebounceUtil.ets | arkts | cancel | 取消防抖
@param key 唯一标识键 | static cancel(key: string): void {
const existingTimer = DebounceUtil.timers.get(key)
if (existingTimer !== undefined) {
clearTimeout(existingTimer)
DebounceUtil.timers.delete(key)
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | static cancel(key: string): void {
const existingTimer = DebounceUtil.timers.get(key)
if (existingTimer !== undefined) {
clearTimeout(existingTimer)
DebounceUtil.timers.delete(key)
}
} | https://github.com/Yebingiscn/SweetVideo | 30f4aced014d6561f92485ef6e2ee9e801dcfd7f | github |
offlinecat-dev/OCNetORM | src/main/ets/query/SubQuery.ets | arkts | whereIn | 添加 IN 条件
@param column 列名
@param values 值数组
@returns 当前实例(支持链式调用) | whereIn(column: string, values: Array<ValueType>): SubQuery {
if (values.length === 0) {
throw new SubQueryError('IN 条件不能为空')
}
const condition = WhereCondition.inValues(column, values)
condition.logicalOperator = LogicalOperator.AND
this.conditions.push(condition)
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,... | whereIn(column: string, values: Array<ValueType>): SubQuery {
if (values.length === 0) {
throw new SubQueryError('IN 条件不能为空')
}
const condition = WhereCondition.inValues(column, values)
condition.logicalOperator = LogicalOperator.AND
this.conditions.push(condition)
return this
} | https://github.com/offlinecat-dev/OCNetORM | c86d3ec8f741c692c7b31cb9f7ee94e479251b86 | github |
codelably/HCompass | packages/auth/src/main/ets/AuthModule.ets | arkts | registerServices | 注册 DI 服务
@param container DI 容器 | registerServices(container: Container): void {
// 注册本模块服务
container.register<IAuthNavSvc>(AUTH_NAV_SVC_KEY, () => new AuthNavSvcImpl());
container.register<IAuthRepository>(AUTH_REPOSITORY_KEY, () => new AuthRepositoryImpl());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerServices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left container AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Container AST#identifier#Right AST... | registerServices(container: Container): void {
// 注册本模块服务
container.register<IAuthNavSvc>(AUTH_NAV_SVC_KEY, () => new AuthNavSvcImpl());
container.register<IAuthRepository>(AUTH_REPOSITORY_KEY, () => new AuthRepositoryImpl());
} | https://github.com/codelably/HCompass | 2eed2263ae4cf8311ce42c8ae6ef5b84b373b246 | github |
azhu0001/localsend-harmony | entry/src/main/ets/service/upload/UploadServer.ets | arkts | upload | 上传文件二进制流
@param url 请求路径(相对路径)
@param info 需要上传的文件
@param callback 用于返回上传进度的回调函数
@returns | async upload(filePortSize: number, url: string, info: PendingSendFile): Promise<void> {
let file: fs.File | null = null
try {
if (!info.filePath) {
return Promise.reject()
}
let start = Dates.now()
file = await FileProvider.getFile(info.filePath)
let input = new ArrayBuff... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left upload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePortSize AST#identifier#Right AST#type_annotation#Left AST#... | async upload(filePortSize: number, url: string, info: PendingSendFile): Promise<void> {
let file: fs.File | null = null
try {
if (!info.filePath) {
return Promise.reject()
}
let start = Dates.now()
file = await FileProvider.getFile(info.filePath)
let input = new ArrayBuff... | https://gitcode.com/azhu0001/localsend-harmony | 9fa65780b36f2bc177fd8f152f00a8cca0f3a510 | gitcode |
openharmony-tpc/openharmony_tpc_samples | SmartRefreshLayout/library/src/main/ets/components/topRefresh/BezierRadarRefresh.ets | arkts | drawRadar | 绘制刷新时的 雷达动画
@param canvas 画布
@param width 宽度
@param height 高度 | drawRadar(canvas: CanvasRenderingContext2D, width: number, height: number) {
let radius: number = this.mRadarRadius * this.mRadarScale;
let circle: number = this.mRadarCircle * this.mRadarScale;
canvas.fillStyle = this.mAccentColor;
canvas.strokeStyle = this.mAccentColor;
canvas.beginP... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawRadar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left canvas AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#... | drawRadar(canvas: CanvasRenderingContext2D, width: number, height: number) {
let radius: number = this.mRadarRadius * this.mRadarScale;
let circle: number = this.mRadarCircle * this.mRadarScale;
canvas.fillStyle = this.mAccentColor;
canvas.strokeStyle = this.mAccentColor;
canvas.beginP... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | ed2d417d33a48ac313a80821e647bd00ab29def3 | gitee |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | setTitleFontSize | 标题大小
@param titleFontSize
@returns | setTitleFontSize(titleFontSize?: number | string | Resource): Builder {
this.popupOptions.titleFontSize = titleFontSize
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTitleFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left titleFontSize AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left :... | setTitleFontSize(titleFontSize?: number | string | Resource): Builder {
this.popupOptions.titleFontSize = titleFontSize
return this
} | https://github.com/wuba/omni-ui | 725563a74f5a6202ffa88b63df9384d9b26f7b8c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | cleanupRecursiveExtractionResult | 清理递归解压结果(清理所有临时目录)
@param result 递归解压结果 | public async cleanupRecursiveExtractionResult(result: RecursiveExtractionResult): Promise<void> {
await this.cleanupTempDirectories(result.tempDirectories);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left cleanupRecursiveExtractionResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#R... | public async cleanupRecursiveExtractionResult(result: RecursiveExtractionResult): Promise<void> {
await this.cleanupTempDirectories(result.tempDirectories);
} | https://github.com/DaLongZhuaZi/manxia | 390d880197af0b0390aabee4f36beaf6e1f03ea6 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/ExternalFileOpener.ets | arkts | copyFileContentToClipboard | 复制文件内容到系统剪贴板 | static copyFileContentToClipboard(content: string): boolean {
try {
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, content);
pasteboard.getSystemPasteboard().setData(data);
return true;
} catch (_e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left copyFileContentToClipboard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | static copyFileContentToClipboard(content: string): boolean {
try {
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, content);
pasteboard.getSystemPasteboard().setData(data);
return true;
} catch (_e) {
return false;
}
} | https://github.com/XJTUWYD/ArkDiff | dff165de8e126ea97c3c025b63e3e21900ded37e | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets | arkts | onBluetoothEnableChange | 侦听蓝牙状态变化 | onBluetoothEnableChange(): void {
Log.showInfo(TAG, `onBluetoothEnableChange: bluetoothEnable = ${this.bluetoothEnable}`);
if (this.bluetoothEnable) {
this.toggleAdvertiser();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBluetoothEnableChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stat... | onBluetoothEnableChange(): void {
Log.showInfo(TAG, `onBluetoothEnableChange: bluetoothEnable = ${this.bluetoothEnable}`);
if (this.bluetoothEnable) {
this.toggleAdvertiser();
}
} | https://gitcode.com/arkui-x/samples | 4ea52fc8fbb79544b24f7f034ed27a85ea78f750 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Int32Array using range [begin, end)
@param begin start index to be taken into slice
@param end last index to be taken into slice
@returns a new Int32Array with elements of current Int32Array[begin;end) where end index is excluded
@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/R... | public slice(begin: number, end: number): Int32Array {
return this.slice(begin as int, end as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number, end: number): Int32Array {
return this.slice(begin as int, end as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3b96579cc52311a349deb7b1dce45d37a1eeb62a | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/utils/EncryptionModule.ets | arkts | base64Encode | Base64 编码
@param data 要编码的字节数组
@returns Base64 编码的字符串 | private static base64Encode(data: Uint8Array): string {
// 使用简单的 Base64 编码实现
// HarmonyOS 中可以使用 util.Base64Helper,但这里使用标准实现
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
let result = '';
let i = 0;
while (i < data.length) {
const a: number = data[... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left base64Encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : ... | private static base64Encode(data: Uint8Array): string {
// 使用简单的 Base64 编码实现
// HarmonyOS 中可以使用 util.Base64Helper,但这里使用标准实现
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
let result = '';
let i = 0;
while (i < data.length) {
const a: number = data[... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | faed5ef9564068c005a972d056e948608ee102be | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates an BigInt64Array with respect to buf.
@param buf data initializer | public constructor(buf: Buffer) {
this(buf, 0, buf.getByteLength() / BigInt64Array.BYTES_PER_ELEMENT)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe... | public constructor(buf: Buffer) {
this(buf, 0, buf.getByteLength() / BigInt64Array.BYTES_PER_ELEMENT)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e7843b7dae18f9e88693e937187964afa44b42db | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getGlassBackground | 获取玻璃效果背景资源(根据当前主题返回不同的颜色)
深色模式:半透明深色背景;浅色模式:半透明浅色背景 | private getGlassBackground(): ResourceColor {
if (this.themeState.currentTheme === ThemeType.LIGHT) {
return 'rgba(255, 255, 255, 0.68)'; // 浅色模式:亮玻璃
} else {
return 'rgba(16, 22, 32, 0.78)'; // 深色模式:深色玻璃,抑制白雾底
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getGlassBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ... | private getGlassBackground(): ResourceColor {
if (this.themeState.currentTheme === ThemeType.LIGHT) {
return 'rgba(255, 255, 255, 0.68)'; // 浅色模式:亮玻璃
} else {
return 'rgba(16, 22, 32, 0.78)'; // 深色模式:深色玻璃,抑制白雾底
}
} | https://github.com/DaLongZhuaZi/manxia | 836134423f53deb36814e20d077055929fdfaef3 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/RecentFilesService.ets | arkts | getRecentFiles | 获取最近打开的文件列表
@returns | public static getRecentFiles(): Promise<RecentFile[]> {
return RecentFilesService.getInstance().getRecentFiles();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getRecentFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getRecentFiles(): Promise<RecentFile[]> {
return RecentFilesService.getInstance().getRecentFiles();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L216-L218 | e57be57b4ff6f8065451e2946d6bf305d716b713 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeStateController.ets | arkts | updateTouchConfig | 更新触摸配置并通知所有注册的控制器 | public updateTouchConfig(config: TouchConfig): void {
this._touchConfig = config;
this._itemControllers.forEach((controller) => {
controller.updateTouchConfig(config);
});
if (this._configUpdateCallback) {
this._configUpdateCallback(config);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateTouchConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public updateTouchConfig(config: TouchConfig): void {
this._touchConfig = config;
this._itemControllers.forEach((controller) => {
controller.updateTouchConfig(config);
});
if (this._configUpdateCallback) {
this._configUpdateCallback(config);
}
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 51fd220035f9dd420327d48bd39575fa52c423c1 | gitcode |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/model/Theme.ets | arkts | getColors | 根据主题类型获取颜色配置
@param themeType 主题类型
@returns 对应的颜色配置 | static getColors(themeType: ThemeType): ThemeColors {
return themeType === ThemeType.LIGHT ? ThemeConfig.LIGHT_THEME : ThemeConfig.DARK_THEME;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getColors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left themeType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left T... | static getColors(themeType: ThemeType): ThemeColors {
return themeType === ThemeType.LIGHT ? ThemeConfig.LIGHT_THEME : ThemeConfig.DARK_THEME;
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 75e69f435ea8248a20950da3806f439645781e9e | github |
apap6628114/nga_oh | entry/src/main/ets/common/datasource/BaseLazyDataSource.ets | arkts | notifyAdd | 通知所有监听器在指定下标处发生了增量新增。
@param index - 新增元素下标 | protected notifyAdd(index: number): void {
for (let i = 0; i < this.listeners.length; i++) {
this.listeners[i].onDataAdd(index)
}
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left notifyAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | protected notifyAdd(index: number): void {
for (let i = 0; i < this.listeners.length; i++) {
this.listeners[i].onDataAdd(index)
}
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L129-L133 | 77cfab5b616d62b4ce08af238c58aff742c9134b | github |
harmonyos/codelabs | HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets | arkts | updateProgress | Update data based on index and progress values and update date.
@param index of update item.
@param updateValue of update item.
@param updateDate of update item. | updateProgress(index: number, updateValue: number, updateDate: string): boolean {
if (!this.targetData[index]) {
return false;
}
this.targetData[index].progressValue = updateValue;
this.targetData[index].updateDate = updateDate;
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left ,... | updateProgress(index: number, updateValue: number, updateDate: string): boolean {
if (!this.targetData[index]) {
return false;
}
this.targetData[index].progressValue = updateValue;
this.targetData[index].updateDate = updateDate;
return true;
} | https://gitee.com/harmonyos/codelabs.git | 6ce1d9bab59092a37020b327ac238424c47fca34 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/core/EntityMetadata.ets | arkts | constructor | 构造函数
@param entityName 实体类名
@param tableName 数据库表名(可选,默认使用实体类名)
@param softDelete 是否启用软删除(可选,默认 false)
@param deletedAtColumn 软删除时间戳列名(可选,默认 'deleted_at')
@param hooks 实体生命周期钩子(可选) | constructor(
entityName: string,
tableName?: string,
softDelete?: boolean,
deletedAtColumn?: string,
hooks?: EntityHooks | null
) {
this.entityName = entityName
this.tableName = tableName ? tableName : entityName
if (softDelete !== undefined) {
this.softDelete = softDelete
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | constructor(
entityName: string,
tableName?: string,
softDelete?: boolean,
deletedAtColumn?: string,
hooks?: EntityHooks | null
) {
this.entityName = entityName
this.tableName = tableName ? tableName : entityName
if (softDelete !== undefined) {
this.softDelete = softDelete
... | https://github.com/offlinecat-dev/OCNetORM | 097bf93710725abfc8fa9dd1a6ee548d0f1cfe0f | github |
offlinecat-dev/OCNetORM | src/main/ets/core/ColumnMetadata.ets | arkts | setPrimaryKey | 设置为主键
@param isPrimary 是否为主键
@returns 当前实例,支持链式调用 | setPrimaryKey(isPrimary: boolean): ColumnMetadata {
this.isPrimaryKey = isPrimary
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPrimaryKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isPrimary AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ) A... | setPrimaryKey(isPrimary: boolean): ColumnMetadata {
this.isPrimaryKey = isPrimary
return this
} | https://github.com/offlinecat-dev/OCNetORM | c683e6958080f86ae8f7b7432127a11579ac49ad | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | hideRebuyModal | 隐藏再次购买弹窗
@returns {void} 无返回值 | hideRebuyModal(): void {
this.rebuyModalVisible = false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hideRebuyModal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | hideRebuyModal(): void {
this.rebuyModalVisible = false;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 90da1450ddd66689dae6d17bd7c1efc8c79488a9 | github |
openharmony/codelabs | ETSUI/LifeHub/entry/src/main/ets/pages/Dashboard.ets | arkts | build | build() {
Scroll() {
Column() {
// 标题
Row() {
Text('生活中心')
.fontSize(28)
.fontWeight(FontWeight.Bold)
Blank()
}
.width('100%')
.padding({ left: 20, right: 20, top: 20, bottom: 10 })
// 今日概览
Text('今日概览')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Start)
.width('100%')
.padding({ left: 20, right: 2... | build() {
Scroll() {
Column() {
// 标题
Row() {
Text('生活中心')
.fontSize(28)
.fontWeight(FontWeight.Bold)
Blank()
}
.width('100%')
.padding({
left: 20,
right: 20,
top: 20,
bottom: 10
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Scroll() {
Column() {
// 标题
Row() {
Text('生活中心')
.fontSize(28)
.fontWeight(FontWeight.Bold)
Blank()
}
.width('100%')
.padding({
left: 20,
right: 20,
top: 20,
bottom: 10
... | https://gitcode.com/openharmony/codelabs | b099ca2ea5d61a490e0f15adf97eee758ebd0715 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | initPreferences | 初始化首选项 | private static async initPreferences(): Promise<preferences.Preferences | null> {
try {
const context = GlobalContext.getContext();
if (!context) {
return null;
}
return await preferences.getPreferences(context, UserSessionService.SESSION_PREFERENCES_NAME);
} catch (error) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left initPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum... | private static async initPreferences(): Promise<preferences.Preferences | null> {
try {
const context = GlobalContext.getContext();
if (!context) {
return null;
}
return await preferences.getPreferences(context, UserSessionService.SESSION_PREFERENCES_NAME);
} catch (error) {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b9ad79eee5d8f5ca862fcecfa8df22e9c8bbdade | github |
LongLiveY96/chatcube | entry/src/main/ets/services/PreferencesService.ets | arkts | has | 检查键是否存在 | async has(key: string): Promise<boolean> {
if (this.dataPreferences === null) {
return false
}
try {
return await this.dataPreferences.has(key)
} catch (error) {
console.error('PreferencesService', `Failed to check key: ${JSON.stringify(error)}`)
return false
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotat... | async has(key: string): Promise<boolean> {
if (this.dataPreferences === null) {
return false
}
try {
return await this.dataPreferences.has(key)
} catch (error) {
console.error('PreferencesService', `Failed to check key: ${JSON.stringify(error)}`)
return false
}
} | https://github.com/LongLiveY96/chatcube | 9561dd69c6f85b1267999e7fccf1583228f82a27 | github |
CLMC2025/Vignette | entry/src/main/ets/ui/EnhancedCards.ets | arkts | isActive | 检查是否处于活动状态 | isActive(): boolean {
return this.isPressed || this.isFocused || this.isSelected;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_... | isActive(): boolean {
return this.isPressed || this.isFocused || this.isSelected;
} | https://github.com/CLMC2025/Vignette | 05b885b5ff5c288938aa9f426d9a5acf861dac43 | github |
HarmonyOS_Samples/BestPracticeSnippets | TaskPoolPractice/entry/src/main/ets/pages/sample3/Sample3.ets | arkts | wrongConcurrentFunc | [Start wrong_1]
Sample3.ets | @Concurrent
function wrongConcurrentFunc() {
let promise = Promise.resolve();
promise.then(() => {
try {
taskpool.Task.sendData();
} catch (error) {
let err = error as BusinessError;
hilog.warn(0x000, 'testTag', `sendData failed, code=${err.code}, message=${err.message}`);
}
})
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left wrongConcurrentFunc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Righ... | @Concurrent
function wrongConcurrentFunc() {
let promise = Promise.resolve();
promise.then(() => {
try {
taskpool.Task.sendData();
} catch (error) {
let err = error as BusinessError;
hilog.warn(0x000, 'testTag', `sendData failed, code=${err.code}, message=${err.message}`);
}
})
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 7cd7b0748cbf572561d60ec26d40edefea8451e4 | gitcode |
honjow/Next2V | shared/src/main/ets/utils/MediaUrlUtils.ets | arkts | embeddedVideoFromSrc | Maps an embedded-player src restored from V2EX content_rendered back to the
canonical watch URL. Returns null for non-whitelisted sources so callers can
degrade to a plain link instead of dropping content. | static embeddedVideoFromSrc(raw: string): EmbeddedVideoInfo | null {
const url = MediaUrlUtils.normalizeUrl(raw)
if (!url) {
return null
}
const youtubeMatch = url.match(YOUTUBE_EMBED_SRC_REGEX)
if (youtubeMatch && youtubeMatch[1]) {
return {
provider: 'youtube',
provid... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left embeddedVideoFromSrc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static embeddedVideoFromSrc(raw: string): EmbeddedVideoInfo | null {
const url = MediaUrlUtils.normalizeUrl(raw)
if (!url) {
return null
}
const youtubeMatch = url.match(YOUTUBE_EMBED_SRC_REGEX)
if (youtubeMatch && youtubeMatch[1]) {
return {
provider: 'youtube',
provid... | https://github.com/honjow/Next2V | 8b9c5a497dadfd5f9cd85872aed022cd22e9f608 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets | arkts | values | Returns elements from the HashSet as an values Iterator
@returns ValueIterator with hash set values | values(): IterableIterator<T> {
return this.buckets.keys();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#... | values(): IterableIterator<T> {
return this.buckets.keys();
} | https://gitcode.com/iop123123/arkts-static-skills | 91e344d506666b07ddef51e699f7107603c8221d | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/TabBar.ets | arkts | onPageShow | 页面显示时检查登录状态 | onPageShow(): void {
this.updateLoginStatus();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onPageShow(): void {
this.updateLoginStatus();
} | https://github.com/cpdd5201314/harmonyOS-music-app | 30f154a920ade40bd337bb49e8421fb5dcbafc9a | github |
dingzhilin1990/zhilinclaw | src/security/SecurityFilter.ets | arkts | checkInput | 检查输入安全性
@param input 用户输入 | public async checkInput(input: string): Promise<SecurityCheckResult> {
const issues: SecurityIssue[] = [];
let riskScore = 0;
// 检查输入长度
if (input.length > this.config.maxInputLength) {
issues.push({
type: SecurityIssueType.MALICIOUS_PATTERN,
severity: RiskLevel.MEDIUM,
d... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:... | public async checkInput(input: string): Promise<SecurityCheckResult> {
const issues: SecurityIssue[] = [];
let riskScore = 0;
// 检查输入长度
if (input.length > this.config.maxInputLength) {
issues.push({
type: SecurityIssueType.MALICIOUS_PATTERN,
severity: RiskLevel.MEDIUM,
d... | https://github.com/dingzhilin1990/zhilinclaw | 81104ad5961b411d64773dc254f6818d159633df | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/loading/Loading.ets | arkts | build | 构建 Loading 视图
@returns void | build(): void {
LoadingProgress()
.width(this.loadSize);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | build(): void {
LoadingProgress()
.width(this.loadSize);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 0bad111aab7fd7337ed3c0a3836369ccd87ac57f | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/WantAgentUtil.ets | arkts | getCommonEventWantAgent | Get the WantAgent used by the AlarmInitSubscriber to start the alarm service.
@param forceRefreshTimer The timer needs to be reset during startup.
@return WantAgent used by the timer to start the alarm ringing service. | static async getCommonEventWantAgent(forceRefreshTimer?: boolean): Promise<WantAgent | undefined> {
try {
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: TIMER_ALERT_BUNDLE,
abilityName: TIMER_ALERT_ABILITY,
parameters: {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCommonEventWantAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left forceRefreshTimer AST#identifier#Right AST#ERRO... | static async getCommonEventWantAgent(forceRefreshTimer?: boolean): Promise<WantAgent | undefined> {
try {
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: TIMER_ALERT_BUNDLE,
abilityName: TIMER_ALERT_ABILITY,
parameters: {
... | https://gitee.com/openharmony-sig/applications_clock.git | 4230bb60bf8d75f5670cd9752b651893418da82f | gitee |
openharmony/update_update_app | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getDownloadProgress | 取升级进度
@return 升级进度 | getDownloadProgress(): number {
return this._downloadProgress;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDownloadProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#st... | getDownloadProgress(): number {
return this._downloadProgress;
} | https://gitee.com/openharmony/update_update_app.git | 12efc6b96af1e3576edfcc1a9954580bd9eeddbb | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | set | Copies all elements of arr to the current Int16Array starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} | public set(arr: number[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: short[]): size of arr is greater than Int16Array.length")
}
for (let i = 0... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: number[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: short[]): size of arr is greater than Int16Array.length")
}
for (let i = 0... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 90f99cd708a30deb6dc4b9018e6a08bed6b3f1af | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/common/VNCConnection.ets | arkts | getState | 获取当前连接状态 | getState(): VNCConnectionState {
return this.connectionState;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left VNCConnectionState AST#identifier#Right AST#ERROR#Rig... | getState(): VNCConnectionState {
return this.connectionState;
} | https://github.com/AetheriumSimulator/qemu-hmos | ce284f12eaead72c52cbe0ddf0d923de754d7833 | github |
heeh02/superconnect | harmony/entry/src/main/ets/input/PenHandler.ets | arkts | isPenDown | Pen on the glass right now (router uses this for palm rejection). | isPenDown(): boolean { return this.penDown; } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isPenDown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isPenDown(): boolean { return this.penDown; } | https://github.com/heeh02/superconnect | d9bd232730dbe7c29505ff1dc7e701eec295d835 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | calculateRequiredMonthlyContribution | 计算需要的月供 | calculateRequiredMonthlyContribution(): number {
const remaining = this.targetAmount - this.currentAmount;
if (remaining <= 0) {
return 0;
}
const deadline = new Date(this.deadline);
const now = new Date();
const monthsRemaining = Math.max(1,
(deadline.getFullYear() - now.getFullY... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateRequiredMonthlyContribution AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#E... | calculateRequiredMonthlyContribution(): number {
const remaining = this.targetAmount - this.currentAmount;
if (remaining <= 0) {
return 0;
}
const deadline = new Date(this.deadline);
const now = new Date();
const monthsRemaining = Math.max(1,
(deadline.getFullYear() - now.getFullY... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7c89f9f45f8f3805ff42fd6b0e48827ed991638c | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | getOneDriveCachePath | 获取 OneDrive 缓存路径 | public getOneDriveCachePath(): string {
return this.config.oneDrivePath;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOneDriveCachePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left strin... | public getOneDriveCachePath(): string {
return this.config.oneDrivePath;
} | https://github.com/AetheriumSimulator/qemu-hmos | 593b0a599125509fdb9cdd939a98729283171617 | github |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets | arkts | flushPendingDrawColorPreferences | 将可能挂起的自定义色防抖写入立即落盘(关闭浮窗或提交最近色时调用)。 | flushPendingDrawColorPreferences(): void {
this.cancelDrawColorPersistSchedule();
this.persistDrawColorPreferences();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left flushPendingDrawColorPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right... | flushPendingDrawColorPreferences(): void {
this.cancelDrawColorPersistSchedule();
this.persistDrawColorPreferences();
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets#L191-L194 | 75a8c9b0b617f3a2596551d2ab3134c320ceed5a | github |
Joker-x-dev/HarmonyKit | core/state/src/main/ets/DemoCounterState.ets | arkts | decrement | 计数减一(或自定义步长)
@param {number} step - 步长,默认 1
@returns {void} 无返回值
@example
getDemoCounterState().decrement(); // -1 | decrement(step: number = 1): void {
if (this.count - step < 0) {
this.count = 0;
return;
}
this.count -= step;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decrement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left number AST#iden... | decrement(step: number = 1): void {
if (this.count - step < 0) {
this.count = 0;
return;
}
this.count -= step;
} | https://github.com/Joker-x-dev/HarmonyKit | 84e10f3819aa6ef532fde8879e4e176172fd7d4e | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/ThemeManager.ets | arkts | settingStatusBar | 设置状态栏。
@param {window.SystemBarProperties} config 窗口系统栏属性配置。 | settingStatusBar(config: window.SystemBarProperties) {
this.getWindowStage()
.then((windowStage: window.Window) => {
windowStage.setWindowSystemBarProperties(config)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left settingStatusBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#... | settingStatusBar(config: window.SystemBarProperties) {
this.getWindowStage()
.then((windowStage: window.Window) => {
windowStage.setWindowSystemBarProperties(config)
})
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | f5e7c86c03529a1c33f3da5a9fdc619cf2402d3b | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts an object to a JavaScript Object Notation (JSON) string.
@param obj: Object An object to be converted.
@param replacer A function that transforms the results.
@param space A string or number that's used to insert white space
(including indentation, line break characters, etc.) into the output JSON string for r... | public static stringify(
obj: Any,
replacer: ((key: string, value: Any) => Any) | undefined | null,
space?: string | int): string {
const replacerOpt: ((key: string, value: Any) => Any) | undefined = (replacer === null) ? undefined : replacer
if (spac... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#R... | public static stringify(
obj: Any,
replacer: ((key: string, value: Any) => Any) | undefined | null,
space?: string | int): string {
const replacerOpt: ((key: string, value: Any) => Any) | undefined = (replacer === null) ? undefined : replacer
if (spac... | https://gitcode.com/iop123123/arkts-static-skills | eecf804c98362ba2d4be8ae151ffb7bc13dad91d | gitcode |
arkui-x/samples | CodeLab/Cases/feature/dealstridesolution/src/main/ets/model/CameraService.ets | arkts | initCamera | 初始化相机功能
@param cameraDeviceIndex - 相机设备索引
@returns 无返回值 | async initCamera(cameraDeviceIndex: number, xComponentSurfaceId: string): Promise<void> {
logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
// 获取相机管理器实例
this.cameraManager = this.getCameraManagerFn();
if (this.cameraManager === u... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cameraDeviceIndex AST#identifier#Right AST#type_annotation#... | async initCamera(cameraDeviceIndex: number, xComponentSurfaceId: string): Promise<void> {
logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
try {
await this.releaseCamera();
// 获取相机管理器实例
this.cameraManager = this.getCameraManagerFn();
if (this.cameraManager === u... | https://gitcode.com/arkui-x/samples | 88ca87d12be4c62e6b2f76872b8d0ee5a101b9b9 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/CountlyConfig.ets | arkts | setCategories | Preset the category filter that will be sent on every content fetch
request. Empty array (default) means all categories. | public setCategories(categories: string[]): ContentConfig {
this.categories = categories.slice();
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | public setCategories(categories: string[]): ContentConfig {
this.categories = categories.slice();
return this;
} | https://github.com/Countly/countly-sdk-hos | da016a15b17e9b545fee458adb150856d96b8b62 | github |
PollenWang6/HiXD | entry/src/main/ets/pages/dormwater/DormWaterPage.ets | arkts | doLogout | ===== 登出 ===== | doLogout(): void {
this.svc.logout();
this.loggedIn = false;
this.devices = [];
this.phone = '';
this.smsCode = '';
this.imageCode = '';
this.captchaBase64 = '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doLogout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | doLogout(): void {
this.svc.logout();
this.loggedIn = false;
this.devices = [];
this.phone = '';
this.smsCode = '';
this.imageCode = '';
this.captchaBase64 = '';
} | https://github.com/PollenWang6/HiXD | cd774ce4cc3d6c02181f189edefeea9d7d78bf36 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/pages/ui/web_ui.ets | arkts | aboutToAppear | 音量条监听控制
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
基础函数 //
//////////
进入操作 // | aboutToAppear() {
// 检查目录 //
try {fs.statSync(web_ui_path)} catch {fs.mkdirSync(web_ui_path)}
try {fs.statSync(web_ui_rom_path)} catch {fs.mkdirSync(web_ui_rom_path)}
try {fs.statSync(web_ui_data_path)} catch {fs.mkdirSync(web_ui_data_path)}
try {fs.statSync(web_ui_data_path + 'glass_ui')} catch ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// 检查目录 //
try {fs.statSync(web_ui_path)} catch {fs.mkdirSync(web_ui_path)}
try {fs.statSync(web_ui_rom_path)} catch {fs.mkdirSync(web_ui_rom_path)}
try {fs.statSync(web_ui_data_path)} catch {fs.mkdirSync(web_ui_data_path)}
try {fs.statSync(web_ui_data_path + 'glass_ui')} catch ... | https://github.com/Nekofox-POT/LinMusic | ea625e3ad99624530dfe55ea54716a9295e3cb60 | github |
DaLongZhuaZi/manxia | tmp/ohpm_research/wolfx_minizip/package/src/main/ets/Zip.ets | arkts | startStreamingCompress | 开始流式压缩
@param sourcePath 要压缩的源文件或文件夹路径
@param zipFilePath 目标ZIP文件路径
@returns Promise<boolean> 压缩是否成功 | async startStreamingCompress(sourcePath: string, zipFilePath: string): Promise<boolean> {
try {
// 创建MinizipCompressNative实例
this.compressEntry = new MinizipCompressNative("", zipFilePath);
if (this.compressEntry.Create() != 0) {
throw new Error('创建压缩文件失败');
}
// 获取要压缩的文件列表
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startStreamingCompress AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourcePath AST#identifier#Right AST#type_annotation#Left... | async startStreamingCompress(sourcePath: string, zipFilePath: string): Promise<boolean> {
try {
// 创建MinizipCompressNative实例
this.compressEntry = new MinizipCompressNative("", zipFilePath);
if (this.compressEntry.Create() != 0) {
throw new Error('创建压缩文件失败');
}
// 获取要压缩的文件列表
... | https://github.com/DaLongZhuaZi/manxia | a77ae67369121384e69f5fa7e28b2f679ce8268d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | box | Creates a new DoubleBox instance with the specified initial value.
@param { double } value - The initial double value to be wrapped
@returns { DoubleBox } A new DoubleBox instance containing the specified double value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static box(value: double): DoubleBox {
return new DoubleBox(value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left box AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#id... | public static box(value: double): DoubleBox {
return new DoubleBox(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 5a9839e99e33b0bd8a0b91e94809a46429a5a453 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | logSystemStorageInfo | 【新增】记录系统存储信息(用于调试) | private async logSystemStorageInfo(): Promise<void> {
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
return;
}
// 使用 storageStatistics API 获取应用存储信息
storageStatistics.getCurrentBundleStats((err: BusinessError, bundleStats: storageStatistics.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left logSystemStorageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | private async logSystemStorageInfo(): Promise<void> {
try {
const context = uiContextManager.getAbilityContext();
if (!context) {
return;
}
// 使用 storageStatistics API 获取应用存储信息
storageStatistics.getCurrentBundleStats((err: BusinessError, bundleStats: storageStatistics.... | https://github.com/DaLongZhuaZi/manxia | 547eafc7f3be64c9dd0032f32fc6da1151371d36 | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets | arkts | getNativeLoadStatus | ── Native Status ── | async getNativeLoadStatus(): Promise<ResultEnvelope<string>> {
try {
const status: string = this.getNativeModule().nativeGetLoadStatus() as string
const result: ResultEnvelope<string> = {
success: true,
data: status,
warnings: [] as string[],
changedPaths: [] as string[... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNativeLoadStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | async getNativeLoadStatus(): Promise<ResultEnvelope<string>> {
try {
const status: string = this.getNativeModule().nativeGetLoadStatus() as string
const result: ResultEnvelope<string> = {
success: true,
data: status,
warnings: [] as string[],
changedPaths: [] as string[... | https://github.com/Xiwei753/xiezuoruanjian | 09c90035ee9425bb6bc07a09007661d6289908f0 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets | arkts | toggleColorSuccess | 切换自定义颜色-成功色开关
@param value 新的开关状态 | toggleColorSuccess(value: boolean): void {
this.switchColorSuccess = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleColorSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#L... | toggleColorSuccess(value: boolean): void {
this.switchColorSuccess = value;
} | https://github.com/codelably/tuniao-ui | 3d684f5f43a798fae79e0543febad3fa098bb905 | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/empty/EmptyData.ets | arkts | build | 构建数据缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: $r("app.string.empty_data"),
imageRes: $r("app.media.ic_empty_data")
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Empty({
description: $r("app.string.empty_data"),
imageRes: $r("app.media.ic_empty_data")
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | b28823f8196e42b46eed327489410f496261aff7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | entries | Returns an array of key, value pairs for every entry in the Float64Array
@returns { IterableIterator<[int, Number]> } - key, value pairs for every entry in the array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public entries(): IterableIterator<[int, Number]> {
return new Float64ArrayIteratorEntries(this)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta... | public entries(): IterableIterator<[int, Number]> {
return new Float64ArrayIteratorEntries(this)
} | https://gitcode.com/iop123123/arkts-static-skills | 782fc467ab6f2bad3e281496ed4b13d3989cd5ed | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | writeBigUInt64LE | Writes an unsigned 64-bit integer to the buffer at the specified offset using little-endian format
@param {bigint} value - Value to write
@param {int} [offset=0] - Number of bytes to skip before writing
@returns {int} Offset plus the number of bytes written | public writeBigUInt64LE(value: bigint, offset: int = 0): int {
this.checkOffset(offset, 8);
this.checkValue(value, 0, ((1n << 64n) - 1n), "0", "2n ** 64n - 1n");
this.getDataView().setBigUint64(offset, value, true);
return offset + 8;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeBigUInt64LE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public writeBigUInt64LE(value: bigint, offset: int = 0): int {
this.checkOffset(offset, 8);
this.checkValue(value, 0, ((1n << 64n) - 1n), "0", "2n ** 64n - 1n");
this.getDataView().setBigUint64(offset, value, true);
return offset + 8;
} | https://gitcode.com/iop123123/arkts-static-skills | 103b9cd332dc07d7e5909fa19d970ed64ca84440 | gitcode |
LYM15/FireflyCompanion | entry/src/main/ets/pages/createOrderPage_循环方式,未解决bindSheet的问题.ets | arkts | onPageShow | 陪诊师性别 | onPageShow(): void {
// 获取数据
this.hospitalData = mockHospital.map((item: HospitalItem) => item.name)
this.medicalChaperonSix = medicalChaperonData.map((item: MedicalChaperonItem) => item.name)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | onPageShow(): void {
// 获取数据
this.hospitalData = mockHospital.map((item: HospitalItem) => item.name)
this.medicalChaperonSix = medicalChaperonData.map((item: MedicalChaperonItem) => item.name)
} | https://github.com/LYM15/FireflyCompanion | f03178ad3a31df63061485d2fc12a183ceb08464 | github |
openharmony-sig/jtar | entry/src/ohosTest/ets/test/Ability.test.ets | arkts | TestTarInit | tartest初始化 | TestTarInit(): void {
fs.mkdir(this.GetTarSourceDir(), (err) => {
if (err) {
console.info("mkdir failed with error message:" + err.message + ",errorcode:" + err.code);
} else {
let filePath = this.GetTarSourceDir() + "/testFile.txt";
let file = fs.openSync(filePat... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left TestTarInit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#... | TestTarInit(): void {
fs.mkdir(this.GetTarSourceDir(), (err) => {
if (err) {
console.info("mkdir failed with error message:" + err.message + ",errorcode:" + err.code);
} else {
let filePath = this.GetTarSourceDir() + "/testFile.txt";
let file = fs.openSync(filePat... | https://gitee.com/openharmony-sig/jtar.git | a17633b6322838c4e182444ac907fed64b8ca811 | gitee |
Blue1-0/wanandroid_harmonyos | entry/src/main/ets/core/DataManager.ets | arkts | fetchArticleList | 分页拉取最新的文章列表 | fetchArticleList(num: number): ChainableRequest<ArticleEntity> {
const url = WanAndroidApi.articleList.replace('{num}', num.toString())
return AxiosUtils.get<ArticleEntity>(url)
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fetchArticleList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#id... | fetchArticleList(num: number): ChainableRequest<ArticleEntity> {
const url = WanAndroidApi.articleList.replace('{num}', num.toString())
return AxiosUtils.get<ArticleEntity>(url)
} | https://github.com/Blue1-0/wanandroid_harmonyos/blob/bb01bf64e40a14c6304363a3290077ea7baaed81/entry/src/main/ets/core/DataManager.ets#L31-L34 | cd5dc96280d3aec4fb317522ed029aeef58058a4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | sortCustomShelfItems | 对自定义书架内容进行排序 | private sortCustomShelfItems(items: ShelfMixedItem[]): ShelfMixedItem[] {
switch (this.customShelfSortType) {
case 'name_asc':
return items.sort((a, b) => a.name.localeCompare(b.name, 'zh-CN'));
case 'name_desc':
return items.sort((a, b) => b.name.localeCompare(a.name, 'zh-CN'));
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sortCustomShelfItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | private sortCustomShelfItems(items: ShelfMixedItem[]): ShelfMixedItem[] {
switch (this.customShelfSortType) {
case 'name_asc':
return items.sort((a, b) => a.name.localeCompare(b.name, 'zh-CN'));
case 'name_desc':
return items.sort((a, b) => b.name.localeCompare(a.name, 'zh-CN'));
... | https://github.com/DaLongZhuaZi/manxia | f3ce9b2778d284ca793348eda04a3bab66479213 | github |
somnio-software/my-bot-pal | entry/src/main/ets/features/chat/repository/ChatRepository.ets | arkts | mapForecastData | Map forecast data from API response | private mapForecastData(forecastDays: ForecastDay[]): ForecastData[] {
return forecastDays.map((day): ForecastData => ({
date: day.date,
condition: day.day.condition.text,
highTemp: `${day.day.maxtemp_c}°C`,
lowTemp: `${day.day.mintemp_c}°C`,
iconResource: `https:${day.day.condition.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapForecastData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left forecastDays AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subsc... | private mapForecastData(forecastDays: ForecastDay[]): ForecastData[] {
return forecastDays.map((day): ForecastData => ({
date: day.date,
condition: day.day.condition.text,
highTemp: `${day.day.maxtemp_c}°C`,
lowTemp: `${day.day.mintemp_c}°C`,
iconResource: `https:${day.day.condition.... | https://github.com/somnio-software/my-bot-pal | f01525a7dcf1f76381312f90783a408b192d3284 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/network/ApiService.ets | arkts | getUserFavorites | 获取指定用户的收藏列表(公开接口,用于查看他人主页) | static async getUserFavorites(userId: number, page: number = 1, limit: number = 20): Promise<FavoriteListResponse> {
const response = await httpClient.get('/favorites/user/' + userId + '?page=' + page + '&limit=' + limit);
const result = parseJsonSafe(response.data);
if (result) {
const data = ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left ... | static async getUserFavorites(userId: number, page: number = 1, limit: number = 20): Promise<FavoriteListResponse> {
const response = await httpClient.get('/favorites/user/' + userId + '?page=' + page + '&limit=' + limit);
const result = parseJsonSafe(response.data);
if (result) {
const data = ... | https://github.com/Harrisonls2004/WaterFlow | 7ff583c0f5efddf2a3bd0a4c71057801a76997cc | github |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/common/DateUtil.ets | arkts | padZero | 补零函数
@param num 数字
@returns 补零后的字符串 | private static padZero(num: number): string {
return num.toString().padStart(2, '0');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left padZero AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#... | private static padZero(num: number): string {
return num.toString().padStart(2, '0');
} | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | d377a4e2a9dfcceb533fc7182deb09fd1d25f7d1 | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | size | 获取已入路由栈的页面数
@param stackName
@returns | public static size(stackName: string = DEFAULT_STACK_NAME): number {
return ZRouter.getNavStackByName(stackName).size()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stackName A... | public static size(stackName: string = DEFAULT_STACK_NAME): number {
return ZRouter.getNavStackByName(stackName).size()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L91-L93 | 11fc26f8f4546833636c48cb33f127e86472c033 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | with | Creates a copy with replaced value on index
@param { int } index - index to change
@param { long } value - value to set
@returns { Uint32Array } - an Uint32Array with replaced value on index
@throws { RangeError } - If the index exceeds the array range, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStage... | public with(index: int, value: long): Uint32Array {
let res = new Uint32Array(this)
res.setUnsafeClamp(index, value)
return res
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: int, value: long): Uint32Array {
let res = new Uint32Array(this)
res.setUnsafeClamp(index, value)
return res
} | https://gitcode.com/iop123123/arkts-static-skills | 0116462b7e560aa4d205c48840db223661df23b4 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | isValidMangaStatus | 检查值是否为有效的漫画状态
@param value - 要检查的值
@returns 是否为有效漫画状态 | static isValidMangaStatus(value: Object): boolean {
if (!TypeGuards.isString(value)) {
return false;
}
const strValue = value as string;
// 使用显式枚举值检查替代Object.values
return strValue === MangaStatus.ONGOING ||
strValue === MangaStatus.COMPLETED ||
strValue === MangaStat... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidMangaStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static isValidMangaStatus(value: Object): boolean {
if (!TypeGuards.isString(value)) {
return false;
}
const strValue = value as string;
// 使用显式枚举值检查替代Object.values
return strValue === MangaStatus.ONGOING ||
strValue === MangaStatus.COMPLETED ||
strValue === MangaStat... | https://github.com/DaLongZhuaZi/manxia | 41e4a7846fb8615381028ba794ae0213dc59dd8e | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/UserCalendarManager.ets | arkts | deleteEvent | 删除单个日程 | async deleteEvent(id: number) {
const calendar = await this.getDefaultCalendar() as calendarManager.Calendar
try {
if (canIUse('SystemCapability.Applications.CalendarData')) {
return await calendar.deleteEvent(id)
} else {
new PromptAction().showToast({ message: '该设备不支持删除单个日程' })
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteEvent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async deleteEvent(id: number) {
const calendar = await this.getDefaultCalendar() as calendarManager.Calendar
try {
if (canIUse('SystemCapability.Applications.CalendarData')) {
return await calendar.deleteEvent(id)
} else {
new PromptAction().showToast({ message: '该设备不支持删除单个日程' })
... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 69859bdd10f1534e07b9cabba9328762208c0bf3 | gitcode |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/interceptor/RealInterceptorChain.ets | arkts | connectTimeout | Get the connection timeout.
@returns The connection timeout in milliseconds. | connectTimeout(): number {
return this._connectTimeout;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left connectTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | connectTimeout(): number {
return this._connectTimeout;
} | https://github.com/killetom/ktretrofit | 48a4333b03d4d8b7ee3c5c26306be1d95dd6cb7b | github |
offlinecat-dev/OCNetORM | src/main/ets/schema/SchemaBuilder.ets | arkts | resolveJoinColumnType | 获取多对多中间表外键列类型 | private resolveJoinColumnType(entityName: string): ColumnType {
const metadata = MetadataStorage.getInstance().getEntityMetadata(entityName)
if (metadata === null) {
return ColumnType.INTEGER
}
const pkColumn = metadata.getPrimaryKeyColumn()
if (pkColumn === null) {
return ColumnType.I... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveJoinColumnType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin... | private resolveJoinColumnType(entityName: string): ColumnType {
const metadata = MetadataStorage.getInstance().getEntityMetadata(entityName)
if (metadata === null) {
return ColumnType.INTEGER
}
const pkColumn = metadata.getPrimaryKeyColumn()
if (pkColumn === null) {
return ColumnType.I... | https://github.com/offlinecat-dev/OCNetORM | 07b2ae017a01ff104bfb315df4a1e76f261fa929 | github |
erosTeam/NextE | shared/src/main/ets/services/CommentTranslationService.ets | arkts | stat | Count + translated-text bytes of the unexpired comment-translation cache, for the cache page. | static async stat(context: common.UIAbilityContext): Promise<CacheStat> {
const out: CacheStat = new CacheStat()
try {
const store: relationalStore.RdbStore = await LocalDataStore.open(context)
const rs: relationalStore.ResultSet = await store.querySql(
'SELECT COUNT(*) AS c, COALESCE(SUM(... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left stat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig... | static async stat(context: common.UIAbilityContext): Promise<CacheStat> {
const out: CacheStat = new CacheStat()
try {
const store: relationalStore.RdbStore = await LocalDataStore.open(context)
const rs: relationalStore.ResultSet = await store.querySql(
'SELECT COUNT(*) AS c, COALESCE(SUM(... | https://github.com/erosTeam/NextE | 4162f497d575c94be505f0c8e560209b398310b1 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets | arkts | onError | Called by the native engine when a protocol-layer payload is rejected.
Renders a top red banner so the failure is visible in the playground.
@param surface - The associated Surface, or null when not bound.
@param code - Error code from core/src/agenui_errorcode_define.h.
@param message - Human-readable error descriptio... | onError(surface: Surface | null, code: number, message: string): void {
const surfaceText = surface ? surface.surfaceId : '<no surface>';
hilog.error(DOMAIN, TAG, `AGenUI Error code=${code} surface=${surfaceText} message=${message}`);
if (this.indexComponent) {
this.indexComponent.showErrorBanner(`A... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left surface AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left Surface AST#identi... | onError(surface: Surface | null, code: number, message: string): void {
const surfaceText = surface ? surface.surfaceId : '<no surface>';
hilog.error(DOMAIN, TAG, `AGenUI Error code=${code} surface=${surfaceText} message=${message}`);
if (this.indexComponent) {
this.indexComponent.showErrorBanner(`A... | https://github.com/AGenUI/AGenUI | 305661714b04c7f2fcea8b4af8a2435e2f1e4052 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | removeCacheData | 删除缓存数据(测试用) | public async removeCacheData(key: string): Promise<void> {
try {
if (this.testCache) {
this.testCache.delete(key);
}
logger.debug(TAG, `删除缓存数据: ${key}`);
} catch (error) {
logger.error(TAG, '删除缓存数据失败' + String(error));
throw error as Error;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left removeCacheData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AS... | public async removeCacheData(key: string): Promise<void> {
try {
if (this.testCache) {
this.testCache.delete(key);
}
logger.debug(TAG, `删除缓存数据: ${key}`);
} catch (error) {
logger.error(TAG, '删除缓存数据失败' + String(error));
throw error as Error;
}
} | https://github.com/DaLongZhuaZi/manxia | a54356008067e86fa0648b8eee1a7f18aabba79d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | getUint32 | === Uint32 ===
Read bytes as they represent given type
@param { int } byteOffset zero index to read
@returns { int } return byteOffset's Uint32 value
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUint32(byteOffset: int): number {
return this.getUint32Big(byteOffset)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUint32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifi... | public getUint32(byteOffset: int): number {
return this.getUint32Big(byteOffset)
} | https://gitcode.com/iop123123/arkts-static-skills | 06bd2f2aff39b249777554b2ce62dff76a4cdde5 | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/Logger.ets | arkts | debug | Writes a debug line to hilog; joins all parts with " | ".
@param args Text segments to log. | public static debug(...args: Object[]): void {
hilog.debug(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#... | public static debug(...args: Object[]): void {
hilog.debug(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 90a2c1ae7065afa73f97cf3113a0fb6f19abdeee | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDBConfig.ets | arkts | closeDB | 关闭数据库(可选,通常在应用退出时调用) | public async closeDB(): Promise<void> {
if (this.rdbStore) {
try {
await this.rdbStore.close();
console.info('[ContactDBConfig] 数据库关闭成功');
this.rdbStore = null;
} catch (error) {
console.error('[ContactDBConfig] 关闭数据库失败: ' + JSON.stringify(error));
}
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left closeDB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | public async closeDB(): Promise<void> {
if (this.rdbStore) {
try {
await this.rdbStore.close();
console.info('[ContactDBConfig] 数据库关闭成功');
this.rdbStore = null;
} catch (error) {
console.error('[ContactDBConfig] 关闭数据库失败: ' + JSON.stringify(error));
}
}
} | https://gitcode.com/openharmony/codelabs | 1e9c9d137e343fab29cf67e2396769e540a85256 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | getDataSetForEntry | Returns the DataSet that contains the provided Entry, or null, if no
DataSet contains this Entry.
@param e
@return | public getDataSetForEntry(e: EntryOhos): T | null {
if (e == null)
return null;
if (this.mDataSets) {
for (let i = 0; i < this.mDataSets.size(); i++) {
let dataSet: T = this.mDataSets.get(i);
for (let j = 0; j < dataSet.getEntryCount(); j++) {
if (dataSet.getEntryForXV... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSetForEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public getDataSetForEntry(e: EntryOhos): T | null {
if (e == null)
return null;
if (this.mDataSets) {
for (let i = 0; i < this.mDataSets.size(); i++) {
let dataSet: T = this.mDataSets.get(i);
for (let j = 0; j < dataSet.getEntryCount(); j++) {
if (dataSet.getEntryForXV... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 6d5fe4824386ab5b93d518f91c8fe8c06d45240f | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setUTCHours | Sets the hour for a specified date according to universal time.
@param { int } value new hours
@param { int } min
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setUTCHours(value: int, min: int): long {
this.setUTCHours(value);
this.setUTCMinutes(min);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public setUTCHours(value: int, min: int): long {
this.setUTCHours(value);
this.setUTCMinutes(min);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | ef64741afc1c383b644b7ec78d169fae159930fe | gitcode |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/IMService.ets | arkts | deleteDraft | 删除草稿
@param conversationId 会话ID | async deleteDraft(conversationId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/im/drafts/${conversationId}`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteDraft AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AST#:#... | async deleteDraft(conversationId: string): Promise<ApiResponse<any>> {
return this.client.delete<any>(`/api/v1/im/drafts/${conversationId}`)
} | https://github.com/David8Idira/AI-OA | 3a57126800cd87b6900351e094a1cd71934cfa53 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | syncToAppStorage | 同步设置到AppStorage | syncToAppStorage(): void {
try {
this.settingsCache.forEach((value: string, key: string) => {
AppStorage.setOrCreate(key, value === 'true' ? true : value === 'false' ? false : value);
});
// 特别处理Download同步目录设置,使用特定的AppStorage键名
const downloadSyncDirPath = this.settingsCache.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncToAppStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | syncToAppStorage(): void {
try {
this.settingsCache.forEach((value: string, key: string) => {
AppStorage.setOrCreate(key, value === 'true' ? true : value === 'false' ? false : value);
});
// 特别处理Download同步目录设置,使用特定的AppStorage键名
const downloadSyncDirPath = this.settingsCache.... | https://github.com/DaLongZhuaZi/manxia | fbccd459747821a98e94fdc062b91d859117fa24 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoadResult.ets | arkts | hasAnyFailure | 检查是否有任何失败
@returns 是否有失败 | hasAnyFailure(): boolean {
for (let i = 0; i < this.results.length; i++) {
if (!this.results[i].success) {
return true
}
}
return false
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAnyFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state... | hasAnyFailure(): boolean {
for (let i = 0; i < this.results.length; i++) {
if (!this.results[i].success) {
return true
}
}
return false
} | https://github.com/offlinecat-dev/OCNetORM | e8115ed7d03d30db921b75d8952c56d014e8ff75 | github |
openharmony/arkui_ace_engine | advanced_ui_component/treeviewv2/source/treeviewv2.ets | arkts | reloadListNode | Reload the array named 'listNode'
@param tmp | public reloadListNode(tmp: NodeInfo[]): void {
let index: number = 0;
let listIndex: number = 0;
this.listNode.splice(0, this.listNode.length);
this.loadedNodeIdAndIndexMap.clear();
this.loadedListNode.splice(0, this.loadedListNode.length);
this.traverseNodeDF((node: NodeItem): boolean => {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reloadListNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tmp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressi... | public reloadListNode(tmp: NodeInfo[]): void {
let index: number = 0;
let listIndex: number = 0;
this.listNode.splice(0, this.listNode.length);
this.loadedNodeIdAndIndexMap.clear();
this.loadedListNode.splice(0, this.loadedListNode.length);
this.traverseNodeDF((node: NodeItem): boolean => {
... | https://gitcode.com/openharmony/arkui_ace_engine | ca59eb0966ddf66ba2ce062c008dc1dfae836b9d | gitcode |
daugf2527/harmonyos-libretro-emulator | entry/src/main/ets/components/VirtualController.ets | arkts | triggerHaptic | 触觉反馈辅助函数 | function triggerHaptic(duration: number = 10) {
try {
vibrator.startVibration({
type: 'time',
duration: duration
}, {
usage: 'touch'
}, (error) => {
if (error) {
LogHelper.error('VirtualController', 'Input', `振动失败: ${error.message}`, 0xD004);
}
});
} catch (e) {... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left triggerHaptic AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left duration AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function triggerHaptic(duration: number = 10) {
try {
vibrator.startVibration({
type: 'time',
duration: duration
}, {
usage: 'touch'
}, (error) => {
if (error) {
LogHelper.error('VirtualController', 'Input', `振动失败: ${error.message}`, 0xD004);
}
});
} catch (e) {... | https://github.com/daugf2527/harmonyos-libretro-emulator | d3c6904d0851c08dbdbb32fb21e6ba7802eeab50 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | searchFromKugou | 酷狗音乐搜索实现 | private async searchFromKugou(keyword: string, page: number, limit: number): Promise<SearchResult> {
const httpRequest = http.createHttp()
try {
const requestParams = new HttpRequestParams()
requestParams.set('keyword', keyword)
requestParams.set('page', page.toString())
requestParams... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left searchFromKugou AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Le... | private async searchFromKugou(keyword: string, page: number, limit: number): Promise<SearchResult> {
const httpRequest = http.createHttp()
try {
const requestParams = new HttpRequestParams()
requestParams.set('keyword', keyword)
requestParams.set('page', page.toString())
requestParams... | https://github.com/cpdd5201314/harmonyOS-music-app | 16acd41cd3bf5757573607231858bd01a1c868ed | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/material_shadowReceiver.ets | arkts | toggleShadow | Toggle the shadow receiving state of the plane | toggleShadow(): void {
if (this.material) {
this.material.shadowReceiver = !this.material.shadowReceiver;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleShadow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le... | toggleShadow(): void {
if (this.material) {
this.material.shadowReceiver = !this.material.shadowReceiver;
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 2abdfab44d67393d9db5c7c9e26f5d4487c58611 | gitcode |
openharmony/applications_print_spooler | entry/src/main/ets/pages/PrintPage.ets | arkts | updateSupportParam | 更新打印机能力支持的参数
@param cap | updateSupportParam(printer: PrinterInfo) {
Log.info(TAG, 'updateSupportParam printer: ' + StringUtil.encodeCommonString(this.printer?.printerName));
let cap = printer.capability
if (CheckEmptyUtils.isEmpty(cap)) {
return
}
if (cap!.colorMode === ColorCode.MONOCHROME) {
this.colorMode ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateSupportParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left printer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PrinterInfo AST#ide... | updateSupportParam(printer: PrinterInfo) {
Log.info(TAG, 'updateSupportParam printer: ' + StringUtil.encodeCommonString(this.printer?.printerName));
let cap = printer.capability
if (CheckEmptyUtils.isEmpty(cap)) {
return
}
if (cap!.colorMode === ColorCode.MONOCHROME) {
this.colorMode ... | https://gitee.com/openharmony/applications_print_spooler.git | f2187fbb3776afe39fd8de589aa3eab7daf3819d | gitee |
openharmony-sig/flutter_packages | packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets | arkts | chooseMultiImagesFromGallery | 选择多个图片 | chooseMultiImagesFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result<ArrayList<string>>): void {
if (!this.setPendingOptionsAndResult(options, null, result)) {
this.finishWithAlreadyActiveError(result);
return;
}
this.chooseMedia(9, 'handleChooseMediaResult', p... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left chooseMultiImagesFromGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageSelectionOptions AS... | chooseMultiImagesFromGallery(options: ImageSelectionOptions, usePhotoPicker: boolean, result: Result<ArrayList<string>>): void {
if (!this.setPendingOptionsAndResult(options, null, result)) {
this.finishWithAlreadyActiveError(result);
return;
}
this.chooseMedia(9, 'handleChooseMediaResult', p... | https://gitee.com/openharmony-sig/flutter_packages.git | 62b764b8ad80c4c0c1b4bc8f04bc45700205d10a | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.