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 |
|---|---|---|---|---|---|---|---|---|---|---|
the-wwyang/kids-learning-app | src/main/ets/storage/AppStorageManager.ets | arkts | constructor | 最后学习时间戳 | constructor(
moduleName: string,
completedLessons: number = 0,
totalLessons: number = 0,
stars: number = 0,
lastStudyTime: number = 0
) {
this.moduleName = moduleName;
this.completedLessons = completedLessons;
this.totalLessons = totalLessons;
this.stars = stars;
this.lastStu... | 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 moduleName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST... | constructor(
moduleName: string,
completedLessons: number = 0,
totalLessons: number = 0,
stars: number = 0,
lastStudyTime: number = 0
) {
this.moduleName = moduleName;
this.completedLessons = completedLessons;
this.totalLessons = totalLessons;
this.stars = stars;
this.lastStu... | https://github.com/the-wwyang/kids-learning-app | 97efda8877fd2125c0298efdbf4afa84af7fe214 | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | getDisplayExp | 将表达式转换为用户界面展示的表达式.
@param value 计算表达式.
@returns 用于页面展示的表达式. | public static getDisplayExp(value: string): string {
const result: string = DisplayUtil.formatAddSeparator(value);
return result;
} | 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 getDisplayExp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : A... | public static getDisplayExp(value: string): string {
const result: string = DisplayUtil.formatAddSeparator(value);
return result;
} | https://gitee.com/openharmony-sig/applications_calculator.git | 594046aa1da5509ebff870f2e3c5d94c578bdac4 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitMapInt32String | 访问 map<int32, string> 字段 | visitMapInt32String(value: Map<number, string>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 0).int32(k)
entryWriter.tag(2, 2).string(v)
this.writer.tag(fieldNumber, 2).ldelim(entryWriter)
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt32String AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifie... | visitMapInt32String(value: Map<number, string>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 0).int32(k)
entryWriter.tag(2, 2).string(v)
this.writer.tag(fieldNumber, 2).ldelim(entryWriter)
})
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | c142008d10bd87dd9e18409f0543bfc162bdcf16 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/AudioVibrationService.ets | arkts | stop | 停止所有振动 | stop(): void {
this.stopAll();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop 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 AS... | stop(): void {
this.stopAll();
} | https://github.com/AlkaidLab/moonlight-harmony | 2d42e27901508a522d58034a931eac9c503c71c7 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/AnnotationEngine.ets | arkts | generateAnnotationId | 生成标注ID
@returns 唯一标注ID | private generateAnnotationId(): string {
return `ANN_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateAnnotationId 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 st... | private generateAnnotationId(): string {
return `ANN_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | https://github.com/LJ666-ui/harmony-health-care | c222684a0c9a6534c9a455ee3b9e88ac6608e9c8 | github |
openharmony-tpc/ohos_coap | libcoap/src/main/ets/components/mainpage/CoapClient.ets | arkts | setFormat | 客户端设置透传格式
@param format post,put透传参数的格式 | setFormat(format: ContentFormat) {
this.coapClient.setFormat(this.classId, format);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContentFormat AST#identifier#... | setFormat(format: ContentFormat) {
this.coapClient.setFormat(this.classId, format);
} | https://gitee.com/openharmony-tpc/ohos_coap.git | 19c5ee561e735ee6d918970e81063f7ce5cac653 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | initProxyTestSites | 初始化代理测试网站列表 | private initProxyTestSites(): ProxyTestSite[] {
const sites: ProxyTestSite[] = [];
for (const site of DEFAULT_PROXY_TEST_SITES) {
const newSite: ProxyTestSite = {
name: site.name,
url: site.url,
icon: site.icon,
status: 'idle'
};
sites.push(newSite);
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initProxyTestSites 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 initProxyTestSites(): ProxyTestSite[] {
const sites: ProxyTestSite[] = [];
for (const site of DEFAULT_PROXY_TEST_SITES) {
const newSite: ProxyTestSite = {
name: site.name,
url: site.url,
icon: site.icon,
status: 'idle'
};
sites.push(newSite);
}
... | https://github.com/DaLongZhuaZi/manxia | e6220ce36c80e0e95f7b5234f68813c91c13eee7 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/LibraryApi.ets | arkts | postAddedMovies | @summary Reports that new movies have been added by an external source.
@param {LibraryApiPostAddedMoviesRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof LibraryApi | public postAddedMovies(requestParameters: LibraryApiPostAddedMoviesRequest = {}): Promise<void> {
return this.apiClient.post({path: `/Library/Movies/Added`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left postAddedMovies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ass... | public postAddedMovies(requestParameters: LibraryApiPostAddedMoviesRequest = {}): Promise<void> {
return this.apiClient.post({path: `/Library/Movies/Added`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | c92853739b65637c15fe5bce910a0c5b23245c5e | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.SubHeader.ets | arkts | getStringByResource | get resource string
@param resourceId resource id
@param defaultString default value
@returns resource string | public static getStringByResource(context: common.Context, resourceId: long, defaultString: string): string {
try {
let resourceString: string = context.resourceManager.getStringSync(resourceId);
if (resourceString === '') {
return defaultString;
} else {
return resourceString;
... | 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 getStringByResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#... | public static getStringByResource(context: common.Context, resourceId: long, defaultString: string): string {
try {
let resourceString: string = context.resourceManager.getStringSync(resourceId);
if (resourceString === '') {
return defaultString;
} else {
return resourceString;
... | https://gitcode.com/openharmony/arkui_ace_engine | bbdb3d28bdf5eb1c825e6d61fb80fcac890829bf | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnSwitchPage.ets | arkts | build | 构建开关展示页面 | build() {
AppNavDestination({
title: "开关",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "开关",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | https://github.com/codelably/tuniao-ui | 2e38626016eb8c95d5f5624787c71aab693da458 | github |
honjow/Next2V | shared/src/main/ets/utils/ImageBytesUtils.ets | arkts | sniffMime | Detect the image MIME from magic bytes; defaults to image/jpeg when unknown. | static sniffMime(bytes: Uint8Array): string {
if (bytes.length >= 8 && bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4E && bytes[3] === 0x47) {
return 'image/png'
}
if (bytes.length >= 3 && bytes[0] === 0xFF && bytes[1] === 0xD8 && bytes[2] === 0xFF) {
return 'image/jpeg'
}
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sniffMime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8... | static sniffMime(bytes: Uint8Array): string {
if (bytes.length >= 8 && bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4E && bytes[3] === 0x47) {
return 'image/png'
}
if (bytes.length >= 3 && bytes[0] === 0xFF && bytes[1] === 0xD8 && bytes[2] === 0xFF) {
return 'image/jpeg'
}
... | https://github.com/honjow/Next2V | ac9d1923cd0cceff2b386249af49076ca61dbac7 | github |
heeh02/superconnect | harmony/entry/src/main/ets/input/KeyboardHandler.ets | arkts | onWillDelete | Soft-keyboard backspace/forward-delete → Mac keystroke (return false: keep field empty). | onWillDelete(info: DeleteValue): boolean {
const code: number = (info.direction === TextDeleteDirection.FORWARD)
? KeyCode.KEYCODE_FORWARD_DEL : KeyCode.KEYCODE_DEL;
this.sendKey(InputType.KeyDown, code, 0);
this.sendKey(InputType.KeyUp, code, 0);
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWillDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DeleteValue AST#identifier#Right AST#)#Left... | onWillDelete(info: DeleteValue): boolean {
const code: number = (info.direction === TextDeleteDirection.FORWARD)
? KeyCode.KEYCODE_FORWARD_DEL : KeyCode.KEYCODE_DEL;
this.sendKey(InputType.KeyDown, code, 0);
this.sendKey(InputType.KeyUp, code, 0);
return false;
} | https://github.com/heeh02/superconnect | 4a4419e7444ea6fbb9a1a2f75947a826cfaf6509 | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/CommonUtil.ets | arkts | getCommonDialogConfig | Get common dialog controller configurations
@return Common dialog controller configurations | static getCommonDialogConfig(): CustomDialogControllerOptions {
return {
builder: undefined,
autoCancel: true,
alignment: CommonUtil.isDevicePhone() ? DialogAlignment.Bottom : undefined,
customStyle: CommonUtil.isDevicePhone(),
};
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCommonDialogConfig 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 ... | static getCommonDialogConfig(): CustomDialogControllerOptions {
return {
builder: undefined,
autoCancel: true,
alignment: CommonUtil.isDevicePhone() ? DialogAlignment.Bottom : undefined,
customStyle: CommonUtil.isDevicePhone(),
};
} | https://gitee.com/openharmony-sig/applications_clock.git | a0a54791d30b3d308dec0b461a88f73b3cada5a9 | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/button/ButtonDemo.ets | arkts | applyContent | 返回指定的自定义按钮 | applyContent() : WrappedBuilder<[ButtonConfiguration]>
{
return wrapBuilder(buildButton)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent 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#instantiation_expre... | applyContent() : WrappedBuilder<[ButtonConfiguration]>
{
return wrapBuilder(buildButton)
} | https://github.com/webabcd/HarmonyDemo | 1273cfb048aa124893b44a443faa8564f2a951a3 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test61_original_index.ets | arkts | coinChange | --- Dynamic programming: coin change --- | function coinChange(coins: number[], amount: number): number {
let dp: number[] = [];
for (let i: number = 0; i <= amount; i++) {
dp.push(amount + 1);
}
dp[0] = 0;
for (let i: number = 1; i <= amount; i++) {
for (let j: number = 0; j < coins.length; j++) {
if (coins[j] <= i) {
let prev: ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left coinChange AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left coins AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function coinChange(coins: number[], amount: number): number {
let dp: number[] = [];
for (let i: number = 0; i <= amount; i++) {
dp.push(amount + 1);
}
dp[0] = 0;
for (let i: number = 1; i <= amount; i++) {
for (let j: number = 0; j < coins.length; j++) {
if (coins[j] <= i) {
let prev: ... | https://github.com/miaochiahao/ark-ghidra | 6583bf414dfeae88bbb6b13706a21f8f01a9f6e5 | github |
HarmonyOS_Samples/guide-snippets | Ability/InsightIntentConfigDevelopment/entry/src/main/ets/abilities/MusicPlayerAbility.ets | arkts | onWindowStageCreate | 前台模式:窗口舞台创建时加载播放页面 | onWindowStageCreate(windowStage: window.WindowStage) {
this.windowStage = windowStage;
hilog.info(DOMAIN, 'testTag', `[MusicPlayerAbility]`);
// 加载播放页面(路径对应pages目录下的PlayerPage)
windowStage.loadContent('pages/PlayerPage', async (err) => {
if (err.code) {
hilog.error(DOMAIN, 'testTag',
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left win... | onWindowStageCreate(windowStage: window.WindowStage) {
this.windowStage = windowStage;
hilog.info(DOMAIN, 'testTag', `[MusicPlayerAbility]`);
// 加载播放页面(路径对应pages目录下的PlayerPage)
windowStage.loadContent('pages/PlayerPage', async (err) => {
if (err.code) {
hilog.error(DOMAIN, 'testTag',
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | ff5343905d085143c049d413c8275e6793126807 | gitcode |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/TaskpoolUtil.ets | arkts | extractVideoMetadataTask | TaskPool 任务:提取视频元数据和封面 | @Concurrent
async function extractVideoMetadataTask(uri: string): Promise<MetadataExtractionResult> {
let avMetadataExtractor: media.AVMetadataExtractor | undefined
let file: fs.File | undefined
try {
// 创建元数据提取器
avMetadataExtractor = await media.createAVMetadataExtractor()
// 打开文件
file = fs.ope... | 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#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left extractVideoMetadataTask AST#identifier#Right AST#form... | @Concurrent
async function extractVideoMetadataTask(uri: string): Promise<MetadataExtractionResult> {
let avMetadataExtractor: media.AVMetadataExtractor | undefined
let file: fs.File | undefined
try {
// 创建元数据提取器
avMetadataExtractor = await media.createAVMetadataExtractor()
// 打开文件
file = fs.ope... | https://github.com/Yebingiscn/SweetVideo | 820e5ae389c6d917df0ac4a2c8a1afa9ad4703ca | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/CommonUtils.ets | arkts | showUnSaveConfirm | 未保存弹框确认
@param context 上下文
@param cancel 取消回调
@param confirm 确定回调 | public static showUnSaveConfirm(context: UIContext, callback?: ConfirmCallback): void {
CommonUtils.showConfirmDialog(context, $r('app.string.dialog_confirm_title'), $r('app.string.dialog_changes_confirm_message'), callback);
} | 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 showUnSaveConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le... | public static showUnSaveConfirm(context: UIContext, callback?: ConfirmCallback): void {
CommonUtils.showConfirmDialog(context, $r('app.string.dialog_confirm_title'), $r('app.string.dialog_changes_confirm_message'), callback);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L210-L212 | ac889c5d74abfce81568c841901845051e518007 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isValidCodePoint | isValidCodePoint() checks if the code point is correctly encoded.
See UTF-16 for more details.
@param { UTF_16_CodePoint } codePoint
@returns { boolean }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isValidCodePoint(codePoint: UTF_16_CodePoint): boolean {
return (codePoint >= 0 && codePoint <= Char.MAX_CODE_POINT &&
!(codePoint >= (Char.HIGH_SURROGATE_MIN.toInt()) && codePoint <= (Char.LOW_SURROGATE_MAX.toInt())));
} | 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 isValidCodePoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left codePoint AST#identifier#Right AST#:#L... | public static isValidCodePoint(codePoint: UTF_16_CodePoint): boolean {
return (codePoint >= 0 && codePoint <= Char.MAX_CODE_POINT &&
!(codePoint >= (Char.HIGH_SURROGATE_MIN.toInt()) && codePoint <= (Char.LOW_SURROGATE_MAX.toInt())));
} | https://gitcode.com/iop123123/arkts-static-skills | 9a36094dcb71ddb153e7c1ddf59957dfa5b6132d | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets | arkts | dropTabIntoMyAppTunnel | DRAG & DROP
Drops a tab into the dedicated MyApp tunnel
And packs a unifiedData.
@param tab The meowTabInfo.
@returns unifiedData with applicationDefinedType of meowTabInfoUnifiedType. | dropTabIntoMyAppTunnel(tab: meowTabInfo) {
getCreateMyApp().dataTunnelForTabs = tab;
// Fill data :P
let unifiedData = new unifiedDataChannel.UnifiedData();
// Application defined item record
let r = new unifiedDataChannel.ApplicationDefinedRecord();
r.applicationDefinedType = meowTabInfoUni... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left dropTabIntoMyAppTunnel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tab AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left meowTabInfo AST#ide... | dropTabIntoMyAppTunnel(tab: meowTabInfo) {
getCreateMyApp().dataTunnelForTabs = tab;
// Fill data :P
let unifiedData = new unifiedDataChannel.UnifiedData();
// Application defined item record
let r = new unifiedDataChannel.ApplicationDefinedRecord();
r.applicationDefinedType = meowTabInfoUni... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 14fde5c12d06408229aff0ab728ae950ce79c344 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/entry/src/main/ets/scan/ScanPage.ets | arkts | initCustomScan | 初始化自定义扫码器 | initCustomScan() {
this.userGrant = true
try {
customScan.init(this.options)
} catch (error) {
console.error('lucy++ 扫码初始化失败', error.code)
}
this.startCustomScan()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initCustomScan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | initCustomScan() {
this.userGrant = true
try {
customScan.init(this.options)
} catch (error) {
console.error('lucy++ 扫码初始化失败', error.code)
}
this.startCustomScan()
} | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 5fa4b09b8f600d7dfec2712a7ed0bf391193fa7c | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateBuilder.ets | arkts | withOptions | 设置构建选项 | withOptions(options: TemplateApplyOptions): TemplateBuilder {
this.options = {
overwriteExisting: options.overwriteExisting ?? this.options.overwriteExisting,
copyTags: options.copyTags ?? this.options.copyTags,
copyIcon: options.copyIcon ?? this.options.copyIcon,
copyExpiry: options.copyE... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withOptions 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 TemplateApplyOptions AST#identifier#Right... | withOptions(options: TemplateApplyOptions): TemplateBuilder {
this.options = {
overwriteExisting: options.overwriteExisting ?? this.options.overwriteExisting,
copyTags: options.copyTags ?? this.options.copyTags,
copyIcon: options.copyIcon ?? this.options.copyIcon,
copyExpiry: options.copyE... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L193-L201 | b28e77b7deaecd036573adf803ac520b20af0dac | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.ComposeListItem.ets | arkts | getAccessibilityText | Obtain accessible text
@param resource initial resource
@param selected select state
@returns string | function getAccessibilityText(resource: ResourceStr): string {
try {
let resourceString: string = '';
if (typeof resource === 'string') {
resourceString = resource as string;
} else {
let uiContent: Context | undefined = UIContext.resolveUIContext()?.getHostContext();
if (uiContent) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getAccessibilityText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resource AST#identifier#Right AST#type_annotation#Left AST#:#Left... | function getAccessibilityText(resource: ResourceStr): string {
try {
let resourceString: string = '';
if (typeof resource === 'string') {
resourceString = resource as string;
} else {
let uiContent: Context | undefined = UIContext.resolveUIContext()?.getHostContext();
if (uiContent) {
... | https://gitcode.com/openharmony/arkui_ace_engine | 6b47402bcd5a41f1b3f4bdb4539bdecb69bf1d90 | gitcode |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/utils/EventBus.ets | arkts | off | Unsubscribe from events
@param eventName Event name to unsubscribe | off(eventName: string): void {
const eventId = EventBus.getEventId(eventName);
console.log(`[EventBus] 🗑️ Unsubscribing from "${eventName}" (ID: ${eventId})`);
emitter.off(eventId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left off AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AS... | off(eventName: string): void {
const eventId = EventBus.getEventId(eventName);
console.log(`[EventBus] 🗑️ Unsubscribing from "${eventName}" (ID: ${eventId})`);
emitter.off(eventId);
} | https://github.com/Tencent-RTC/TUIKit_Harmony | ddbbcd36213dd2939210d3296da93ba1bb2e111a | github |
yang-kun-long/HarmonyAccounting | entry/src/main/ets/pages/MainPage.ets | arkts | deleteListItem | 删除列表项
遍历并删除待删除列表中的每个项。首先找到项在总列表中的索引,然后使用splice方法将其移除,
同时调用AccountTable的deleteData方法来删除项。最后清空待删除列表,并设置编辑状态为false。 | deleteListItem() {
// 遍历待删除列表
for (let i = 0; i < this.deleteList.length; i++) {
// 找到当前项在总列表中的索引
let index = this.accounts.indexOf(this.deleteList[i]);
// 从总列表中移除该项
this.accounts.splice(index, 1);
// 调用AccountTable的deleteData方法删除项,不需处理回调结果
this.AccountTable.deleteData(this... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteListItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | deleteListItem() {
// 遍历待删除列表
for (let i = 0; i < this.deleteList.length; i++) {
// 找到当前项在总列表中的索引
let index = this.accounts.indexOf(this.deleteList[i]);
// 从总列表中移除该项
this.accounts.splice(index, 1);
// 调用AccountTable的deleteData方法删除项,不需处理回调结果
this.AccountTable.deleteData(this... | https://github.com/yang-kun-long/HarmonyAccounting | 4d9a01aa15d0d56bf9b068418d9630edf886b351 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | isValidTimestamp | 检查值是否为有效的时间戳
@param value - 要检查的值
@returns 是否为有效时间戳 | static isValidTimestamp(value: Object): boolean {
if (!TypeGuards.isNumber(value)) {
return false;
}
const numValue = value as number;
return numValue > 0 && numValue <= Date.now() + 86400000; // 不超过当前时间+1天
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidTimestamp 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... | static isValidTimestamp(value: Object): boolean {
if (!TypeGuards.isNumber(value)) {
return false;
}
const numValue = value as number;
return numValue > 0 && numValue <= Date.now() + 86400000; // 不超过当前时间+1天
} | https://github.com/DaLongZhuaZi/manxia | 0fcbb0b84cb407b65b656c3e323d61a9adac4aef | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSource.ets | arkts | getCategoryMangasSorted | 获取指定分类的漫画并排序 | private async getCategoryMangasSorted(categoryId: number, sortType: MangaSortType, sortDirection: SortDirection): Promise<ComicInfo[]> {
const mangas = await this.getCategoryMangas(categoryId);
return this.sortMangas(mangas, sortType, sortDirection);
} | 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 getCategoryMangasSorted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Le... | private async getCategoryMangasSorted(categoryId: number, sortType: MangaSortType, sortDirection: SortDirection): Promise<ComicInfo[]> {
const mangas = await this.getCategoryMangas(categoryId);
return this.sortMangas(mangas, sortType, sortDirection);
} | https://github.com/DaLongZhuaZi/manxia | f1dbae21df7a978e2cd78e86d35395dc5fec1c5e | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | $_get | Returns the item at that index.
@param { int } index - The zero-based index of the desired code unit.
@returns { int } The element in the bitVector matching the given index.
@throws { BusinessError } 10200001 - If the index is out of range. | public $_get(index: int): int {
this.checkIndex(index);
return this.getBitUnsafe(index);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public $_get(index: int): int {
this.checkIndex(index);
return this.getBitUnsafe(index);
} | https://gitcode.com/iop123123/arkts-static-skills | 8e809d2d6150d99088609244f2a133ccff74dc0b | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | validatePosition | 验证位置有效性 | private validatePosition(pos: Position3D): boolean {
if (!pos || !Number.isFinite(pos.x) || !Number.isFinite(pos.y) || !Number.isFinite(pos.z)) {
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validatePosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private validatePosition(pos: Position3D): boolean {
if (!pos || !Number.isFinite(pos.x) || !Number.isFinite(pos.y) || !Number.isFinite(pos.z)) {
return false;
}
return true;
} | https://github.com/LJ666-ui/harmony-health-care | 196a4f063505f639a19ab0d05478dd5d387990ea | github |
ZestBox-18/kitebook-frontend | commons/kite_utils/src/main/ets/utils/database/DatabaseManager.ets | arkts | executeUpgradeScript | 执行单个升级脚本
@param script 升级脚本 | private async executeUpgradeScript(script: DatabaseUpgradeSql): Promise<void> {
Clog.log(TAG,`执行升级脚本: ${script.fromVersion} -> ${script.toVersion}`);
if (script.description) {
Clog.log(TAG,`升级描述: ${script.description}`);
}
for (let i = 0; i < script.sql.length; i++) {
const sqlSt... | 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 executeUpgradeScript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left script AST#identifier#Right AST#... | private async executeUpgradeScript(script: DatabaseUpgradeSql): Promise<void> {
Clog.log(TAG,`执行升级脚本: ${script.fromVersion} -> ${script.toVersion}`);
if (script.description) {
Clog.log(TAG,`升级描述: ${script.description}`);
}
for (let i = 0; i < script.sql.length; i++) {
const sqlSt... | https://github.com/ZestBox-18/kitebook-frontend | 4d192ab10a839d726a95272cd6779489f497268a | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/FolderUtil.ets | arkts | getFolderIconColor | Get folder Icon color
@param folderDataArray - Folder data list
@param selectFolderUuid - Selected fold uuid
@param isSelected - is selected or not
@return Resource | string - color value | getFolderIconColor(folderDataArray: FolderData[], selectFolderUuid: string, isSelected: boolean): Resource | string {
let folderData: FolderData = this.getFolderData(folderDataArray, selectFolderUuid)
if (folderData == undefined) {
LogUtil.info(TAG, "FolderIconColor is 182431")
return $r("app.colo... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFolderIconColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left ... | getFolderIconColor(folderDataArray: FolderData[], selectFolderUuid: string, isSelected: boolean): Resource | string {
let folderData: FolderData = this.getFolderData(folderDataArray, selectFolderUuid)
if (folderData == undefined) {
LogUtil.info(TAG, "FolderIconColor is 182431")
return $r("app.colo... | https://gitee.com/openharmony/applications_notes.git | e11c2dfa25ed0bd7f15527c2e0aea531a47c00ec | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | executeExtract | 执行提取操作 | private async executeExtract(action: ExtractAction, context: ActionContext): Promise<Record<string, string | string[]> | Array<Record<string, string>>> {
// 根据数据源类型处理
if (action.source === 'variable') {
// 从变量中提取数据
const variableName = action.variable || '';
logger.info(TAG, `从变量提取数据: ${vari... | 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 executeExtract AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left... | private async executeExtract(action: ExtractAction, context: ActionContext): Promise<Record<string, string | string[]> | Array<Record<string, string>>> {
// 根据数据源类型处理
if (action.source === 'variable') {
// 从变量中提取数据
const variableName = action.variable || '';
logger.info(TAG, `从变量提取数据: ${vari... | https://github.com/DaLongZhuaZi/manxia | 02a0bf03034688a876680b1d78a0f8cda46485cf | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/ResourceManager.ets | arkts | getStringById | 获取字符串资源的同步方法
使用前需要通过 preloadStringResources 预加载相关资源
@param id 字符串资源的 ID
@return 资源 ID 对应的当前语言下的字符串 | getStringById(id: number): string {
LogUtil.info(TAG, `getStringById ID==> ${id}`);
const stringKey = `${i18n.getSystemLocale()}_${id}`;
LogUtil.info(TAG, `stringKey==> ${stringKey}`);
return this.resourceCache.get(stringKey) as string;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStringById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST... | getStringById(id: number): string {
LogUtil.info(TAG, `getStringById ID==> ${id}`);
const stringKey = `${i18n.getSystemLocale()}_${id}`;
LogUtil.info(TAG, `stringKey==> ${stringKey}`);
return this.resourceCache.get(stringKey) as string;
} | https://gitee.com/openharmony-sig/applications_clock.git | 41486b6d5c02a3e786ecc6bb49ea3592127aee6c | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | addMedication | Action: 添加药物 | public addMedication(medication: Omit<Medication, 'id' | 'createdAt' | 'updatedAt'>): void {
const newMedication: Medication = {
name: medication.name,
dosage: medication.dosage,
times: medication.times,
status: medication.status,
id: 'med_' + Date.now(),
createdAt: Date.now(),... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addMedication AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left medication AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ... | public addMedication(medication: Omit<Medication, 'id' | 'createdAt' | 'updatedAt'>): void {
const newMedication: Medication = {
name: medication.name,
dosage: medication.dosage,
times: medication.times,
status: medication.status,
id: 'med_' + Date.now(),
createdAt: Date.now(),... | https://github.com/LJ666-ui/harmony-health-care | a3ef6f48054bb80a6964079d068878908cd65665 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | initializeUserThemeConfig | ==================== 用户主题配置管理 ====================
初始化用户主题配置管理器 | private async initializeUserThemeConfig(): Promise<void> {
try {
const userConfigManager = UserThemeConfigManager.getInstance();
await userConfigManager.initialize();
logger.info(TAG, '用户主题配置管理器初始化完成');
} catch (error) {
logger.error(TAG, '用户主题配置管理器初始化失败', error);
}
} | 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 initializeUserThemeConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi... | private async initializeUserThemeConfig(): Promise<void> {
try {
const userConfigManager = UserThemeConfigManager.getInstance();
await userConfigManager.initialize();
logger.info(TAG, '用户主题配置管理器初始化完成');
} catch (error) {
logger.error(TAG, '用户主题配置管理器初始化失败', error);
}
} | https://github.com/DaLongZhuaZi/manxia | 5082553f1c6115127b07a072546ec2671d09137b | github |
Vsolon0401/MallShopping | product/phone/src/main/ets/pages/MainPage.ets | arkts | queryOrderList | FIXME:先不管订单数统计 | queryOrderList() {
this.orderCount = {
payment: 0,
ship: 0,
receipt: 0,
evaluation: 0,
sale: 0
};
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryOrderList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | queryOrderList() {
this.orderCount = {
payment: 0,
ship: 0,
receipt: 0,
evaluation: 0,
sale: 0
};
} | https://github.com/Vsolon0401/MallShopping | ee75f770e8c55f39d785a7b253f55feff9c5c7b1 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | checkIn | ============ 考勤模块 API ============
打卡 | async checkIn(data: { type: string; latitude: number; longitude: number; location: string }): Promise<ApiResponse<any>> {
return this.post<any>('/api/attendance/checkin', data)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkIn AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async checkIn(data: { type: string; latitude: number; longitude: number; location: string }): Promise<ApiResponse<any>> {
return this.post<any>('/api/attendance/checkin', data)
} | https://github.com/David8Idira/AI-OA | 405270df59226c34119a736ad8b709a5e55b4a63 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | swapWidthHeight | Convert width and height.
@param rect | static swapWidthHeight(rect: RectF): void {
let centerX = rect.getCenterX();
let centerY = rect.getCenterY();
let halfWidth = rect.getWidth() / 2;
let halfHeight = rect.getHeight() / 2;
rect.left = centerX - halfHeight;
rect.right = centerX + halfHeight;
rect.top = centerY - halfWidth;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left swapWidthHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static swapWidthHeight(rect: RectF): void {
let centerX = rect.getCenterX();
let centerY = rect.getCenterY();
let halfWidth = rect.getWidth() / 2;
let halfHeight = rect.getHeight() / 2;
rect.left = centerX - halfHeight;
rect.right = centerX + halfHeight;
rect.top = centerY - halfWidth;
... | https://gitee.com/openharmony/codelabs.git | f22a69ee5f0e5418b73b283b75dabbc5123c7cea | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/DatabaseHelper.ets | arkts | getInstance | 获取 DatabaseHelper 单例实例 | static getInstance(): DatabaseHelper {
if (!DatabaseHelper.instance) {
DatabaseHelper.instance = new DatabaseHelper();
}
return DatabaseHelper.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 DatabaseHe... | static getInstance(): DatabaseHelper {
if (!DatabaseHelper.instance) {
DatabaseHelper.instance = new DatabaseHelper();
}
return DatabaseHelper.instance;
} | https://github.com/Kira-Yagami-Light/Kira-Projects | ccd99aae418ee45d7e08e52fe8fc5ee4cb9d2390 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates a copy of Int8Array.
@param other data initializer | public constructor(other: Int8Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | 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 other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Int... | public constructor(other: Int8Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c733455e062c6f1aa28dc98c20983c046a84db66 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/LayoutConfigManager.ets | arkts | buildDefaultPortraitLayout | ============================================================================
默认布局生成 (对齐 Android DefaultLayoutProvider)
============================================================================
生成默认竖屏布局
对齐 Android buildDefaultPortraitLayout:
- 双屏上下排列,宽度撑满
- L/R + 动作按钮行在两屏分界线 (y = screenH)
- DPad/ABXY 贴底部
- SELECT/STA... | buildDefaultPortraitLayout(width: number, height: number): PositionedLayoutComponent[] {
const large = 140;
const lr = 50;
const small = 40;
const sp = 4;
const gap = DEFAULT_SCREEN_GAP;
let screenW = width;
let screenH = Math.round(width / NDS_ASPECT);
let screenMargin = 0;
const... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildDefaultPortraitLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#id... | buildDefaultPortraitLayout(width: number, height: number): PositionedLayoutComponent[] {
const large = 140;
const lr = 50;
const small = 40;
const sp = 4;
const gap = DEFAULT_SCREEN_GAP;
let screenW = width;
let screenH = Math.round(width / NDS_ASPECT);
let screenMargin = 0;
const... | https://github.com/richshaw2015/nds | 3947608df08810ecd0ebdbf1cdf3d2483498b40b | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | formatDate | 格式化日期 | private formatDate(date: Date): string {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Da... | private formatDate(date: Date): string {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L357-L365 | 9d8db2726ef17a9dfb730cd7e81968f4691463fa | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | set | Sets the long value wrapped in this LongBox.
@param { long } value - The new long value to set
@returns { long } The newly set long value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(value: long): long {
return (this.value = value);
} | 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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden... | public set(value: long): long {
return (this.value = value);
} | https://gitcode.com/iop123123/arkts-static-skills | 958f8c60e15ed65273cdc551cc50d6b75f8bb821 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | tryCopyCrashToDownload | 尝试将崩溃日志复制到 Download 目录 | private tryCopyCrashToDownload(sourcePath: string, fileName: string): void {
try {
const downloadDirManager = DownloadDirManager.getInstance();
if (!downloadDirManager.isReady()) {
return;
}
const logsDir = downloadDirManager.ensureDirectory('logs');
const targetPath = `${log... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tryCopyCrashToDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri... | private tryCopyCrashToDownload(sourcePath: string, fileName: string): void {
try {
const downloadDirManager = DownloadDirManager.getInstance();
if (!downloadDirManager.isReady()) {
return;
}
const logsDir = downloadDirManager.ensureDirectory('logs');
const targetPath = `${log... | https://github.com/DaLongZhuaZi/manxia | 501d1d88eaecc92e6e84c9eefa507185f2aec442 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ChangelogManager.ets | arkts | resetShownStatus | 重置已显示状态(用于测试) | async resetShownStatus(): Promise<void> {
if (this.prefs) {
await this.prefs.delete(KEY_LAST_SHOWN_VERSION);
await this.prefs.delete(KEY_LAST_SHOWN_VERSION_CODE);
await this.prefs.flush();
this.lastShownVersion = '';
this.lastShownVersionCode = 0;
logger.info(TAG, '已重置更新日志显示状态'... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resetShownStatus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef... | async resetShownStatus(): Promise<void> {
if (this.prefs) {
await this.prefs.delete(KEY_LAST_SHOWN_VERSION);
await this.prefs.delete(KEY_LAST_SHOWN_VERSION_CODE);
await this.prefs.flush();
this.lastShownVersion = '';
this.lastShownVersionCode = 0;
logger.info(TAG, '已重置更新日志显示状态'... | https://github.com/DaLongZhuaZi/manxia | 3b6f8cdc66457015c053134204220f4e75a4770a | github |
LZZLHY/hlib | entry/src/main/ets/api/CookieJar.ets | arkts | forEach | 遍历所有 cookie(用于拼 Cookie 头)。 | forEach(cb: (value: string, key: string) => void): void {
this.store.forEach(cb);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left forEach AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left cb AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#... | forEach(cb: (value: string, key: string) => void): void {
this.store.forEach(cb);
} | https://github.com/LZZLHY/hlib | c070c41a347c2aa2faa5172807835ec174c2ad9b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets | arkts | cancelLoad | 取消加载 - IWebViewImageLoader接口实现 | cancelLoad(requestId: string): void {
logger.info(TAG, `取消图片加载: ${requestId}`);
// 设置取消标志
this.cancelTokens.set(requestId, true);
// 如果是章节加载,也取消章节加载
this.cancelLoading(requestId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelLoad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R... | cancelLoad(requestId: string): void {
logger.info(TAG, `取消图片加载: ${requestId}`);
// 设置取消标志
this.cancelTokens.set(requestId, true);
// 如果是章节加载,也取消章节加载
this.cancelLoading(requestId);
} | https://github.com/DaLongZhuaZi/manxia | 32faada9980408f9fc1564aabb3a862ab7c07547 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets | arkts | hexToBase32 | 十六进制字符串转 Base32
@param hexString 十六进制字符串
@returns Base32 编码的字符串 | private hexToBase32(hexString: string): string {
// 移除空格和连字符
const cleaned = hexString.replace(/[\s-]/g, '').toUpperCase();
// 十六进制转字节数组
const bytes = new Uint8Array(cleaned.length / 2);
for (let i = 0; i < cleaned.length; i += 2) {
bytes[i / 2] = parseInt(cleaned.substring(i, i + 2), 16);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hexToBase32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hexString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | private hexToBase32(hexString: string): string {
// 移除空格和连字符
const cleaned = hexString.replace(/[\s-]/g, '').toUpperCase();
// 十六进制转字节数组
const bytes = new Uint8Array(cleaned.length / 2);
for (let i = 0; i < cleaned.length; i += 2) {
bytes[i / 2] = parseInt(cleaned.substring(i, i + 2), 16);
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/parsers/KeePass2Parser.ets#L101-L113 | b6cdda66e23a80f6024df7400f4cf9df4992c23e | github |
openharmony-sig/arkcompiler_ets_frontend | arkoala/ets-plugin/test/ets/Rewrite.ets | arkts | looks | @Styles @Extend @AnimatableExtend | @Styles
function looks() {
.height(500)
.width(400)
.backgroundColor(Color.Gray)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Styles AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left looks AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST... | @Styles
function looks() {
.height(500)
.width(400)
.backgroundColor(Color.Gray)
} | https://gitee.com/openharmony-sig/arkcompiler_ets_frontend.git | 19a59d5d94dd27b66b55fc6696cf89e2990c021a | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/BillStatisticsUtil.ets | arkts | getCategoryStatistics | 获取指定分类的统计数据 | static getCategoryStatistics(bills: BillModel[], category: string): BillStatistics {
const categoryBills = bills.filter(bill => bill.category === category);
return BillStatisticsUtil.calculateStatistics(categoryBills);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCategoryStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | static getCategoryStatistics(bills: BillModel[], category: string): BillStatistics {
const categoryBills = bills.filter(bill => bill.category === category);
return BillStatisticsUtil.calculateStatistics(categoryBills);
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 6d9200f78717a449a1a8bdf3887cc177666fcbf6 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/UserProfile.ets | arkts | isLargeFamily | 判断是否为大家庭 | isLargeFamily(): boolean {
return this.familySize >= 3;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLargeFamily 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... | isLargeFamily(): boolean {
return this.familySize >= 3;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 3a31b9efcc7fccd5ee5161a5f4ca3152282f2bb8 | github |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/ShouYe/Chat.ets | arkts | addMessage | 添加消息到列表 | addMessage(msg: ChatMessage) {
this.messages = [...this.messages, msg];
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ChatMessage AST#identifier#Righ... | addMessage(msg: ChatMessage) {
this.messages = [...this.messages, msg];
} | https://github.com/luojiang001/Pulse | 51dd4460aae74d04c4961a0ca4340340d748cba0 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DefaultModelService.ets | arkts | initialize | 初始化加载配置(幂等) | async initialize(): Promise<void> {
await this.loadConfig()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize 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#generic_t... | async initialize(): Promise<void> {
await this.loadConfig()
} | https://github.com/LongLiveY96/chatcube | e960a7a1c44ffa47986339a09a39a01705d577ad | github |
HarmonyOS_Samples/BestPracticeSnippets | DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets | arkts | createPreviewOutputFn | Create the previewOutput output object | 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://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | b1a7b0799061c8e9f6553b1d299c5459cef48d79 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/index.ets | arkts | aboutToAppear | The function executes after a new instance of the custom component is created and before its build function
is executed.
Allows state variables to be changed in the aboutToAppear function, and these changes will take effect in
subsequent executions of the build function. | aboutToAppear() {
this.mIndexCtrl.onInit();
this.mConListCtrl.onInit();
this.smListener = mediaquery.matchMediaSync('(320vp<width<=520vp)');
this.smListener.on('change', this.isBreakpointSM);
this.mdListener = mediaquery.matchMediaSync('(520vp<width<=840vp)');
this.mdListener.on('change', this... | 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() {
this.mIndexCtrl.onInit();
this.mConListCtrl.onInit();
this.smListener = mediaquery.matchMediaSync('(320vp<width<=520vp)');
this.smListener.on('change', this.isBreakpointSM);
this.mdListener = mediaquery.matchMediaSync('(520vp<width<=840vp)');
this.mdListener.on('change', this... | https://gitee.com/openharmony/applications_mms.git | e08b8d3efd8aa7ebe5bac8907f9714a5466ae367 | gitee |
fbinba3955/Flymby | smartxplayer/src/main/ets/SXPlayer.ets | arkts | constructor | 构造SXPlayer
@param abilityContext 必须是AbilityContext
@param config 播放器配置 | constructor(abilityContext: Context, config: SXPlayerConfig) {
super()
this.config = config
this.avPlayer = new SXWorkerPlayer(config.enableLog)
this.avPlayer.on('eventChange', this.proxyEventChange)
this.avPlayer.on('stateChange', this.proxyStateChange)
this.avPlayer.on('positionUpdate', this... | 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 abilityContext AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Context AST#identifier#Right AST#ER... | constructor(abilityContext: Context, config: SXPlayerConfig) {
super()
this.config = config
this.avPlayer = new SXWorkerPlayer(config.enableLog)
this.avPlayer.on('eventChange', this.proxyEventChange)
this.avPlayer.on('stateChange', this.proxyStateChange)
this.avPlayer.on('positionUpdate', this... | https://github.com/fbinba3955/Flymby | d9fd43bc1b4751e9f662c13c71d99bb66e50f801 | github |
CLMC2025/Vignette | entry/src/main/ets/manager/SessionPlanner.ets | arkts | getTypeName | 获取任务类型的中文名称 | getTypeName(): string {
return '情境故事';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTypeName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_... | getTypeName(): string {
return '情境故事';
} | https://github.com/CLMC2025/Vignette | 6a647ba0328f2db4e94d6b7b4df48da9ee3d4337 | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets | arkts | concatDate | 年月日格式修饰
@param year
@param month
@param date | concatDate(year: number, month: number, date: number): string {
return `${year}${this.fill(month)}${this.fill(date)}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left concatDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#... | concatDate(year: number, month: number, date: number): string {
return `${year}${this.fill(month)}${this.fill(date)}`;
} | https://gitee.com/openharmony/multimedia_camera_framework.git | e9c393b0c837d1a206461aac23d86dfe5c139534 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | deleteDownloadTask | 删除下载任务 | public async deleteDownloadTask(taskId: string): Promise<void> {
try {
// 这里需要实现删除下载任务的逻辑
// 包括删除已下载的文件和数据库记录
logger.info(TAG, `删除下载任务: ${taskId}`);
} 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 deleteDownloadTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Lef... | public async deleteDownloadTask(taskId: string): Promise<void> {
try {
// 这里需要实现删除下载任务的逻辑
// 包括删除已下载的文件和数据库记录
logger.info(TAG, `删除下载任务: ${taskId}`);
} catch (error) {
logger.error(TAG, '删除下载任务失败' + String(error));
throw error as Error;
}
} | https://github.com/DaLongZhuaZi/manxia | 40dd444ffe3d64ccce7f4a8f7046ff82907c9e88 | github |
ibestservices/ibest-ui | library/src/main/ets/components/picker/index.ets | arkts | initWithSelectValue | 根据已选值 初始化索引位置 | initWithSelectValue(index: number, children: IBestPickerOption[]){
if(this.value[index] != undefined && children && children.length){
let i = children.findIndex(item => item.value == this.value[index])
i = i > -1 ? i : children.length - 1
this.columns.push(children)
this.indexArr[index] = i
this.initW... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initWithSelectValue 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#identifie... | initWithSelectValue(index: number, children: IBestPickerOption[]){
if(this.value[index] != undefined && children && children.length){
let i = children.findIndex(item => item.value == this.value[index])
i = i > -1 ? i : children.length - 1
this.columns.push(children)
this.indexArr[index] = i
this.initW... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L388-L396 | 8ce97e7f3fa1b06f8bcb7bdca1001495b386f28f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/SuwayomiTracker.ets | arkts | getWebUIUrl | 获取 WebUI URL | public getWebUIUrl(): string {
return this.getNormalizedServerUrl();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWebUIUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public getWebUIUrl(): string {
return this.getNormalizedServerUrl();
} | https://github.com/DaLongZhuaZi/manxia | ea4095fbe4704d6d926c63f821b0f9282d740e9a | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/data/SandboxManager.ets | arkts | initialize | 初始化沙盒管理器
@param filesDir 文件目录路径
@note API 23 适配:通过依赖注入传入路径,替代直接依赖 UIContextManager | initialize(filesDir: string | undefined): void {
this.filesDir = filesDir || '';
logger.info(TAG, '沙盒管理器初始化完成: filesDir=' + filesDir);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left filesDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#... | initialize(filesDir: string | undefined): void {
this.filesDir = filesDir || '';
logger.info(TAG, '沙盒管理器初始化完成: filesDir=' + filesDir);
} | https://github.com/DaLongZhuaZi/NGF | e7007feac004e95db65fd107c32e5c5514d3f9ee | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | toSorted | Creates a sorted copy
@returns { Int32Array } - a sorted copy
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toSorted(): Int32Array {
return new Int32Array(this).sort()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted 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 Int32Array AS... | public toSorted(): Int32Array {
return new Int32Array(this).sort()
} | https://gitcode.com/iop123123/arkts-static-skills | 29934646915d019c7acf2343be9e038eb1f7aedd | gitcode |
openharmony-tpc/openharmony_tpc_samples | GSYVideoPlayer-filters/library/src/main/ets/components/utils/OrientationUtil.ets | arkts | changeOrientation | 设置屏幕方向
@param orientation 屏幕方向,Window.Orientation.LANDSCAPE_INVERTED 为横屏 Window.Orientation.PORTRAIT 为竖屏 | static changeOrientation(context: Context, orientation: Window.Orientation) {
let windowClass: Window.Window | null = null;
let promise = Window.getLastWindow(context);
promise.then((data) => {
windowClass = data;
if (orientation == Window.Orientation.LANDSCAPE_INVERTED) {
windowClass.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left changeOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | static changeOrientation(context: Context, orientation: Window.Orientation) {
let windowClass: Window.Window | null = null;
let promise = Window.getLastWindow(context);
promise.then((data) => {
windowClass = data;
if (orientation == Window.Orientation.LANDSCAPE_INVERTED) {
windowClass.... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 7d6edfe88c3fd11ed9fbdb84e57883f7341e40d7 | gitee |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t20_edgeCases | T20: Edge cases — empty, URL prefix, duplicates, round-trip | t20_edgeCases(): void {
// Empty string → empty object
const e1: Record<string, Object> = parse('');
const p1: boolean = Object.keys(e1).length === 0;
// URL query prefix
const popts: ParseOptions = { ignoreQueryPrefix: true };
const e2: Record<string, Object> = parse('?a=1', popts);
cons... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t20_edgeCases 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_bloc... | t20_edgeCases(): void {
// Empty string → empty object
const e1: Record<string, Object> = parse('');
const p1: boolean = Object.keys(e1).length === 0;
// URL query prefix
const popts: ParseOptions = { ignoreQueryPrefix: true };
const e2: Record<string, Object> = parse('?a=1', popts);
cons... | https://github.com/wgli-collab/qs-arkts | c25e452aec4e6c2b46fabcd12fe24ece7e9ac07b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | getQueueItems | 获取队列中的所有项(用于显示) | getQueueItems(): PreloadItemInfo[] {
const items: PreloadItemInfo[] = [];
// 队列中的项
this.queue.forEach(item => {
items.push({
pageIndex: item.pageIndex,
pageId: item.pageId,
status: item.status,
url: item.url,
startTime: item.startTime,
endTime: item.e... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getQueueItems 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 PreloadItemInfo AST#identifier#Right AST#[#Left ... | getQueueItems(): PreloadItemInfo[] {
const items: PreloadItemInfo[] = [];
// 队列中的项
this.queue.forEach(item => {
items.push({
pageIndex: item.pageIndex,
pageId: item.pageId,
status: item.status,
url: item.url,
startTime: item.startTime,
endTime: item.e... | https://github.com/DaLongZhuaZi/manxia | 9462bb4658997b4d71fc2bbf55e12bbe80e2ac17 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getShelfFilteredPdfEBookList | 获取书架筛选后的PDF电子书列表(应用排序和标签/作者筛选) | private getShelfFilteredPdfEBookList(): Manga[] {
let baseList: Manga[] = this.pdfEbookList;
// 如果是自定义书架,pdfEbook也属于EBOOK类型
if (this.selectedShelf !== null) {
const itemIds = this.typeShelfManager.getShelfItemIdsByType(this.selectedShelf.id, ContentType.EBOOK);
baseList = this.pdfEbookLis... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getShelfFilteredPdfEBookList 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#... | private getShelfFilteredPdfEBookList(): Manga[] {
let baseList: Manga[] = this.pdfEbookList;
// 如果是自定义书架,pdfEbook也属于EBOOK类型
if (this.selectedShelf !== null) {
const itemIds = this.typeShelfManager.getShelfItemIdsByType(this.selectedShelf.id, ContentType.EBOOK);
baseList = this.pdfEbookLis... | https://github.com/DaLongZhuaZi/manxia | b619bd0327f15b73fc07ab358a2ba1253a9ad5e9 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/pages/Index.ets | arkts | editBookmark | Edit bookmark | editBookmark(bookmark: BookmarkBase): void {
router.pushUrl({
url: 'pages/BookmarkPage',
params: {
bookmark: bookmark.toJson(),
mode: 'edit'
}
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left editBookmark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookmark AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BookmarkBase AST#identifier#Right AST#)... | editBookmark(bookmark: BookmarkBase): void {
router.pushUrl({
url: 'pages/BookmarkPage',
params: {
bookmark: bookmark.toJson(),
mode: 'edit'
}
});
} | https://github.com/tangwengang-del/freerdp-harmonyos | fb9fad6a5ccbe16a9100f131085784131dae0199 | github |
ChangJing01/HarmonyOS-FinalProject | entry/src/main/ets/pages/ShoppingCartPage.ets | arkts | onCartChange | 使用 @StorageLink 确保当 PersonalPage 改变主题时,这里会自动刷新
监听到变化后的处理函数 | onCartChange() {
console.info('购物车数据发生变化,重新校验状态');
// 1. 自动同步全选状态
if (this.cartItems.length > 0) {
this.isAllSelected = this.cartItems.every(item => item.selected);
} else {
this.isAllSelected = false;
}
// 2. 自动重新计算总价
this.calculateTotalPrice();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCartChange 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 ... | onCartChange() {
console.info('购物车数据发生变化,重新校验状态');
// 1. 自动同步全选状态
if (this.cartItems.length > 0) {
this.isAllSelected = this.cartItems.every(item => item.selected);
} else {
this.isAllSelected = false;
}
// 2. 自动重新计算总价
this.calculateTotalPrice();
} | https://github.com/ChangJing01/HarmonyOS-FinalProject | 1289fe3e7757dad945ed18975ac4b0ba705c9768 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/GenresApi.ets | arkts | getGenre | Gets a genre, by name.
@summary Gets a genre, by name.
@param {GenresApiGetGenreRequest} requestParameters Request parameters.
@param {*} [options] Override http request option.
@throws {RequiredError}
@memberof GenresApi | public getGenre(requestParameters: GenresApiGetGenreRequest): Promise<BaseItemDto> {
return this.apiClient.get({path: `/Genres/${requestParameters.genreName}`, parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGenre AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public getGenre(requestParameters: GenresApiGetGenreRequest): Promise<BaseItemDto> {
return this.apiClient.get({path: `/Genres/${requestParameters.genreName}`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 8a9cb8d884494e6d71b635be3c3bcf0c6bbc7283 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | $_invoke | RegExp constructor call signature, used to create new RegExp instances.
@param { RegExp | String } pattern Regular expression pattern or another RegExp instance.
@param { String } [flags] Regular expression flags.
@returns { RegExp } Newly created RegExp instance.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStage... | public static $_invoke(pattern: RegExp | String, flags?: String) : RegExp {
return new RegExp(pattern, flags)
} | 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 $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pattern AST#identifier#Right AST#:#Left : AST#... | public static $_invoke(pattern: RegExp | String, flags?: String) : RegExp {
return new RegExp(pattern, flags)
} | https://gitcode.com/iop123123/arkts-static-skills | 3087d7913428cb8f95ebe3b55e3a5c05b7934e8b | gitcode |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets | arkts | runWithLoading | 执行带加载状态的任务
@param {() => Promise<void>} task - 待执行任务
@returns {Promise<void>} Promise<void> | private async runWithLoading(task: () => Promise<void>): Promise<void> {
if (this.loading) {
return;
}
this.loading = true;
try {
await task();
} finally {
this.loading = false;
}
} | 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 runWithLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left t... | private async runWithLoading(task: () => Promise<void>): Promise<void> {
if (this.loading) {
return;
}
this.loading = true;
try {
await task();
} finally {
this.loading = false;
}
} | https://github.com/Joker-x-dev/HarmonyKit | 93a8c2554cb0903abd3ecff362a5d9240ee57371 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getTracks | 查询曲目列表
@returns | public async getTracks(): Promise<Array<BaseItemDto>> {
return this.requireApi().getTracks(this.currentLibrary?.Id)
} | 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 getTracks 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 getTracks(): Promise<Array<BaseItemDto>> {
return this.requireApi().getTracks(this.currentLibrary?.Id)
} | https://github.com/OHPG/FinMusic | 4c91463b643f07d61c9984d307d5ec0955591384 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_ulong.ets | arkts | main | ---
desc: check postfix decrement for unsigned long integer operand
--- | function main(): void {
let value: ulong = {{v.value}}
let result: ulong = value--
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: ulong = {{v.value}}
let result: ulong = value--
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 768ab9a67acc18233a97a99927802b5f2224cb74 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | whereNotNull | 添加 IS NOT NULL 条件
@param column 列名或属性名
@returns 当前实例(支持链式调用) | whereNotNull(column: string): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.isNotNull(resolvedColumn)
condition.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereNotNull 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 ) ... | whereNotNull(column: string): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.isNotNull(resolvedColumn)
condition.... | https://github.com/offlinecat-dev/OCNetORM | 4faa73aebec30efa4ac35b4b6d7e32857fb3c731 | github |
PollenWang6/HiXD | entry/src/main/ets/services/SportService.ets | arkts | require | 发送 POST 请求 (form-urlencoded) | private async require(subWebsite: string, body: Record<string, string>): Promise<Record<string, Object>> {
const url: string = BASE_URL + subWebsite;
const headers: Record<string, string> = this.getHeaders(body);
const resp = await this.http.postForm(url, body, headers);
if (!resp.isOk) {
throw ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left require AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left subWebsite AST#identifier#Ri... | private async require(subWebsite: string, body: Record<string, string>): Promise<Record<string, Object>> {
const url: string = BASE_URL + subWebsite;
const headers: Record<string, string> = this.getHeaders(body);
const resp = await this.http.postForm(url, body, headers);
if (!resp.isOk) {
throw ... | https://github.com/PollenWang6/HiXD | db8dd8f342176f0f77f4c61aef942ea7419d351a | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyConfig.ets | arkts | enableUnknownConsentMode | Unknown consent mode: SDK collects everything into the request queue but
holds it locally, nothing reaches the wire until the integrator calls
`giveConsentAll()` (resumes the queue; buffered data ships and the
instance continues with full consent) or `removeConsentAll()` (clears
the buffered queue, ships a single revoc... | public enableUnknownConsentMode(): ConsentConfig {
this.unknownMode = true;
this.requires = true;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableUnknownConsentMode 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#Le... | public enableUnknownConsentMode(): ConsentConfig {
this.unknownMode = true;
this.requires = true;
return this;
} | https://github.com/Countly/countly-sdk-hos | df5f5aceb0664c2ed732e6770fa0b17963f540b2 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | find | Finds the first element in the Uint16Array that satisfies the condition
@param fn the condition to apply for each element
@returns the first element that satisfies fn
TODO: return number | undefined as in JS | public find(fn: (val: number, index: int, array: Uint16Array) => boolean): number {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return val
}
}
throw new Error("Uint16Array.find: not implemented if el... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public find(fn: (val: number, index: int, array: Uint16Array) => boolean): number {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return val
}
}
throw new Error("Uint16Array.find: not implemented if el... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 07148322b28fe01b7e134b2180bc9b569d395941 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | getModels | 获取模型列表 | async getModels(config: AIApiConfig): Promise<ModelsListResult> {
const compatibilityProfile = this.getCompatibilityProfile(config)
if (compatibilityProfile.modelDiscoveryStrategy === ModelDiscoveryStrategy.STATIC_CATALOG) {
return {
success: true,
models: compatibilityProfile.staticMode... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getModels AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async getModels(config: AIApiConfig): Promise<ModelsListResult> {
const compatibilityProfile = this.getCompatibilityProfile(config)
if (compatibilityProfile.modelDiscoveryStrategy === ModelDiscoveryStrategy.STATIC_CATALOG) {
return {
success: true,
models: compatibilityProfile.staticMode... | https://github.com/LongLiveY96/chatcube | e6f3fc43f63d7abbe2d7a86dfdc9fa0fbe42362b | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | getBodyParameter | Get body parameter index | static getBodyParameter(target: Object, propertyKey?: string | symbol): number {
return this.getMetadata('retrofit:bodyParam', target, propertyKey) || -1;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBodyParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static getBodyParameter(target: Object, propertyKey?: string | symbol): number {
return this.getMetadata('retrofit:bodyParam', target, propertyKey) || -1;
} | https://github.com/killetom/ktretrofit | 8d01f1333b7a911fb4ae0fb65a562c689fae01ff | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/view/TrainsComponent.ets | arkts | isOperating | Determine whether the small train is in operation.
@param line route.
@returns boolean | isOperating(line: number): boolean {
let ret: boolean;
switch (line) {
case TrainsLine.LINE_ONE:
ret = this.checkTime(Const.LINE_ONE_START_TIME, Const.LINE_ONE_END_TIME);
break;
case TrainsLine.LINE_TWO:
ret = this.checkTime(Const.LINE_TWO_START_TIME, Const.LINE_TWO_END_TIM... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isOperating AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST... | isOperating(line: number): boolean {
let ret: boolean;
switch (line) {
case TrainsLine.LINE_ONE:
ret = this.checkTime(Const.LINE_ONE_START_TIME, Const.LINE_ONE_END_TIME);
break;
case TrainsLine.LINE_TWO:
ret = this.checkTime(Const.LINE_TWO_START_TIME, Const.LINE_TWO_END_TIM... | https://gitee.com/harmonyos/codelabs.git | 7ab1e86be79f4e66d6ab57fa0bd8426025476d8d | gitee |
richshaw2015/nds | ohos/entry/src/test/InputValidation.test.ets | arkts | validateNickname | ============================================================================
输入验证辅助函数
============================================================================
验证昵称长度
昵称最大长度为10个字符
@param nickname 昵称字符串
@returns 验证结果对象 | function validateNickname(nickname: string): ValidationResult {
const MAX_NICKNAME_LENGTH = 10;
if (nickname.length === 0) {
return { valid: false, error: '昵称不能为空' };
}
if (nickname.length > MAX_NICKNAME_LENGTH) {
return { valid: false, error: `昵称长度不能超过${MAX_NICKNAME_LENGTH}个字符` };
}
return { val... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left validateNickname AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nickname AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function validateNickname(nickname: string): ValidationResult {
const MAX_NICKNAME_LENGTH = 10;
if (nickname.length === 0) {
return { valid: false, error: '昵称不能为空' };
}
if (nickname.length > MAX_NICKNAME_LENGTH) {
return { valid: false, error: `昵称长度不能超过${MAX_NICKNAME_LENGTH}个字符` };
}
return { val... | https://github.com/richshaw2015/nds | 13c143f9ded0f48ab90ee5c6bfa78c3d732795cb | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | host | Sets the host portion of the URL.
@param { string } host - The host portion of the URL. | set host(host: string) {
this.urlInner.setHost(host);
this.cHost = this.urlInner.getHost();
this.cHostname = this.urlInner.getHostName();
this.cPort = this.urlInner.getPort();
this.setHref();
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left host AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left host AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifie... | set host(host: string) {
this.urlInner.setHost(host);
this.cHost = this.urlInner.getHost();
this.cHostname = this.urlInner.getHostName();
this.cPort = this.urlInner.getPort();
this.setHref();
} | https://gitcode.com/iop123123/arkts-static-skills | 8c27683828e6e0f6bba8dd91d66467060ca7ec41 | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets | arkts | searchEvents | 搜索日程(按标题或描述) | async searchEvents(keyword: string): Promise<CalendarEvent[]> {
// 这里需要扩展EventDao来实现搜索功能
// 暂时返回所有日程进行前端过滤
try {
const allEvents = await this.eventDao.getAllEvents();
const lowerKeyword = keyword.toLowerCase();
return allEvents.filter(event =>
event.title.toLowerCase().includes(lo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async searchEvents(keyword: string): Promise<CalendarEvent[]> {
// 这里需要扩展EventDao来实现搜索功能
// 暂时返回所有日程进行前端过滤
try {
const allEvents = await this.eventDao.getAllEvents();
const lowerKeyword = keyword.toLowerCase();
return allEvents.filter(event =>
event.title.toLowerCase().includes(lo... | https://gitcode.com/openharmony/codelabs | 87da13aff43ccf5b01249ff275b4de83e1b3cac8 | gitcode |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | setOnCreated | 设置 AudioRenderer 创建回调
@param callback - 创建回调函数 | public setOnCreated(callback: ((renderer: audio.AudioRenderer) => void) | null): void {
this.onCreatedCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnCreated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#(#Le... | public setOnCreated(callback: ((renderer: audio.AudioRenderer) => void) | null): void {
this.onCreatedCallback = callback;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L80-L82 | 0e4c5fcf29f089080c34c82183e3d1633c4bc1df | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | cleanupLowAccuracyRules | 清理低准确率规则 | static async cleanupLowAccuracyRules(
userId: number,
accuracyThreshold: number = 0.3,
minMatchCount: number = 10
): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
UPDATE ${SmartCategoryRule.tableName}
SET is_deleted = 1, updated_at = ?... | 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 cleanupLowAccuracyRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#... | static async cleanupLowAccuracyRules(
userId: number,
accuracyThreshold: number = 0.3,
minMatchCount: number = 10
): Promise<number> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
UPDATE ${SmartCategoryRule.tableName}
SET is_deleted = 1, updated_at = ?... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 03dfcaab1bc166e7ee2c8f4f1eccce609b7c8ce6 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/xiaoyi/XiaoyiSkillManager.ets | arkts | registerDefaultSkills | 注册默认的8个医疗Skill | private registerDefaultSkills(): void {
const defaultSkills: XiaoyiSkillDefinition[] = [
new HealthQuerySkill().getDefinition(),
new RiskAssessSkill().getDefinition(),
new MedicationReminderSkill().getDefinition(),
new NavigationSkill().getDefinition(),
new AIConsultationSkill().getD... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerDefaultSkills 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 A... | private registerDefaultSkills(): void {
const defaultSkills: XiaoyiSkillDefinition[] = [
new HealthQuerySkill().getDefinition(),
new RiskAssessSkill().getDefinition(),
new MedicationReminderSkill().getDefinition(),
new NavigationSkill().getDefinition(),
new AIConsultationSkill().getD... | https://github.com/LJ666-ui/harmony-health-care | c84100f7ef8b2e474a3026b3d9af6a939f806fda | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | addEmptyElement | Adds an empty XML element with the specified name to the output buffer.
@param {string} name - The name of the empty XML element to be added.
@throws {BusinessError} Throws an error if the `name` parameter is an empty string. | public addEmptyElement(name: string): void {
let stringBuilder = this.prepareBufferForNewItem(name);
stringBuilder.append(`<${name}/>`);
this.type = XmlDynamicType.OTHERS;
this.writeToBuffer(stringBuilder);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addEmptyElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public addEmptyElement(name: string): void {
let stringBuilder = this.prepareBufferForNewItem(name);
stringBuilder.append(`<${name}/>`);
this.type = XmlDynamicType.OTHERS;
this.writeToBuffer(stringBuilder);
} | https://gitcode.com/iop123123/arkts-static-skills | 148ef64c9a6078e15993a0f2fdae471e4c89560a | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheConstants.ets | arkts | getCacheFilePath | 根据原始文件路径生成缓存文件路径
@param originalPath 原始文件路径
@returns 缓存文件路径 | static getCacheFilePath(originalPath: string): string {
const fileName: string = CacheConstants.getCacheFileName(originalPath);
return CacheConstants.getCacheDir() + '/' + fileName;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCacheFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | static getCacheFilePath(originalPath: string): string {
const fileName: string = CacheConstants.getCacheFileName(originalPath);
return CacheConstants.getCacheDir() + '/' + fileName;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L45-L48 | d10b1ceb920bbb42f883d037d4ee0e85629e3a8c | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.Dialog.ets | arkts | lazyInit | lazy init
@param initializer lazy initializer
@returns lazy init result | function lazyInit<T>(initializer: () => T): () => T {
let value: T | null = null;
return () => {
if (value === null) {
value = initializer();
}
return value as T;
};
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lazyInit AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Right ... | function lazyInit<T>(initializer: () => T): () => T {
let value: T | null = null;
return () => {
if (value === null) {
value = initializer();
}
return value as T;
};
} | https://gitcode.com/openharmony/arkui_ace_engine | cc5b6e8b0c94a549dbb8392a890458b0c5a5f5aa | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | initAudioPlayer | Creates AVPlayer, registers callbacks, creates AVSession, and drains pending load. | private initAudioPlayer(): void {
media.createAVPlayer().then(async avPlayer => {
if (avPlayer !== null) {
this.avPlayer = avPlayer;
this.setAVPlayerCallback();
this.createSession();
this.applyPendingLoadRequest();
}
}) .catch((error: BusinessError) => {
Logge... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initAudioPlayer 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#exp... | private initAudioPlayer(): void {
media.createAVPlayer().then(async avPlayer => {
if (avPlayer !== null) {
this.avPlayer = avPlayer;
this.setAVPlayerCallback();
this.createSession();
this.applyPendingLoadRequest();
}
}) .catch((error: BusinessError) => {
Logge... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0b97dd6d9570abcf5fc7da97b45cc7a6143da686 | gitcode |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/pages/Index.ets | arkts | handleRefresh | --- 手动下拉刷新逻辑 --- | handleRefresh() {
if (this.isSwitchingCity) {
return;
}
this.isRefreshing = true;
this.showUpdateTips = true;
this.isUpdateComplete = false;
this.updateTips = "正在更新...";
this.getUIContext().animateTo({ duration: 300 }, () => {
this.updateTipsHeight = 30;
this.updateTipsOp... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleRefresh 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... | handleRefresh() {
if (this.isSwitchingCity) {
return;
}
this.isRefreshing = true;
this.showUpdateTips = true;
this.isUpdateComplete = false;
this.updateTips = "正在更新...";
this.getUIContext().animateTo({ duration: 300 }, () => {
this.updateTipsHeight = 30;
this.updateTipsOp... | https://github.com/OnceWeWere/Weather_HarmonyOS | d63aa299db7a34c904291618f0d4c933c3d2b7f5 | github |
harmonyos/codelabs | HarmonyOS_NEXT/NewsDataArkTS/entry/src/main/ets/viewmodel/NewsViewModel.ets | arkts | getNewsList | Get news type list from server.
@return NewsData[] newsDataList | getNewsList(currentPage: number, pageSize: number, path: string): Promise<NewsData[]> {
return new Promise(async (resolve: Function, reject: Function) => {
let url = `${Const.SERVER}/${path}`;
url += '?currentPage=' + currentPage + '&pageSize=' + pageSize;
httpRequestGet(url).then((data: Respons... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getNewsList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A... | getNewsList(currentPage: number, pageSize: number, path: string): Promise<NewsData[]> {
return new Promise(async (resolve: Function, reject: Function) => {
let url = `${Const.SERVER}/${path}`;
url += '?currentPage=' + currentPage + '&pageSize=' + pageSize;
httpRequestGet(url).then((data: Respons... | https://gitee.com/harmonyos/codelabs.git | 2eb933bfa86513ff3f5d858a82619d2e35e8c599 | gitee |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets | arkts | onWindowSizeChange | 便捷订阅:传入回调函数
返回的函数可用于取消订阅 | onWindowSizeChange(callback: (state: AdaptiveState) => void): () => void {
const observer: AdaptiveObserver = new SimpleAdaptiveObserver(callback)
this.observers.add(observer)
// 立即通知当前状态
callback(this.getCurrentState())
// 返回取消订阅函数
return () => {
this.observers.delete(observer)
}
... | AST#program#Left AST#ERROR#Left AST#identifier#Left onWindowSizeChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie... | onWindowSizeChange(callback: (state: AdaptiveState) => void): () => void {
const observer: AdaptiveObserver = new SimpleAdaptiveObserver(callback)
this.observers.add(observer)
// 立即通知当前状态
callback(this.getCurrentState())
// 返回取消订阅函数
return () => {
this.observers.delete(observer)
}
... | https://github.com/Xiwei753/xiezuoruanjian | 40f97c07a13875afc13d60a933666a1fce19e495 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | get | GET请求(支持重定向拦截) | async get(url: string, headers?: Record<string, string>): Promise<JsResponse> {
return this.connect(url, headers);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | async get(url: string, headers?: Record<string, string>): Promise<JsResponse> {
return this.connect(url, headers);
} | https://github.com/DaLongZhuaZi/manxia | d02951300d6cc7f00b396f3bf3ec7605a38512a3 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets | arkts | aboutToAppear | 页面出现时加载数据
@returns {void} 无返回值 | aboutToAppear(): void {
this.loadSearchHistory();
super.aboutToAppear();
} | AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.loadSearchHistory();
super.aboutToAppear();
} | https://github.com/Joker-x-dev/CoolMallArkTS | a88673e6000be646444864e08ecf5548fd555366 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartCategoryService.ets | arkts | createOrUpdateKeywordRule | 创建或更新关键词规则 | private static async createOrUpdateKeywordRule(
userId: number,
categoryId: number,
categoryName: string,
keywords: string[],
amount: number
): Promise<void> {
try {
// 查找该分类的现有关键词规则
const existingRules = await SmartCategoryRuleDAO.getByCategoryId(userId, categoryId);
const... | 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 createOrUpdateKeywordRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ident... | private static async createOrUpdateKeywordRule(
userId: number,
categoryId: number,
categoryName: string,
keywords: string[],
amount: number
): Promise<void> {
try {
// 查找该分类的现有关键词规则
const existingRules = await SmartCategoryRuleDAO.getByCategoryId(userId, categoryId);
const... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 1906caee027c8eb86f3192122a001c0fa09e128e | github |
dingzhilin1990/zhilinclaw | src/security/OAuthGateway.ets | arkts | refreshToken | 刷新令牌
@param providerId 提供商 ID | public async refreshToken(providerId: string): Promise<boolean> {
const session = this.sessions.get(providerId);
if (!session) {
return false;
}
if (!session.token.refreshToken) {
console.log('[OAuthGateway] 没有刷新令牌');
return false;
}
const provider = this.providers.get(prov... | 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 refreshToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public async refreshToken(providerId: string): Promise<boolean> {
const session = this.sessions.get(providerId);
if (!session) {
return false;
}
if (!session.token.refreshToken) {
console.log('[OAuthGateway] 没有刷新令牌');
return false;
}
const provider = this.providers.get(prov... | https://github.com/dingzhilin1990/zhilinclaw | d83487971412142c50480c65b99774816c944cb2 | github |
openharmony/applications_mms | entry/src/main/ets/pages/settings/advancedSettings/advancedSettings.ets | arkts | onPageShow | Triggers once when this page is displayed. In scenarios such as routing and application access to the foreground
and background, only customized components modified by @Entry take effect. | onPageShow() {
this.mAdvancedSettingsCtrl.onShow();
WantUtil.getWant();
} | AST#program#Left AST#expression_statement#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#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
this.mAdvancedSettingsCtrl.onShow();
WantUtil.getWant();
} | https://gitee.com/openharmony/applications_mms.git | e3206823d7c6d260b936925ef0bc0a99a99d357b | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | getScienceLists | get science button list
@return Array<Array<SimplePhysicsButtonInfo>> science button list | public getScienceLists(): Array<Array<SimplePhysicsButtonInfo>> {
return this.digitPanelModel.getScienceLists();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getScienceLists 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 getScienceLists(): Array<Array<SimplePhysicsButtonInfo>> {
return this.digitPanelModel.getScienceLists();
} | https://gitee.com/openharmony-sig/applications_calculator.git | 5fe4eff0543d05543925c25b846a9872fce326ad | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.