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 |
|---|---|---|---|---|---|---|---|---|---|---|
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/repository/UserAccountRepository.ets | arkts | getUserAccount | Obtain the logged-in user account from Preference to avoid login
@returns UserData | getUserAccount(): Promise<UserAccount | null> {
return this.userStore.getUserAccount();
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUserAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Le... | getUserAccount(): Promise<UserAccount | null> {
return this.userStore.getUserAccount();
} | https://github.com/who7708/harmonyos-codelabs | dd5743fe10a4651352ae8696f61bff5a3866e105 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DownloadSyncManager.ets | arkts | createNoMediaFile | 创建.nomedia文件
防止系统媒体扫描器将目录识别为媒体文件夹
使用fileUri.FileUri将URI转换为实际路径后再操作(与.manxia_init创建方式一致)
@param folderPath 文件夹本地路径(例如 /storage/…/Download/manxia/manga)
@returns 是否成功创建或已存在 | private createNoMediaFile(folderPath: string): boolean {
// 先尝试通过URI转换创建(使用fileUri.FileUri将URI转为路径)
try {
const baseUri = AppStorage.get<string>('downloadSyncDirUri');
if (baseUri && baseUri.length > 0) {
const folderName = folderPath.substring(folderPath.replace(/\/+$/, '').lastIndexOf('/... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createNoMediaFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | private createNoMediaFile(folderPath: string): boolean {
// 先尝试通过URI转换创建(使用fileUri.FileUri将URI转为路径)
try {
const baseUri = AppStorage.get<string>('downloadSyncDirUri');
if (baseUri && baseUri.length > 0) {
const folderName = folderPath.substring(folderPath.replace(/\/+$/, '').lastIndexOf('/... | https://github.com/DaLongZhuaZi/manxia | e3e9134b5061af6464507bce8fde11cb735a0bfb | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnProgressViewModel.ets | arkts | decreaseDynamicCircle | 减少动态圆形进度值
@param step 步进值 | decreaseDynamicCircle(step: number): void {
this.dynamicCirclePercent = Math.max(0, this.dynamicCirclePercent - step);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decreaseDynamicCircle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#... | decreaseDynamicCircle(step: number): void {
this.dynamicCirclePercent = Math.max(0, this.dynamicCirclePercent - step);
} | https://github.com/codelably/tuniao-ui | 41338b7afb14d6b985371b0382fa37f81789e63f | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginationParams.ets | arkts | getLimit | 获取 limit 值(即每页数量)
@returns limit 值 | getLimit(): number {
return this.pageSize
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLimit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_blo... | getLimit(): number {
return this.pageSize
} | https://github.com/offlinecat-dev/OCNetORM | a1ea7765ac707d5de01d663b8a743a6fe292f39e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/DualSenseController.ets | arkts | canClaimDevice | 检查是否可以驱动该设备 | static canClaimDevice(device: usbManager.USBDevice): boolean {
if (device.vendorId !== DualSense.VID) {
return false;
}
if (!DualSense.PIDS.includes(device.productId)) {
return false;
}
if (!device.configs || device.configs.length === 0) {
return false;
}
c... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left canClaimDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressi... | static canClaimDevice(device: usbManager.USBDevice): boolean {
if (device.vendorId !== DualSense.VID) {
return false;
}
if (!DualSense.PIDS.includes(device.productId)) {
return false;
}
if (!device.configs || device.configs.length === 0) {
return false;
}
c... | https://github.com/AlkaidLab/moonlight-harmony | 8caf512a42cef759a735a822b5ed52c80d0731f7 | github |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | pxToVp | 像素转 vp,失败时回退为原值
@param {number} valuePx - 像素值
@param {number} displayId - Display ID
@returns {number} vp 值 | private pxToVp(valuePx: number, displayId: number): number {
try {
const density = display.getDisplayByIdSync(displayId).densityPixels;
return valuePx / density;
} catch (err) {
console.error(`getDisplayByIdSync failed: ${JSON.stringify(err)}`);
return valuePx;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left pxToVp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left valuePx AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | private pxToVp(valuePx: number, displayId: number): number {
try {
const density = display.getDisplayByIdSync(displayId).densityPixels;
return valuePx / density;
} catch (err) {
console.error(`getDisplayByIdSync failed: ${JSON.stringify(err)}`);
return valuePx;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 17612d5a06fdc711bf174c6c549e427dcce4bd58 | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | setItemCount | 强制设置物品数量(供清空数据等操作使用) | setItemCount(count: number): void {
console.info(`ItemStore: 强制设置物品数量 ${this.itemCount} -> ${count}`);
this.itemCount = count;
this.notifyListeners();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setItemCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A... | setItemCount(count: number): void {
console.info(`ItemStore: 强制设置物品数量 ${this.itemCount} -> ${count}`);
this.itemCount = count;
this.notifyListeners();
} | https://gitcode.com/openharmony/codelabs | cb295fbe6c13b63a4670eff3ad4e3295e7736500 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Transformer.ets | arkts | generateTransformedValuesBubble | Transforms an List of Entry into a float array containing the x and
y values transformed with all matrices for the BUBBLECHART.
@param data
@return | public generateTransformedValuesBubble(data: IBubbleDataSet, phaseY: number, from: number, to: number): number[] {
const count = (to - from + 1) * 2; // (int) Math.ceil((to - from) * phaseX) * 2;
if (this.valuePointsForGenerateTransformedValuesBubble.length != count) {
this.valuePointsForGenerateTrans... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateTransformedValuesBubble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | public generateTransformedValuesBubble(data: IBubbleDataSet, phaseY: number, from: number, to: number): number[] {
const count = (to - from + 1) * 2; // (int) Math.ceil((to - from) * phaseX) * 2;
if (this.valuePointsForGenerateTransformedValuesBubble.length != count) {
this.valuePointsForGenerateTrans... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c588e622a682428591dbd61b2c99fdce8ff8722c | gitee |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/HttpUtil.ets | arkts | handleUnauthorized | 处理未授权错误 | private static handleUnauthorized(): void {
HttpUtil.clearToken();
// TODO: 跳转到登录页面或显示登录提示
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left handleUnauthorized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private static handleUnauthorized(): void {
HttpUtil.clearToken();
// TODO: 跳转到登录页面或显示登录提示
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 01ef3bcf9056711050aa2e553f31459c691ad501 | github |
Eklps/harmony-mall-perf | entry/src/main/ets/viewmodel/ListDataSource.ets | arkts | reloadData | 通知ui更新 | public reloadData(newData: GoodsListItemType[]): void {
this.listData = newData;
this.notifyDataReload();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reloadData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressi... | public reloadData(newData: GoodsListItemType[]): void {
this.listData = newData;
this.notifyDataReload();
} | https://github.com/Eklps/harmony-mall-perf | 4fc0f807315e06271b0ff27176e3832e98d6cbaa | github |
ycj3/streaming-markdown | packages/streaming-markdown/src/main/ets/ui/BlockView.ets | arkts | parseSegments | Helper to parse segments from the paragraph text | parseSegments(text: string): TextSegment[] {
// Cache invalidation rule:
// - `block.id` changes for different blocks
// - `text` changes whenever block content changes
// So a changed render input naturally misses cache and reparses.
const cacheKey = buildInlineSegmentCacheKey(this.block, text)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left parseSegments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | parseSegments(text: string): TextSegment[] {
// Cache invalidation rule:
// - `block.id` changes for different blocks
// - `text` changes whenever block content changes
// So a changed render input naturally misses cache and reparses.
const cacheKey = buildInlineSegmentCacheKey(this.block, text)
... | https://github.com/ycj3/streaming-markdown | 10c373b56cf1942a3bca26c82962398a0a409757 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/TrackingManager.ets | arkts | markAsSynced | 标记记录为已同步 | public async markAsSynced(contentId: string, trackerId: TrackerId): Promise<boolean> {
return this.updateTrackRecord(contentId, trackerId, {
syncStatus: SyncStatus.SYNCED
});
} | 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 markAsSynced AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public async markAsSynced(contentId: string, trackerId: TrackerId): Promise<boolean> {
return this.updateTrackRecord(contentId, trackerId, {
syncStatus: SyncStatus.SYNCED
});
} | https://github.com/DaLongZhuaZi/manxia | 8066a99e03c3fefc330d675712d9de8208b53512 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/common/utils/Logger.ets | arkts | debug | Debug 日志 | static debug(tag: string, message: string): void {
if (Logger.currentLevel <= LogLevel.DEBUG) {
hilog.debug(DOMAIN, `${TAG}:${tag}`, message)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | static debug(tag: string, message: string): void {
if (Logger.currentLevel <= LogLevel.DEBUG) {
hilog.debug(DOMAIN, `${TAG}:${tag}`, message)
}
} | https://gitcode.com/openharmony/codelabs | fca768c7e8caca0eec5be0640377476eb01c15d0 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | at | Returns the byte at the specified index
@param {int} index - Index of the byte to return
@returns {long} The byte at the specified position | public at(index: int): long {
return this.buffer.at(index + this.byteOffset);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left at 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#ident... | public at(index: int): long {
return this.buffer.at(index + this.byteOffset);
} | https://gitcode.com/iop123123/arkts-static-skills | f0d3b4eee388250176c96739682e5c67c0be8242 | gitcode |
hhtczengjing/ohos_quickjs | quickjs/src/main/ets/JSValue.ets | arkts | isUndefined | ==================== Type Checks ==================== | get isUndefined(): boolean {
return qjs.isUndefined(this.handle);
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isUndefined 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#Ri... | get isUndefined(): boolean {
return qjs.isUndefined(this.handle);
} | https://github.com/hhtczengjing/ohos_quickjs | 8100062281bd51a1fb464e6630ea665b986065c9 | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootRepoInjection | 测试通道:want.parameters.bootRepo=owner/name,
HomePage 启动后会读取该值并 push 到 RepositoryDetailPage,方便对详情页做真机回归。
用完即清,避免下次冷启动残留。 | private handleBootRepoInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_REPO];
if (typeof raw !== 'string') {
return;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootRepoInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private handleBootRepoInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_REPO];
if (typeof raw !== 'string') {
return;
}
... | https://github.com/CarGuo/GSYGithubAppOH | 740387e221d056ddaeb6ed36490b6eeed169f272 | github |
honjow/Next2V | shared/src/main/ets/settings/ImageUploadSettings.ets | arkts | isConfigured | Whether the snapshot's ACTIVE provider has its credential set (gates the editor's upload action). | static isConfigured(snapshot: ImageUploadSettingsSnapshot): boolean {
const normalized = ImageUploadSettings.normalize(snapshot)
return ImageUploadSettings.credentialFor(normalized, normalized.provider).length > 0
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isConfigured AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left snapshot AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static isConfigured(snapshot: ImageUploadSettingsSnapshot): boolean {
const normalized = ImageUploadSettings.normalize(snapshot)
return ImageUploadSettings.credentialFor(normalized, normalized.provider).length > 0
} | https://github.com/honjow/Next2V | 4d56a4a5ca4877f6eae3815d7332114984c87e6b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | valueOf | valueOf(char) creates a Char object from a primitive char.
This method is preferred over {@link <constructor(char)>} since this method can use a cached Char object,
i.e. this method might be more efficient.
@param value a primitive char to create Char from.
@returns an instance of Char created from the primitive char. | public static valueOf(value: char): Char {
// TODO(ivan-tyulyandin): caching is possible
return new Char(value);
} | 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 valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public static valueOf(value: char): Char {
// TODO(ivan-tyulyandin): caching is possible
return new Char(value);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3734cdf4cccc45c73506068b40bca978921bac1f | gitee |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | appendNameProperties | For safety, we'll emit just one value around StructuredName, as external importers
may get confused with multiple "N", "FN", etc. properties, though it is valid in
vCard spec. | public appendNameProperties(iContact: contact.Contact): VCardBuilder {
let nameContact = iContact.name
if (VCardConfig.isVersion40(this.mVCardType)) {
return this.appendNamePropertiesV40(nameContact);
}
if (nameContact == null) {
if (VCardConfig.isVersion30(t... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left appendNameProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iContact AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_... | public appendNameProperties(iContact: contact.Contact): VCardBuilder {
let nameContact = iContact.name
if (VCardConfig.isVersion40(this.mVCardType)) {
return this.appendNamePropertiesV40(nameContact);
}
if (nameContact == null) {
if (VCardConfig.isVersion30(t... | https://gitee.com/openharmony-tpc/VCard.git | 63f0019e33d548e8fce47a61c143846d73946d03 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/MultiVideoApplication/features/home/src/main/ets/view/VideoDialog.ets | arkts | setAVPlayerCallback | Registering the avplayer callback function. | setAVPlayerCallback(): void {
if (this.avPlayer === undefined) {
Logger.error(`AvPlayer is undefined`);
return;
}
this.avPlayer.on('error', this.onError);
// Callback function for state machine changes.
this.avPlayer.on('stateChange', this.onStateChange);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAVPlayerCallback 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#statemen... | setAVPlayerCallback(): void {
if (this.avPlayer === undefined) {
Logger.error(`AvPlayer is undefined`);
return;
}
this.avPlayer.on('error', this.onError);
// Callback function for state machine changes.
this.avPlayer.on('stateChange', this.onStateChange);
} | https://gitee.com/harmonyos/codelabs.git | 0ccc6bb47a236fcb0f8cb9d21872fd07f54f4398 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/model/ExpressionsModel.ets | arkts | isEmpty | 历史记录是否为空
@param callback 返回查询结果 | isEmpty(callback: Function): void {
LogUtil.info(TAG, 'isEmpty start');
this.rdbHelper.isEmpty(callback);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#)#Left ) A... | isEmpty(callback: Function): void {
LogUtil.info(TAG, 'isEmpty start');
this.rdbHelper.isEmpty(callback);
} | https://gitee.com/openharmony-sig/applications_calculator.git | 90bedf9a0349e800307efcd69acb05db32a57463 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/smartward/core/controllers/PatientMonitorController.ets | arkts | generateVitalSigns | 生成模拟的生命体征数据
数据在合理范围内随机变化 | private generateVitalSigns(): MonitorData {
// 心率:60-100 bpm,随机波动±5
const heartRate = Math.floor(70 + Math.random() * 30);
// 血氧饱和度:95-100%
const oxygenSaturation = Math.floor(95 + Math.random() * 5);
// 血压:收缩压 90-140,舒张压 60-90
const systolicBP = Math.floor(110 + Math.random() * 30);
con... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateVitalSigns 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 generateVitalSigns(): MonitorData {
// 心率:60-100 bpm,随机波动±5
const heartRate = Math.floor(70 + Math.random() * 30);
// 血氧饱和度:95-100%
const oxygenSaturation = Math.floor(95 + Math.random() * 5);
// 血压:收缩压 90-140,舒张压 60-90
const systolicBP = Math.floor(110 + Math.random() * 30);
con... | https://github.com/LJ666-ui/harmony-health-care | 001f366365627d27844651218b002d5b7d5704ac | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | splitReplaceRule | ==================== 工具方法 ==================== | private splitReplaceRule(ruleText: string): RuleReplaceParts {
const result: RuleReplaceParts = {
rule: ruleText,
replaceFirst: false
};
const firstSep = ruleText.indexOf('##');
if (firstSep < 0) {
return result;
}
result.rule = ruleText.substring(0, firstSep).trim();
co... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitReplaceRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private splitReplaceRule(ruleText: string): RuleReplaceParts {
const result: RuleReplaceParts = {
rule: ruleText,
replaceFirst: false
};
const firstSep = ruleText.indexOf('##');
if (firstSep < 0) {
return result;
}
result.rule = ruleText.substring(0, firstSep).trim();
co... | https://github.com/DaLongZhuaZi/manxia | c731564caa2bc170554c82c87cdf053358106351 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toLocaleString | Converts this object to a locale-specific string representation
@param { Intl.LocalesArgument } [ locales ] A string with a BCP 47 language tag, or an
array of such strings
@param { Intl.NumberFormatOptions } [ options ] An object with some or all of the properties of the
Intl.NumberFormat options
@returns { String } r... | public toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): String {
const formatter = new Intl.NumberFormat(Intl.intlLocalesToLanguageTags(locales), options)
return formatter.format(this.value)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#L... | public toLocaleString(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions): String {
const formatter = new Intl.NumberFormat(Intl.intlLocalesToLanguageTags(locales), options)
return formatter.format(this.value)
} | https://gitcode.com/iop123123/arkts-static-skills | d2b6f94ca179685c7d778aae566271541c0ac4ac | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets | arkts | cancelAll | 取消所有待处理请求 | public cancelAll(): void {
const count = this.requestQueue.length;
this.requestQueue.forEach(req => {
req.reject(new Error('Request cancelled'));
});
this.requestQueue = [];
logger.info(TAG, `已取消 ${count} 个待处理请求`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cancelAll 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#Righ... | public cancelAll(): void {
const count = this.requestQueue.length;
this.requestQueue.forEach(req => {
req.reject(new Error('Request cancelled'));
});
this.requestQueue = [];
logger.info(TAG, `已取消 ${count} 个待处理请求`);
} | https://github.com/DaLongZhuaZi/manxia | 13a3087f6ca9e2fe544303f1168ca549ee5693d3 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineRadarDataSet.ets | arkts | setFillAlpha | sets the alpha value (transparency) that is used for filling the line
surface (0-255), default: 85
@param alpha | public setFillAlpha(alpha: number): void {
this.mFillAlpha = alpha;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFillAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alpha AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public setFillAlpha(alpha: number): void {
this.mFillAlpha = alpha;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 5d5b322733c77cbd2b91c1e0fe859ecfee421750 | gitee |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/utils/fileUtils.ets | arkts | clearUserData | 清空用户数据(如退出登录时调用) | static async clearUserData(): Promise<boolean> {
try {
const preferences = await PreferencesUtil.getPreferencesInstance();
await preferences.delete('user_data');
await preferences.flush();
return true;
} catch (error) {
console.error('清空用户数据失败:', error);
return false;
}... | 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 clearUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | static async clearUserData(): Promise<boolean> {
try {
const preferences = await PreferencesUtil.getPreferencesInstance();
await preferences.delete('user_data');
await preferences.flush();
return true;
} catch (error) {
console.error('清空用户数据失败:', error);
return false;
}... | https://github.com/luojiang001/Pulse | 877e93e3bd38934d2b8fae63769d2ba9a9d08b92 | github |
openharmony-sig/amountinputtext | libamountinput/src/main/ets/widget/AmountInputKeyboardTitleView.ets | arkts | build | 标题行高 46或26 | build() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
//"切换"键预留,暂空
Text('')
.fontSize(16)
.padding({ left: 12 })
.fontColor($r('app.color.color_font_green'))
Text($r('app.string.title'))
.fontSize... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
//"切换"键预留,暂空
Text('')
.fontSize(16)
.padding({ left: 12 })
.fontColor($r('app.color.color_font_green'))
Text($r('app.string.title'))
.fontSize... | https://gitee.com/openharmony-sig/amountinputtext.git | fed884899c68a069acd81df7240f98a3f65bd939 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | mul | Return a new Decimal whose value is this Decimal times `n`, rounded to `precision` significant
digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type | public mul(n: Value): Decimal {
let xd = this.digits;
let y = new Decimal(n);
let yd = y.d;
y.sign *= this.sign;
if (!xd || !(xd!.at(0)) || !yd || !(yd!.at(0))) {
return new Decimal((!y.s || xd && !(xd!.at(0)) && !yd || yd && !(yd!.at(0)) && !xd)
?... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | public mul(n: Value): Decimal {
let xd = this.digits;
let y = new Decimal(n);
let yd = y.d;
y.sign *= this.sign;
if (!xd || !(xd!.at(0)) || !yd || !(yd!.at(0))) {
return new Decimal((!y.s || xd && !(xd!.at(0)) && !yd || yd && !(yd!.at(0)) && !xd)
?... | https://gitcode.com/iop123123/arkts-static-skills | 55694f8ca271077a446e4784c5d1069ec775213f | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WidgetDataSync.ets | arkts | updateGoals | 更新阅读目标数据 | public async updateGoals(goals: ReadingGoalData): Promise<void> {
if (!this.context) return;
try {
const pref = await preferences.getPreferences(this.context, WIDGET_DATA_STORE);
const existingStr = (await pref.get('widgetData', '')) as string;
let data: WidgetData = {
goals:... | 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 updateGoals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goals AST#identifier#Right AST#:#Left : AST#... | public async updateGoals(goals: ReadingGoalData): Promise<void> {
if (!this.context) return;
try {
const pref = await preferences.getPreferences(this.context, WIDGET_DATA_STORE);
const existingStr = (await pref.get('widgetData', '')) as string;
let data: WidgetData = {
goals:... | https://github.com/DaLongZhuaZi/manxia | ca841b072a6958debdb2ea84d8698cb14e28d3fd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DuplicateDetection/DuplicateDetectionService.ets | arkts | checkDuplicates | 主入口:检测是否有重复内容 | public async checkDuplicates(input: DuplicateCheckInput): Promise<DuplicateCheckResult> {
const config = await this.loadConfig();
logger.info(TAG, `checkDuplicates: enabled=${config.enabled}, threshold=${config.threshold}, scope=${config.checkScope}, titleWeight=${config.titleWeight}`);
if (!config.enab... | 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 checkDuplicates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : ... | public async checkDuplicates(input: DuplicateCheckInput): Promise<DuplicateCheckResult> {
const config = await this.loadConfig();
logger.info(TAG, `checkDuplicates: enabled=${config.enabled}, threshold=${config.threshold}, scope=${config.checkScope}, titleWeight=${config.titleWeight}`);
if (!config.enab... | https://github.com/DaLongZhuaZi/manxia | 8cd8c6def41354d12a0d0af0c6b74258443e5990 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets | arkts | printAllSteps | 打印所有引导步骤 | public static printAllSteps(): void {
const steps = [
GuideStep.WELCOME,
GuideStep.THEME_SELECTION,
GuideStep.DATA_IMPORT,
GuideStep.IMAGE_SOURCE_GUIDE,
GuideStep.BOOK_SOURCE_GUIDE,
GuideStep.REMOTE_LIBRARY_GUIDE,
GuideStep.CUSTOM_EXPERIENCE,
GuideStep.ANALYTICS_PER... | 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 printAllSteps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public static printAllSteps(): void {
const steps = [
GuideStep.WELCOME,
GuideStep.THEME_SELECTION,
GuideStep.DATA_IMPORT,
GuideStep.IMAGE_SOURCE_GUIDE,
GuideStep.BOOK_SOURCE_GUIDE,
GuideStep.REMOTE_LIBRARY_GUIDE,
GuideStep.CUSTOM_EXPERIENCE,
GuideStep.ANALYTICS_PER... | https://github.com/DaLongZhuaZi/manxia | 1f82d127fa8dd8903f4be6a6c431d04c2f041acd | github |
openharmony/codelabs | Media/SimpleVideo/entry/src/main/ets/view/VideoPlaySlider.ets | arkts | iconOnclick | icon onclick callback | iconOnclick() {
if (this.isPlay === true) {
this.controller.pause()
this.isPlay = false;
this.isOpacity = false;
return;
}
if (this.flag === true) {
this.controller.start();
this.isPlay = true;
this.isOpacity = true;
} else {
this.isLoading = true;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left iconOnclick 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 A... | iconOnclick() {
if (this.isPlay === true) {
this.controller.pause()
this.isPlay = false;
this.isOpacity = false;
return;
}
if (this.flag === true) {
this.controller.start();
this.isPlay = true;
this.isOpacity = true;
} else {
this.isLoading = true;
... | https://gitee.com/openharmony/codelabs.git | 6807e2475c521e158499f2726ef147cc93940690 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | flat | Creates a new Array with all sub-array elements concatenated into it recursively up to the specified depth.
@param { int } depth The depth level specifying how deep a nested array structure should be flattened.
@returns { Array<U> } A new array with the sub-array elements concatenated into it.
@syscap SystemCapability.... | public flat<U = T>(depth: int): Array<U> {
let ret = new Array<U>()
this.flatImpl<U>(depth, ret)
return ret
} | AST#program#Left AST#ERROR#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left flat AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST#identifier#Left T AST#identifier#Right AST#>#Left > AST#>#Right AS... | public flat<U = T>(depth: int): Array<U> {
let ret = new Array<U>()
this.flatImpl<U>(depth, ret)
return ret
} | https://gitcode.com/iop123123/arkts-static-skills | 6720de43e966a19a6350b52d7483468b0ef651e9 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setViewPortOffsets | Sets custom offsets for the current ViewPort (the offsets on the sides of
the actual chart window). Setting this will prevent the chart from
automatically calculating it's offsets. Use resetViewPortOffsets() to
undo this. ONLY USE THIS WHEN YOU KNOW WHAT YOU ARE DOING, else use
setExtraOffsets(...).
@param left
@param ... | public setViewPortOffsets(left: number, top: number, right: number, bottom: number): void {
this.mCustomViewPortEnabled = true;
// let view=this;
// this.post(new Runnable('setViewPortOffsets',()=>{
this.mViewPortHandler.restrainViewPort(left, top, right, bottom);
this.prepareOffsetMatrix();
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setViewPortOffsets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left left AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setViewPortOffsets(left: number, top: number, right: number, bottom: number): void {
this.mCustomViewPortEnabled = true;
// let view=this;
// this.post(new Runnable('setViewPortOffsets',()=>{
this.mViewPortHandler.restrainViewPort(left, top, right, bottom);
this.prepareOffsetMatrix();
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f35d10b334edce52a1641de1bfe04ac0f2dcb501 | gitee |
openharmony/applications_dlp_manager | entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets | arkts | getNeedStartAbility | 判断是否需要拉起沙箱,这次不需要就等timeout的回调 | public getNeedStartAbility(requestId: string): boolean {
this.printAllDecryptingMap();
HiLog.info(TAG, `OpeningDialogManager getNeedStartAbility requestId ${requestId}`);
const decryptingState: DecryptingState | undefined = this._decryptingMap.get(requestId);
if (!decryptingState) {
HiLog.error(... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNeedStartAbility 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#... | public getNeedStartAbility(requestId: string): boolean {
this.printAllDecryptingMap();
HiLog.info(TAG, `OpeningDialogManager getNeedStartAbility requestId ${requestId}`);
const decryptingState: DecryptingState | undefined = this._decryptingMap.get(requestId);
if (!decryptingState) {
HiLog.error(... | https://gitee.com/openharmony/applications_dlp_manager.git | fdf9246bd435b230bb935d8e11a8ac0609893415 | gitee |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets | arkts | initialize | 在 EntryAbility.onWindowStageCreate 中调用,
获取主窗口并注册尺寸变化监听。 | async initialize(windowStage: window.WindowStage): Promise<void> {
try {
this.mainWindow = await windowStage.getMainWindow()
hilog.info(DOMAIN, TAG, 'Got main window')
// 读取初始安全区域 / 键盘 / 折叠状态
this.readSafeAreas()
this.readKeyboardVisible()
this.readFoldPosture()
// 读取初始... | 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#required_parameter#Left AST#identifier#Left windowStage AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async initialize(windowStage: window.WindowStage): Promise<void> {
try {
this.mainWindow = await windowStage.getMainWindow()
hilog.info(DOMAIN, TAG, 'Got main window')
// 读取初始安全区域 / 键盘 / 折叠状态
this.readSafeAreas()
this.readKeyboardVisible()
this.readFoldPosture()
// 读取初始... | https://github.com/Xiwei753/xiezuoruanjian | b84730ac21de0dd007a1add3d2f14719437c265e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_complement/bitwise_complement_char.ets | arkts | main | ---
desc: check bitwise complement of char
--- | function main(): void {
const v: char = {{v.value}}
assert ~(v) == {{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 {
const v: char = {{v.value}}
assert ~(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cdf8b9ae8c75ad522bb7f71d96af7298d3e2e89c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SignatureHandler.ets | arkts | replaceVariables | 替换模板中的变量 | private replaceVariables(template: string, variables: Record<string, string>): string {
let result: string = template;
// 替换 {{variable}} 格式的变量
const keys: string[] = Object.keys(variables);
for (let i: number = 0; i < keys.length; i++) {
const key: string = keys[i];
const value: string =... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left replaceVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private replaceVariables(template: string, variables: Record<string, string>): string {
let result: string = template;
// 替换 {{variable}} 格式的变量
const keys: string[] = Object.keys(variables);
for (let i: number = 0; i < keys.length; i++) {
const key: string = keys[i];
const value: string =... | https://github.com/DaLongZhuaZi/manxia | 89e2185d7992247a1e5f0bf1a84aa08eb9a7521f | github |
arkui-x/samples | CodeLab/Cases/feature/dynamicattributes/src/main/ets/common/LazyForEach.ets | arkts | addData | 改变单个数据。
@param {number} index - 索引值。
@param {string} data - 修改后的值。 | public addData(index: number, data: string): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData 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 ... | public addData(index: number, data: string): void {
this.dataArray.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://gitcode.com/arkui-x/samples | e605bc03fe336e95dffd9adfcafcf33e42b900f0 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | createEventFromBudget | 从Budget对象创建事件
@param budget 预算对象
@param eventType 事件类型
@param version 版本号 | static createEventFromBudget(
budget: Budget,
eventType: string,
version: number = 1
): DomainEvent {
const budgetJson = JSON.stringify(budget.toJSON());
const event = new DomainEvent(
'',
eventType,
AGGREGATE_TYPE_BUDGET,
budget.budgetId,
budget.userId,
versi... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEventFromBudget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left budget AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static createEventFromBudget(
budget: Budget,
eventType: string,
version: number = 1
): DomainEvent {
const budgetJson = JSON.stringify(budget.toJSON());
const event = new DomainEvent(
'',
eventType,
AGGREGATE_TYPE_BUDGET,
budget.budgetId,
budget.userId,
versi... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e8799607a228147e943f4a9351366c1c93740cca | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | padEnd | The padEnd() method pads the current string with a given string (repeated, if needed)
so that the resulting string reaches a given length.
The padding is applied from the end of the current string. | public padEnd(end: int, ch: char): String {
if (this.length() >= end) {
return this;
}
let arr = new char[end]
for (let i: int = 0; i < this.length(); i++) {
arr[i] = this.charAt(i)
}
for(let i = this.length(); i < end; i++){
arr[i]... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#id... | public padEnd(end: int, ch: char): String {
if (this.length() >= end) {
return this;
}
let arr = new char[end]
for (let i: int = 0; i < this.length(); i++) {
arr[i] = this.charAt(i)
}
for(let i = this.length(); i < end; i++){
arr[i]... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fcb1285d0389717e783960f8292222517e736cb2 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | isDownloadDirReady | 检查Download目录是否已初始化 | public isDownloadDirReady(): boolean {
return this.downloadDirManager.isReady();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDownloadDirReady 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 boolea... | public isDownloadDirReady(): boolean {
return this.downloadDirManager.isReady();
} | https://github.com/DaLongZhuaZi/manxia | 168ff89ea0a4982a8ab05cd389e9a0f5670d67f6 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/05.array_literal/array_literal.ets | arkts | main | ---
desc: The number of initializer expressions enclosed in braces of the array initializer
determines the length of the array to be constructed.
--- | function main() {
let x: {{item.type}}[] = {{item.array}} | 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#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Le... | function main() {
let x: {{item.type}}[] = {{item.array}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bcac2b8275d35b37b84e425b04ca009b0abff374 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RAManager.ets | arkts | startHeartbeat | 启动心跳定时器 (每 2 分钟)
对齐 Android: session heartbeat | private startHeartbeat(): void {
this.stopHeartbeat();
this.heartbeatTimer = setInterval(async () => {
if (!this.currentSession) return;
let richPresence: string | undefined;
// 对齐 Android: 检查 ra_rich_presence 设置,硬核模式下强制启用
const rpEnabled = await this.settingsManager.get<boolean>('ra_r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startHeartbeat 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#expr... | private startHeartbeat(): void {
this.stopHeartbeat();
this.heartbeatTimer = setInterval(async () => {
if (!this.currentSession) return;
let richPresence: string | undefined;
// 对齐 Android: 检查 ra_rich_presence 设置,硬核模式下强制启用
const rpEnabled = await this.settingsManager.get<boolean>('ra_r... | https://github.com/richshaw2015/nds | ff3a1f99b64915ec950525200c2918d394f34919 | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | getPendingReviews | Get pending reviews | async getPendingReviews(limit: number, excludeWord: string): Promise<WordItem[]> {
this.ensureInitialized();
const now = Date.now();
// 5 minutes cooldown to prevent same word appearing immediately if skipped
const cooldownMs = 5 * 60 * 1000;
const cutoffUpdatedAt = now - cooldownMs;
const p... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPendingReviews AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ... | async getPendingReviews(limit: number, excludeWord: string): Promise<WordItem[]> {
this.ensureInitialized();
const now = Date.now();
// 5 minutes cooldown to prevent same word appearing immediately if skipped
const cooldownMs = 5 * 60 * 1000;
const cutoffUpdatedAt = now - cooldownMs;
const p... | https://github.com/CLMC2025/Vignette | 4e9da8e808d9034089975ae7e159c856d2be3d4d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/not_equal/not_equal_short.ets | arkts | main | ---
desc: check not equal operation for two short integer operands
--- | function main(): void {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a != b) == {{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 {
const a: short = {{v.left}}
const b: short = {{v.right}}
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | bf30c0c1b4f901f79a43c0b0c0823dd4a409d900 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | executeInWebView | 在WebView中执行JavaScript(带超时保护) | private async executeInWebView(code: string, context: JsContext): Promise<JsExecuteResult> {
if (!this.webviewController) {
return { success: false, result: '', error: 'WebView未初始化' };
}
try {
// 注意:不再预获取所有URL,因为:
// 1. 从代码中提取的URL可能包含jsLib中的无关URL
// 2. 实际需要请求的URL可能是动态生成的
// ... | 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 executeInWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left... | private async executeInWebView(code: string, context: JsContext): Promise<JsExecuteResult> {
if (!this.webviewController) {
return { success: false, result: '', error: 'WebView未初始化' };
}
try {
// 注意:不再预获取所有URL,因为:
// 1. 从代码中提取的URL可能包含jsLib中的无关URL
// 2. 实际需要请求的URL可能是动态生成的
// ... | https://github.com/DaLongZhuaZi/manxia | 491417e4bbc4b07c5fe47b05f194b6be79d551de | github |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets | arkts | onCancel | Callback for closing a pop-up window. | onCancel(): void {
remoteDeviceModel.stopDeviceDiscovery();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | onCancel(): void {
remoteDeviceModel.stopDeviceDiscovery();
} | https://gitee.com/openharmony/codelabs.git | 2b007fd0a1a0d11d75a31963464102d633485d33 | gitee |
ZHCOOL520/HarmonyOS-AUTOcall | entry/src/main/ets/utils/AutoCallUtils.ets | arkts | extractPhoneNumbers | 从文本中提取电话号码 | static extractPhoneNumbers(text: string): string[] {
const phoneRegex = /1[3-9]\d{9}/g;
const matches = text.match(phoneRegex);
return matches ? Array.from(new Set(matches)) : [];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractPhoneNumbers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static extractPhoneNumbers(text: string): string[] {
const phoneRegex = /1[3-9]\d{9}/g;
const matches = text.match(phoneRegex);
return matches ? Array.from(new Set(matches)) : [];
} | https://github.com/ZHCOOL520/HarmonyOS-AUTOcall | 705a5b258501565b602d1a29c27aae08b3981f4f | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | getApprovalTypes | 获取审批类型列表 | async getApprovalTypes(): Promise<ApiResponse<any>> {
return this.get<any>('/api/approval/types')
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getApprovalTypes 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#gen... | async getApprovalTypes(): Promise<ApiResponse<any>> {
return this.get<any>('/api/approval/types')
} | https://github.com/David8Idira/AI-OA | 0518ad8e296865b8f16f602f40e7c73826374b67 | github |
Eklps/harmony-mall-perf | entry/src/main/ets/viewmodel/ListDataSource.ets | arkts | getData | LazyForEach按需调用这个方法获取单个商品 | public getData(index: number): GoodsListItemType {
if (index < 0 || index >= this.listData.length) {
return this.listData[0]; // 防御性返回
}
return this.listData[index];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData 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 ... | public getData(index: number): GoodsListItemType {
if (index < 0 || index >= this.listData.length) {
return this.listData[0]; // 防御性返回
}
return this.listData[index];
} | https://github.com/Eklps/harmony-mall-perf | 33de2be4b825727ea4d24ca5b9ae85b7b6433dfa | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SyncPrimitives.ets | arkts | notifyOne | precondition: mutex is locked
Unblocks ONE suspended coroutine associated with this CondVar, if it exists.
This method is thread-safe in relation to other methods of the CondVar | public notifyOne(mutex: Mutex) {
CondVar.notifyOne(this, mutex);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyOne AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mutex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Mutex... | public notifyOne(mutex: Mutex) {
CondVar.notifyOne(this, mutex);
} | https://gitcode.com/iop123123/arkts-static-skills | e5a73a9e58d5c3810453f2e94cf177f5601a6676 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/CompressionUtils.ets | arkts | findComicInfoFileRecursive | 递归查找ComicInfo.xml文件
@param directory 当前目录路径
@param currentDepth 当前递归深度
@param maxDepth 最大递归深度
@returns ComicInfo.xml文件路径,如果未找到则返回null | private async findComicInfoFileRecursive(
directory: string,
currentDepth: number,
maxDepth: number
): Promise<string | null> {
try {
if (currentDepth > maxDepth) {
logger.warn(TAG, `达到最大递归深度 ${maxDepth},停止搜索`);
return null;
}
const files = await this.sandboxMana... | 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 findComicInfoFileRecursive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left directory AST#identifier#Right AST#ERROR#... | private async findComicInfoFileRecursive(
directory: string,
currentDepth: number,
maxDepth: number
): Promise<string | null> {
try {
if (currentDepth > maxDepth) {
logger.warn(TAG, `达到最大递归深度 ${maxDepth},停止搜索`);
return null;
}
const files = await this.sandboxMana... | https://github.com/DaLongZhuaZi/manxia | 0ebaeaa3e72f799273c422793a99213a827f7cbc | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/PanZoomHandler.ets | arkts | reset | 重置为原始大小 | reset(): void {
this.scaleFactor = 1.0;
this.translateX = 0;
this.translateY = 0;
this.pointers.clear();
this.initialPinchDistance = 0;
this.notifyStateChanged();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | reset(): void {
this.scaleFactor = 1.0;
this.translateX = 0;
this.translateY = 0;
this.pointers.clear();
this.initialPinchDistance = 0;
this.notifyStateChanged();
} | https://github.com/AlkaidLab/moonlight-harmony | 538659ba639deeb39e84a18014cec60537f3c147 | github |
openharmony/vendor_unionman | unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | constructor | 构造函数,执行getRS | constructor(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback)
} | 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#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier... | constructor(callback: Function = () => {
}) {
this.accountTable.getRdbStore(callback)
} | https://gitee.com/openharmony/vendor_unionman.git | 76dd19c0782865285bd741f95b080d9a2cdc9a2b | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | subarray | Creates a BigUint64Array with the same ArrayBuffer
@returns new BigUint64Array with the same ArrayBuffer | public subarray(): BigUint64Array {
return this.subarray(0, this.length)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray 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 BigUint64Arra... | public subarray(): BigUint64Array {
return this.subarray(0, this.length)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 278ff089ed5813e3ab2a4c01eebb045c24db5027 | gitee |
honjow/Next2V | shared/src/main/ets/network/HttpClient.ets | arkts | requestText | Plain text request, returns raw string (no JSON.parse) | async requestText(
endpoint: string,
method?: http.RequestMethod,
retryCount: number = MAX_RETRIES,
headers?: Record<string, string>,
usingCache?: boolean
): Promise<string> {
const url = `${this.baseUrl}${endpoint}`
const reqMethod = method || http.RequestMethod.GET
let requestHeade... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestText AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left endpoint AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async requestText(
endpoint: string,
method?: http.RequestMethod,
retryCount: number = MAX_RETRIES,
headers?: Record<string, string>,
usingCache?: boolean
): Promise<string> {
const url = `${this.baseUrl}${endpoint}`
const reqMethod = method || http.RequestMethod.GET
let requestHeade... | https://github.com/honjow/Next2V | 8850102bc322e26c6cac208b7b28d93b579b78fc | github |
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/BillManager.ets | arkts | getBillsByMonth | 查询指定月份的账单,可按账单类型进一步过滤。 | static async getBillsByMonth(monthTimestamp: number, type: string = ''): Promise<BillGroup[]> {
const currentMonthDate: Date = new Date(monthTimestamp);
const startDate: Date = new Date(currentMonthDate.getFullYear(), currentMonthDate.getMonth(), 1);
const endDate: Date = new Date(currentMonthDate.getFull... | 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 getBillsByMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left monthTimestamp AST#identifier#Right AST#ERROR#Left AST#... | static async getBillsByMonth(monthTimestamp: number, type: string = ''): Promise<BillGroup[]> {
const currentMonthDate: Date = new Date(monthTimestamp);
const startDate: Date = new Date(currentMonthDate.getFullYear(), currentMonthDate.getMonth(), 1);
const endDate: Date = new Date(currentMonthDate.getFull... | https://github.com/ZestBox-18/kitebook-frontend | d2c28ddf8d8fc6fcc6b84c4c46ba1a063228f3ae | github |
openharmony-sig/fluttertpc_video_compress | ohos/src/main/ets/dev/fluttercommunity/video_compress/VideoCompress.ets | arkts | toPixelMap | arraybuffer 转PixelMap | toPixelMap(buf: ArrayBuffer) {
let source = image.createImageSource(buf)
return source.createPixelMap()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArrayBuffer AST#identifier#Righ... | toPixelMap(buf: ArrayBuffer) {
let source = image.createImageSource(buf)
return source.createPixelMap()
} | https://gitee.com/openharmony-sig/fluttertpc_video_compress.git | 4e1563a983f4e9fbffa9f926a132b2569e7ce98f | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/services/TypeDefined.ets | arkts | getByType | 根据类型获取认证方式信息
@param type 认证方式类型
@returns 认证方式信息,如果未找到则返回 PASSWORD | public static getByType(type: string): AuthTypeInfo {
return AuthType.getAllTypes().find(item => item.type === type) || AuthType.PASSWORD;
} | 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 getByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#... | public static getByType(type: string): AuthTypeInfo {
return AuthType.getAllTypes().find(item => item.type === type) || AuthType.PASSWORD;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TypeDefined.ets#L271-L273 | 0ef8cf925630c009a6e1f29a3bdfbacc78d43d51 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractDualSenseController.ets | arkts | isConnected | 检查控制器是否已连接 | isConnected(): boolean {
return !this.stopped && (this.pipe !== null || this.useDdkPolling);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isConnected 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#stateme... | isConnected(): boolean {
return !this.stopped && (this.pipe !== null || this.useDdkPolling);
} | https://github.com/AlkaidLab/moonlight-harmony | 2b698df1cb05e474d1c87be75c93cc1007df2453 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/components/ItemDetailView.ets | arkts | hasValue | ---------- helpers ---------- | function hasValue(s: string | undefined): boolean {
return s !== undefined && s.length > 0;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hasValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function hasValue(s: string | undefined): boolean {
return s !== undefined && s.length > 0;
} | https://github.com/Vincent-Leon/zotero-harmony | 8e55790d0625fc86350b50d7853456aabd5959af | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets | arkts | setConfig | 设置预加载配置 | public setConfig(config: PreloadConfig): void {
if (config.maxConcurrentTasks !== undefined) {
this.config.maxConcurrentTasks = config.maxConcurrentTasks;
}
if (config.preloadPageCount !== undefined) {
this.config.preloadPageCount = config.preloadPageCount;
}
if (config.enabled !== und... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Prel... | public setConfig(config: PreloadConfig): void {
if (config.maxConcurrentTasks !== undefined) {
this.config.maxConcurrentTasks = config.maxConcurrentTasks;
}
if (config.preloadPageCount !== undefined) {
this.config.preloadPageCount = config.preloadPageCount;
}
if (config.enabled !== und... | https://github.com/DaLongZhuaZi/manxia | 32306da048d4493d2fa9a5c6ed1692fc937eb065 | github |
honjow/Next2V | shared/src/main/ets/network/HttpClient.ets | arkts | getText | GET request for plain text (for HTML scraping) | async getText(endpoint: string): Promise<string> {
return this.requestText(endpoint, http.RequestMethod.GET)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getText AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left endpoint AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async getText(endpoint: string): Promise<string> {
return this.requestText(endpoint, http.RequestMethod.GET)
} | https://github.com/honjow/Next2V | 8eb53ed5933b7269710e15c1a627dbc164e493eb | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/VoiceGuide.ets | arkts | getQueueLength | 获取播报队列长度 | public getQueueLength(): number {
return this.announcementQueue.length;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getQueueLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getQueueLength(): number {
return this.announcementQueue.length;
} | https://github.com/LJ666-ui/harmony-health-care | 8bb99bcfd2e390ae671f22e9bdb47bbedd2e391d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EnumConstant.ets | arkts | hasStringValue | hasStringValue
@returns { boolean } get current object's hasStringValue
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public hasStringValue(): boolean {
// TODO(shumilov-petr): not implemented
return false
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasStringValue 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 AS... | public hasStringValue(): boolean {
// TODO(shumilov-petr): not implemented
return false
} | https://gitcode.com/iop123123/arkts-static-skills | 85b5d67c2af8630e2ac484474a753a4cb9d976d7 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets | arkts | setKey | 设置缓存文件key值
@param key 键值 | setKey(key: string) {
this.key = key;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#L... | setKey(key: string) {
this.key = key;
} | https://gitcode.com/arkui-x/samples | da1b2eb81ba3470ce7c88eeb8bdfa3aa1b342e00 | gitcode |
fbinba3955/Flymby | common/src/main/ets/video/AvManager.ets | arkts | createAvSession | 创建播控中心会话 | createAvSession(
context: Context,
tag: string,
type: avSession.AVSessionType = "video",
metadata: avSession.AVMetadata, callback: AvSessionCallback) {
// 如果session已经存在
if (this.mCurrentAVSession && this.mSessionId) {
this.mCurrentAVSession.setAVMetadata(metadata).then(() => {
Lo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createAvSession 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#Left Context AST#identifier... | createAvSession(
context: Context,
tag: string,
type: avSession.AVSessionType = "video",
metadata: avSession.AVMetadata, callback: AvSessionCallback) {
// 如果session已经存在
if (this.mCurrentAVSession && this.mSessionId) {
this.mCurrentAVSession.setAVMetadata(metadata).then(() => {
Lo... | https://github.com/fbinba3955/Flymby | 72052d71a368d30b8845c4a559797c113bd2ead5 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/PermissionManager.ets | arkts | clearCurrentUser | 清空当前用户 | public clearCurrentUser(): void {
this.currentUser = null;
console.log('PermissionManager: Current user cleared');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearCurrentUser 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#expre... | public clearCurrentUser(): void {
this.currentUser = null;
console.log('PermissionManager: Current user cleared');
} | https://github.com/LJ666-ui/harmony-health-care | d50fc242830e8c7b835e0109bfd6592351ef9bac | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/RustDeskLanDiscoveryService.ets | arkts | parseDiscoveryResponse | 解析发现响应
RustDesk LAN 发现响应格式 (可变长度):
[0-3] magic "RDCM"
[4] version
[5] message type (0x02 = discovery response)
[6-7] peer ID length (uint16 LE, 可选)
[8..] peer ID UTF-8
后面跟 device name (null-terminated) 和 version string
如果无法解析则返回 null (不是 RustDesk 设备或格式不匹配) | private parseDiscoveryResponse(data: ArrayBuffer, remoteAddr: string): DiscoveredRustDeskPeer | null {
const bytes: Uint8Array = new Uint8Array(data);
if (bytes.length < 8) {
return null;
}
// 检查 magic
const decoder: util.TextDecoder = new util.TextDecoder();
const magic: string = decod... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseDiscoveryResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private parseDiscoveryResponse(data: ArrayBuffer, remoteAddr: string): DiscoveredRustDeskPeer | null {
const bytes: Uint8Array = new Uint8Array(data);
if (bytes.length < 8) {
return null;
}
// 检查 magic
const decoder: util.TextDecoder = new util.TextDecoder();
const magic: string = decod... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 87a864d87b2711a626f9654a87ed5b55f421bdb3 | github |
2763981847/Accounting-app | entry/src/main/ets/common/database/tables/AccountTable.ets | arkts | generateBucket | 辅助函数,用于生成值桶对象,将 Account 对象转换为数据库可存储的格式 | function generateBucket(account: Account): relationalStore.ValuesBucket {
let obj: relationalStore.ValuesBucket = {};
obj.accountType = account.accountType;
obj.typeText = account.typeText;
obj.amount = account.amount;
obj.date = account.date.getTime()
obj.desc = account.desc
return obj;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateBucket AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left account AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function generateBucket(account: Account): relationalStore.ValuesBucket {
let obj: relationalStore.ValuesBucket = {};
obj.accountType = account.accountType;
obj.typeText = account.typeText;
obj.amount = account.amount;
obj.date = account.date.getTime()
obj.desc = account.desc
return obj;
} | https://github.com/2763981847/Accounting-app | c43febf6010d5ac6d6748b7d53d21563068b6b3a | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | setInBackground | Set background mode | setInBackground(inBackground: boolean): void {
this.isInBackground = inBackground;
console.info(`SessionState: Background mode: ${inBackground}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setInBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inBackground AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Lef... | setInBackground(inBackground: boolean): void {
this.isInBackground = inBackground;
console.info(`SessionState: Background mode: ${inBackground}`);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 869ffad8aaab6535aee0c498017225c4c492ef70 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates an Int8Array with respect to data, byteOffset and length.
@param buf data initializer
@param byteOffset byte offset from begin of the buf
@param length size of elements of type byte in newly created Int8Array | public constructor(buf: Buffer, byteOffset: number, length: number) {
this(buf, byteOffset as int, length as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe... | public constructor(buf: Buffer, byteOffset: number, length: number) {
this(buf, byteOffset as int, length as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ab02da2cb093808d9769d6a1251f132ecaae39e6 | gitee |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/DigitPanelController.ets | arkts | getMemoryDisplay | getMemoryDisplay
@return true/false | public async getMemoryDisplay(): Promise<boolean> {
if (this.evaluator !== null) {
return await this.evaluator.getMemoryDisplay();
} else {
return false;
}
} | 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 getMemoryDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST... | public async getMemoryDisplay(): Promise<boolean> {
if (this.evaluator !== null) {
return await this.evaluator.getMemoryDisplay();
} else {
return false;
}
} | https://gitee.com/openharmony-sig/applications_calculator.git | cbcb098b76ed4a4aa78a37809567ee7787107b24 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/BaseTracker.ets | arkts | isLoggedIn | 检查是否已登录 | public isLoggedIn(): boolean {
return this.authState.isLoggedIn;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLoggedIn 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#bo... | public isLoggedIn(): boolean {
return this.authState.isLoggedIn;
} | https://github.com/DaLongZhuaZi/manxia | 36fb14552068c8236a0f8135b91efd3214eb8464 | github |
Cool_foolisher1/ArkTSRepository | RandomNumberSimulator/entry/src/main/ets/pages/HomePage.ets | arkts | selectTabBarColor | 选择TabBar的颜色
@param index TabBar索引
@param color TabBar颜色
@returns TabBar颜色 | selectTabBarColor(index: number, color: ResourceStr): ResourceColor {
return this.currentIndex === index ? color : $r('app.color.gray')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectTabBarColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Lef... | selectTabBarColor(index: number, color: ResourceStr): ResourceColor {
return this.currentIndex === index ? color : $r('app.color.gray')
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 6eb2a255c88dddb2686ef470c620fdce2ac3c7bf | gitcode |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/util/OmniFilterUtil.ets | arkts | getTotalLevel | / 筛选项最多不超过三层,故直接写代码判断,本质为深度优先搜索。 | static getTotalLevel(entity: OmniFilterItemBean): number {
let level = 0;
let rootEntity = entity;
while (rootEntity.parent != null) {
rootEntity = rootEntity.parent!;
}
if (rootEntity.children && rootEntity.children.length > 0) {
level = level > 1 ? level : 1;
for (let firstLev... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTotalLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entity AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static getTotalLevel(entity: OmniFilterItemBean): number {
let level = 0;
let rootEntity = entity;
while (rootEntity.parent != null) {
rootEntity = rootEntity.parent!;
}
if (rootEntity.children && rootEntity.children.length > 0) {
level = level > 1 ? level : 1;
for (let firstLev... | https://github.com/wuba/omni-ui | f5f07a5ae55637eee2845bfd4006f281e3089bd8 | github |
openharmony/applications_call | entry/src/main/ets/common/utils/Clone.ets | arkts | cloneFunc | clone function
@param { function } func | private cloneFunc(func) {
const bodyRegister = /(?<={)(.|\n)+(?=})/m;
const paramRegister = /(?<=\().+(?=\)\s+{)/;
const funcStr = func.toString();
if (func.prototype) {
const param = paramRegister.exec(funcStr);
const bodys = bodyRegister.exec(funcStr);
if (bodys) {
if (para... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left cloneFunc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left func AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERRO... | private cloneFunc(func) {
const bodyRegister = /(?<={)(.|\n)+(?=})/m;
const paramRegister = /(?<=\().+(?=\)\s+{)/;
const funcStr = func.toString();
if (func.prototype) {
const param = paramRegister.exec(funcStr);
const bodys = bodyRegister.exec(funcStr);
if (bodys) {
if (para... | https://gitee.com/openharmony/applications_call.git | eab07ab6a04cad525fb4868d7ac90fba7cf2e0d0 | gitee |
openharmony-tpc/openharmony_tpc_samples | dialogs/library/src/main/ets/components/progress/base/LVBase.ets | arkts | getIsBack | 获取当前动画是由start变为end还是end变为start,只有当animRepeatMode为true时才有效 | getIsBack() {
return this.isBack
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIsBack 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 AST... | getIsBack() {
return this.isBack
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | d50685d48c4ef8e4832ef97900856eb5bfe1b8e6 | gitee |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/DataCrypto.ets | arkts | generateRandomSync | 生成密码学安全随机字节
部分设备固件 cryptoFramework.createRandom() 可能返回 401 (硬件RNG不可用),
重试2次后仍失败则抛出明确错误 (不做 Math.random 不安全回退)。 | private generateRandomSync(length: number): Uint8Array {
let lastErr: string = '';
for (let retry = 0; retry < 2; retry++) {
try {
const rand = cryptoFramework.createRandom();
const blob = rand.generateRandomSync(length);
if (blob && blob.data) {
return new Uint8Array(b... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateRandomSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private generateRandomSync(length: number): Uint8Array {
let lastErr: string = '';
for (let retry = 0; retry < 2; retry++) {
try {
const rand = cryptoFramework.createRandom();
const blob = rand.generateRandomSync(length);
if (blob && blob.data) {
return new Uint8Array(b... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 36b92e05a4d5b7280a1bf6e7009090bd078798b2 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | OhosVideoCache/library/src/main/ets/ProxyCache.ets | arkts | pingVideoServer | 通过视频地址来判断网络连接 | async pingVideoServer(url: string): Promise<boolean> {
try {
// 直接使用URL进行连接测试
let result = await this.pingUrl(url);
LogUtil.log("Connection test result: " + result);
return result;
} catch (error) {
LogUtil.error("Error testing video server connection: " + error.message);
/... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pingVideoServer AST#identifier#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 : ... | async pingVideoServer(url: string): Promise<boolean> {
try {
// 直接使用URL进行连接测试
let result = await this.pingUrl(url);
LogUtil.log("Connection test result: " + result);
return result;
} catch (error) {
LogUtil.error("Error testing video server connection: " + error.message);
/... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 1789f74c8f6b1ad9101e3ca617f6557b2452e008 | gitcode |
openharmony-sig/applications_clock | feature/worldclock/src/main/ets/pages/TimeZoneUtil.ets | arkts | getTimezoneFromCity | 创建某时区城市对应的时区对象 | static getTimezoneFromCity(cityID: string): i18n.TimeZone {
return i18n.TimeZone.getTimezoneFromCity(cityID);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTimezoneFromCity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cityID AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | static getTimezoneFromCity(cityID: string): i18n.TimeZone {
return i18n.TimeZone.getTimezoneFromCity(cityID);
} | https://gitee.com/openharmony-sig/applications_clock.git | 255170febdb057cd2fbb9e4af493bbfd19c8397e | gitee |
openharmony-sig/applications_clock | common/src/main/ets/utils/TimeUtil.ets | arkts | getFormattedTimeObj | Get the formatted time information in the current language and time system based on the hour and minute.
For example, if 23:16 is transferred in Chinese and the time format is 12 hours,
the following information will be returned:
{ time: '11:16', tag: '半夜', isTagLeft: true }
@param hour
@param minute
@param second
@ret... | static getFormattedTimeObj(hour: number, minute: number, second ?: number): FormatTime {
const is24HourClock = i18n.is24HourClock();
let option: intl.DateTimeOptions;
let timeObj: Date;
const currentDate = new Date();
if (second || second === 0) {
option = {
hour: DIGIT_TIME_FORMAT,
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFormattedTimeObj AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hour AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static getFormattedTimeObj(hour: number, minute: number, second ?: number): FormatTime {
const is24HourClock = i18n.is24HourClock();
let option: intl.DateTimeOptions;
let timeObj: Date;
const currentDate = new Date();
if (second || second === 0) {
option = {
hour: DIGIT_TIME_FORMAT,
... | https://gitee.com/openharmony-sig/applications_clock.git | 4e5db26a7cd5f3218dc2a88a3f6692c10b59094e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | getStoredSystemBarHeights | 获取当前存储的系统栏高度 | static getStoredSystemBarHeights(): SystemBarHeights {
const statusBarHeight = AppStorage.get<number>('statusBarHeight') ?? 0;
const navigationBarHeight = AppStorage.get<number>('navigationBarHeight') ?? 0;
return {
statusBarHeight,
navigationBarHeight
};
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStoredSystemBarHeights 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#L... | static getStoredSystemBarHeights(): SystemBarHeights {
const statusBarHeight = AppStorage.get<number>('statusBarHeight') ?? 0;
const navigationBarHeight = AppStorage.get<number>('navigationBarHeight') ?? 0;
return {
statusBarHeight,
navigationBarHeight
};
} | https://github.com/DaLongZhuaZi/manxia | 093927ecac5bb0383a2c954f395f3c2407b910d8 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | createTopicWithCookie | Submit new topic (requires Cookie session)
- Returns new topic ID (0 when unparseable) | async createTopicWithCookie(
cookie: string,
nodeName: string,
title: string,
content: string,
): Promise<number> {
const cleanNode = (nodeName || '').trim()
const cleanTitle = (title || '').trim()
const cleanContent = (content || '').trim()
if (!cookie) {
throw ApiErrors.authR... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createTopicWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annotation#Left AST#... | async createTopicWithCookie(
cookie: string,
nodeName: string,
title: string,
content: string,
): Promise<number> {
const cleanNode = (nodeName || '').trim()
const cleanTitle = (title || '').trim()
const cleanContent = (content || '').trim()
if (!cookie) {
throw ApiErrors.authR... | https://github.com/honjow/Next2V | 14d304de6cad2e7ec3140891f2229d566b3376d2 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets | arkts | get | Gets the value of a specified key.
@param key Key of the data to be queried.
@param callback Callback function. | get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void {
try {
this.kvStore?.get(key, callback);
} catch (err) {
Logger.error(TAG, `Fail to get, error message is ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ... | get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void {
try {
this.kvStore?.get(key, callback);
} catch (err) {
Logger.error(TAG, `Fail to get, error message is ${JSON.stringify(err)}`);
}
} | https://gitee.com/harmonyos/codelabs.git | 2380724285648b21971facd7c9b0f0b6775d6346 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/PcListActions.ets | arkts | showAddressPinMenu | 显示地址锁定/解锁菜单 | private showAddressPinMenu(
computer: ObservableComputer,
reachableResults: AddressTestResult[],
currentPreferred: string | undefined
): void {
const computerInfo = computer.toComputerInfo();
// 构建按钮列表(showDialog 最多 3 个按钮,我们用前几个可达地址 + 解锁)
interface DialogBtn {
text: string;
colo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showAddressPinMenu AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private showAddressPinMenu(
computer: ObservableComputer,
reachableResults: AddressTestResult[],
currentPreferred: string | undefined
): void {
const computerInfo = computer.toComputerInfo();
// 构建按钮列表(showDialog 最多 3 个按钮,我们用前几个可达地址 + 解锁)
interface DialogBtn {
text: string;
colo... | https://github.com/AlkaidLab/moonlight-harmony | f844502234e1a9c3725f87928d20720a7a0e5048 | github |
the-wwyang/kids-learning-app | src/main/ets/common/SecurityUtils.ets | arkts | validateUsername | 验证用户名格式
@param username 用户名
@returns 验证结果 | static validateUsername(username: string): UsernameValidationResult {
// 长度检查
if (username.length < 3) {
return new UsernameValidationResult(false, '用户名至少需要3个字符');
}
if (username.length > 20) {
return new UsernameValidationResult(false, '用户名不能超过20个字符');
}
// 格式检查:只允许字母、数字、下划线,必须以字... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static validateUsername(username: string): UsernameValidationResult {
// 长度检查
if (username.length < 3) {
return new UsernameValidationResult(false, '用户名至少需要3个字符');
}
if (username.length > 20) {
return new UsernameValidationResult(false, '用户名不能超过20个字符');
}
// 格式检查:只允许字母、数字、下划线,必须以字... | https://github.com/the-wwyang/kids-learning-app | 5ee0acec497d15351a1aa86b4c27ddd935539079 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets | arkts | releaseWebViewInstance | 释放WebView实例 | releaseWebViewInstance(sourceId: string): void {
const instanceInfo = this.webViewInstances.get(sourceId);
if (instanceInfo) {
instanceInfo.isInUse = false;
instanceInfo.lastUsedTime = Date.now();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left releaseWebViewInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef... | releaseWebViewInstance(sourceId: string): void {
const instanceInfo = this.webViewInstances.get(sourceId);
if (instanceInfo) {
instanceInfo.isInUse = false;
instanceInfo.lastUsedTime = Date.now();
}
} | https://github.com/DaLongZhuaZi/manxia | 40fa23fd69afd2faf14771be731373ec730a4d7d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an BigUint64Array from FixedArray<bigint>
@param { FixedArray<bigint> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<bigint>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].getULong())
}
} | 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 numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<bigint>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].getULong())
}
} | https://gitcode.com/iop123123/arkts-static-skills | 31cc080c15cb681dc3515fe8647da2c82bd98e77 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | isCustomThemeActive | 检查是否有激活的自定义主题 | public isCustomThemeActive(): boolean {
const isActive = AppStorage.get<boolean>(CUSTOM_THEME_KEYS.IS_CUSTOM_THEME_ACTIVE);
return isActive === true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCustomThemeActive 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 boole... | public isCustomThemeActive(): boolean {
const isActive = AppStorage.get<boolean>(CUSTOM_THEME_KEYS.IS_CUSTOM_THEME_ACTIVE);
return isActive === true;
} | https://github.com/DaLongZhuaZi/manxia | e71f341ece3c0f245736f865dc60c8e0726575a4 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/pages/DeletePage.ets | arkts | batchDeleteButton | Deleting selected contacts in batches. | batchDeleteButton(): void {
let keys: string[] = [];
this.checkList.forEach((item: ListItemData) => {
if (item.checked) {
let contactsKey: string = CommonConstants.CONTACTS_DATABASE_KEY + item.name;
keys.push(contactsKey);
}
});
Logger.info(TAG, `batchDeleteButton keys: ${J... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left batchDeleteButton 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_... | batchDeleteButton(): void {
let keys: string[] = [];
this.checkList.forEach((item: ListItemData) => {
if (item.checked) {
let contactsKey: string = CommonConstants.CONTACTS_DATABASE_KEY + item.name;
keys.push(contactsKey);
}
});
Logger.info(TAG, `batchDeleteButton keys: ${J... | https://gitee.com/harmonyos/codelabs.git | 1a4fdb5378ed1b1c4593d1a7af3c7c87be8fba00 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets | arkts | aggregate | 汇总多个智能体的回答
@param answers 智能体回答列表
@returns 汇总后的会诊结果 | private aggregate(answers: AgentAnswer[]): AggregatedResult {
if (answers.length === 0) {
return {
summary: '抱歉,暂时无法提供诊疗建议,请稍后重试或咨询专业医生。',
keyPoints: [],
recommendations: [],
warnings: []
};
}
// 提取关键要点
const keyPoints: string[] = [];
const recommendati... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left aggregate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left answers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expres... | private aggregate(answers: AgentAnswer[]): AggregatedResult {
if (answers.length === 0) {
return {
summary: '抱歉,暂时无法提供诊疗建议,请稍后重试或咨询专业医生。',
keyPoints: [],
recommendations: [],
warnings: []
};
}
// 提取关键要点
const keyPoints: string[] = [];
const recommendati... | https://github.com/LJ666-ui/harmony-health-care | 24ddf89131a4a802f5bb04a6a52df75f2ebc64b0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | getStats | 获取统计数据 | public getStats(): PreloadStats {
const avgPageDuration = this.stats.totalPages > 0
? this.stats.totalDuration / this.stats.totalPages
: 0;
const forwardRatio = this.stats.totalPages > 0
? this.stats.forwardPages / this.stats.totalPages
: 0.8;
const readingSpeed = this.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getStats 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 PreloadStats ... | public getStats(): PreloadStats {
const avgPageDuration = this.stats.totalPages > 0
? this.stats.totalDuration / this.stats.totalPages
: 0;
const forwardRatio = this.stats.totalPages > 0
? this.stats.forwardPages / this.stats.totalPages
: 0.8;
const readingSpeed = this.... | https://github.com/DaLongZhuaZi/manxia | 821bb2e1311ba9add83e7c8ce37797dcfc91a326 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/BackgroundImageUtil.ets | arkts | getDefaultConfig | 获取默认背景图配置 | getDefaultConfig(): BackgroundConfig {
return {
imageUrl: this.cachedUrl,
opacity: 0.15,
enableBlur: true,
blurRadius: 20
};
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDefaultConfig 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 BackgroundConfig AST#identifier#Right AST#ERR... | getDefaultConfig(): BackgroundConfig {
return {
imageUrl: this.cachedUrl,
opacity: 0.15,
enableBlur: true,
blurRadius: 20
};
} | https://github.com/AlkaidLab/moonlight-harmony | ddf9085beb122cebdc9e6c1b5089caf1617ab3c4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates an Float32Array with respect to data, byteOffset and length.
@param buf data initializer
@param byteOffset byte offset from begin of the buf
@param length size of elements of type float in newly created Float32Array | public constructor(buf: Buffer, byteOffset: int, length: int) {
if (buf.getByteLength() % Float32Array.BYTES_PER_ELEMENT != 0) {
throw new RangeError("ArrayBuffer.byteLength should be multiple of 4 as Float32Array.BYTES_PER_ELEMENT")
}
if (byteOffset % Float32Array.BYTES_PER_ELEM... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe... | public constructor(buf: Buffer, byteOffset: int, length: int) {
if (buf.getByteLength() % Float32Array.BYTES_PER_ELEMENT != 0) {
throw new RangeError("ArrayBuffer.byteLength should be multiple of 4 as Float32Array.BYTES_PER_ELEMENT")
}
if (byteOffset % Float32Array.BYTES_PER_ELEM... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d1ce850433aa4fec0654228b03d7814475168f9f | gitee |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets | arkts | getReminderText | 获取提醒时机文本 | getReminderText(timing: ReminderTiming): string {
switch (timing) {
case ReminderTiming.ON_TIME:
return '准时'
case ReminderTiming.MINUTES_5:
return '5分钟前'
case ReminderTiming.MINUTES_10:
return '10分钟前'
case ReminderTiming.MINUTES_15:
return '15分钟前'
case... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getReminderText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timing AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReminderTiming AST#identifier#Right AS... | getReminderText(timing: ReminderTiming): string {
switch (timing) {
case ReminderTiming.ON_TIME:
return '准时'
case ReminderTiming.MINUTES_5:
return '5分钟前'
case ReminderTiming.MINUTES_10:
return '10分钟前'
case ReminderTiming.MINUTES_15:
return '15分钟前'
case... | https://gitcode.com/openharmony/codelabs | f7ac339fe12b1d27a39726b257b0f6fe0b49981c | gitcode |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/utils/FileUtils.ets | arkts | createMergeFileByPath | Create a merge file based on the resource path
@param filePath_one
@param FilePath_two | static createMergeFileByPath(filePath_one: string, FilePath_two: string, callBack: IFileCachePathCallBack) {
let filepathDir = filePath_one.substring(0, filePath_one.lastIndexOf("/"))
let path = filepathDir + "/mergeTemp.txt"
let fileContent = "file '" + filePath_one + "'\nfile '" + FilePath_two + "'";
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createMergeFileByPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath_one AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | static createMergeFileByPath(filePath_one: string, FilePath_two: string, callBack: IFileCachePathCallBack) {
let filepathDir = filePath_one.substring(0, filePath_one.lastIndexOf("/"))
let path = filepathDir + "/mergeTemp.txt"
let fileContent = "file '" + filePath_one + "'\nfile '" + FilePath_two + "'";
... | https://gitee.com/openharmony-tpc/mp4parser.git | 2fd0c86727c6ec8f34906711158e968bb50e5820 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets | arkts | collectPerformanceData | 收集性能数据 | public async collectPerformanceData(): Promise<HidebugPerformanceData | null> {
if (this.isCollecting) {
return null; // 避免重复收集
}
this.isCollecting = true;
const startTime = Date.now();
try {
const data: HidebugPerformanceData = {
timestamp: startTime,
memory:... | 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 collectPerformanceData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public async collectPerformanceData(): Promise<HidebugPerformanceData | null> {
if (this.isCollecting) {
return null; // 避免重复收集
}
this.isCollecting = true;
const startTime = Date.now();
try {
const data: HidebugPerformanceData = {
timestamp: startTime,
memory:... | https://github.com/DaLongZhuaZi/manxia | 27552c924536a98bd6fd2e0f68b12918b5633f88 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.