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 |
|---|---|---|---|---|---|---|---|---|---|---|
OHPG/FinSdk | jellyfin/src/main/ets/api/PlayStateApi.ets | arkts | onPlaybackProgress | onPlaybackProgress
@summary Reports a session\'s playback progress.
@param {PlayStateApiOnPlaybackProgressRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof PlayStateApi | public async onPlaybackProgress(requestParameters: PlayStateApiOnPlaybackProgressRequest): Promise<void> {
this.assertParam(requestParameters.itemId)
return this.apiClient.post({path: `/PlayingItems/${requestParameters.itemId}/Progress`, parameters: requestParameters})
} | 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 onPlaybackProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Righ... | public async onPlaybackProgress(requestParameters: PlayStateApiOnPlaybackProgressRequest): Promise<void> {
this.assertParam(requestParameters.itemId)
return this.apiClient.post({path: `/PlayingItems/${requestParameters.itemId}/Progress`, parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | b9bf1174511a73c1f1f02579fadc140df9bd6fc6 | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/pages/MainWorkspace.ets | arkts | toggleVolume | ========== 卷/章节操作 ========== | toggleVolume(volumeId: string) {
if (this.expandedVolumes.has(volumeId)) {
this.expandedVolumes.delete(volumeId)
} else {
this.expandedVolumes.add(volumeId)
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left volumeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#... | toggleVolume(volumeId: string) {
if (this.expandedVolumes.has(volumeId)) {
this.expandedVolumes.delete(volumeId)
} else {
this.expandedVolumes.add(volumeId)
}
} | https://github.com/Xiwei753/xiezuoruanjian | 11fffadfae5d2b207c0bc01d4b4563346cba3b22 | github |
pangpang20/antennaPodHM | entry/src/main/ets/pages/PodcastDetailPage.ets | arkts | showUnsubscribeDialog | 显示取消订阅确认对话框 | showUnsubscribeDialog(): void {
if (!this.podcast) return;
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('确定', '#FF3B30')
];
UIUtils.showDialog(new DialogOptions(
'取消订阅',
`确定要取消订阅《${this.podcast.title}》吗?\n\n取消订阅后,该播客的所有单集和下载内容都将被... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showUnsubscribeDialog 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#statem... | showUnsubscribeDialog(): void {
if (!this.podcast) return;
const buttons: ButtonOptions[] = [
new ButtonOptions('取消', '#999999'),
new ButtonOptions('确定', '#FF3B30')
];
UIUtils.showDialog(new DialogOptions(
'取消订阅',
`确定要取消订阅《${this.podcast.title}》吗?\n\n取消订阅后,该播客的所有单集和下载内容都将被... | https://github.com/pangpang20/antennaPodHM | 1222543512f9dfb9a344dbe7a89c7b50e174b077 | github |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | initializeAudioSender | ============================================================
音频 — 完整发送链路
============================================================
初始化音频发送端
AudioCapture → Rust 层一体化(G.711 编码 + RTP 打包 + 发送) | public async initializeAudioSender(): Promise<boolean> {
try {
const sampleRate: number = this.config.audio?.sampleRate ?? DEFAULT_AUDIO_CONFIG.sampleRate;
const channels: number = this.config.audio?.channels ?? DEFAULT_AUDIO_CONFIG.channels;
const codec: string = this.config.audio?.codec ?? DEF... | 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 initializeAudioSender AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public async initializeAudioSender(): Promise<boolean> {
try {
const sampleRate: number = this.config.audio?.sampleRate ?? DEFAULT_AUDIO_CONFIG.sampleRate;
const channels: number = this.config.audio?.channels ?? DEFAULT_AUDIO_CONFIG.channels;
const codec: string = this.config.audio?.codec ?? DEF... | https://github.com/tdcare/tdwebrtc | 1bbfd34ab44aad76c29fe7206ec31d41d50acca7 | github |
PollenWang6/HiXD | entry/src/main/ets/services/SchoolnetService.ets | arkts | getZfwUsage | 获取 ZFW 使用概览数据(登录后调用)
对齐 Flutter: _getNetworkUsage() | async getZfwUsage(): Promise<ZfwUsageData> {
const resp: HttpResponse = await this.http.get(ZFW_BASE + '/home');
return this.parseZfwHome(resp.body);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getZfwUsage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_... | async getZfwUsage(): Promise<ZfwUsageData> {
const resp: HttpResponse = await this.http.get(ZFW_BASE + '/home');
return this.parseZfwHome(resp.body);
} | https://github.com/PollenWang6/HiXD | ce57d302b614eff64d850835ea6d17fc404a3e3f | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | preprocessImageFileWithCleanup | 预处理图片文件路径,并返回是否需要清理临时副本。 | static async preprocessImageFileWithCleanup(filePath: string): Promise<PreprocessedImageFile> {
try {
LogUtil.debug(`🔧 预处理图片文件: ${filePath}`);
// 如果不是 URI,直接返回
if (!LubanUtils.isUri(filePath)) {
LogUtil.debug('📁 普通路径,直接返回');
return {
path: filePath,
shouldC... | 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 preprocessImageFileWithCleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#... | static async preprocessImageFileWithCleanup(filePath: string): Promise<PreprocessedImageFile> {
try {
LogUtil.debug(`🔧 预处理图片文件: ${filePath}`);
// 如果不是 URI,直接返回
if (!LubanUtils.isUri(filePath)) {
LogUtil.debug('📁 普通路径,直接返回');
return {
path: filePath,
shouldC... | https://github.com/kumaleap/ArkLuban | 3c1b940705f0e48f3f2c881ab5fb0e12dfd762d7 | github |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/banner/BannerNetworkDataSourceImpl.ets | arkts | getBannerList | 查询轮播图列表
@param params 请求参数
@returns 轮播图列表响应 | async getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("info/banner/list", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBannerList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> {
const resp: AxiosResponse<NetworkResponse<Unknown>> =
await NetworkClient.http.post("info/banner/list", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | a498426a3485768fab195980ef47ee075b5958d1 | github |
silence17/harmonydemo | entry/src/main/ets/pages/RankPage.ets | arkts | onBackPress | @Entry装饰的组件才可以调用页面的生命周期
当用户点击返回按钮时触发。 | onBackPress() {
if (this.isShowToast()) {
prompt.showToast({
message: $r('app.string.prompt_text'),
duration: TIME
});
this.clickBackTimeRecord = new Date().getTime();
return true;
}
return false;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackPress 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... | onBackPress() {
if (this.isShowToast()) {
prompt.showToast({
message: $r('app.string.prompt_text'),
duration: TIME
});
this.clickBackTimeRecord = new Date().getTime();
return true;
}
return false;
} | https://github.com/silence17/harmonydemo | 3563c37a1f02dea11319489a13682e13605fddf2 | github |
ibestservices/ibest-ui | library/src/main/ets/components/rollingText/index.ets | arkts | getTranslateY | 获取总偏移量 | getTranslateY(){
return this.textHeight * (this.itemArr.length - 1)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTranslateY 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... | getTranslateY(){
return this.textHeight * (this.itemArr.length - 1)
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/rollingText/index.ets#L192-L194 | fcd6939adf1a7a0d4e8a123e9f4f5d5f1c2ad7be | github |
apap6628114/nga_oh | entry/src/main/ets/common/datasource/BaseLazyDataSource.ets | arkts | clear | 清空所有元素并通知整体刷新。 | clear(): void {
this.dataList = []
this.notifyReload()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear 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... | clear(): void {
this.dataList = []
this.notifyReload()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L92-L95 | 99e1482618bea9c31900aa39485eaab0aa0963f5 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/otp/OtpCompatibilityManager.ets | arkts | constructor | 私有构造函数(单例模式) | private constructor() {
this.registerDefaultParsers();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
this.registerDefaultParsers();
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/OtpCompatibilityManager.ets#L23-L25 | 6054e446ec1dd34a69ec740019eac4ff3bc8786c | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | handleGestureEvent | ==================== Gesture/Keyboard Event Handling ==================== | handleGestureEvent(event: GestureEvent): EditorActionResult {
const data = CoreProtocol.encodeGestureEvent(event);
const payload = native.handleEditorGestureEvent(this.handle, data, data.byteLength);
return CoreProtocol.decodeEditorActionResult(payload);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleGestureEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GestureEvent AST#identifier#Right AS... | handleGestureEvent(event: GestureEvent): EditorActionResult {
const data = CoreProtocol.encodeGestureEvent(event);
const payload = native.handleEditorGestureEvent(this.handle, data, data.byteLength);
return CoreProtocol.decodeEditorActionResult(payload);
} | https://github.com/FinalScave/SweetEditor | bc26cfea239e9e78a60a26dd7545b7de12e19223 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedSfixed64 | 访问 repeated sfixed64 字段
JSON: array of string | visitRepeatedSfixed64(value: bigint[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.map(v => v.toString()) as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedSfixed64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left big... | visitRepeatedSfixed64(value: bigint[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.map(v => v.toString()) as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | f2d21c6742ee33e961c878d44030e6b2f01ea7ff | gitcode |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/FileUtils.ets | arkts | getFileStat | 获取文件状态
@param path 文件绝对路径 | static getFileStat(path: string): fs.Stat {
return fs.statSync(path);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileStat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | static getFileStat(path: string): fs.Stat {
return fs.statSync(path);
} | https://gitcode.com/arkui-x/samples | a0c9596add3fa7fe5538d60758753fc044ff110d | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/AlbumService.ets | arkts | formatSize | 10秒超时
格式化文件大小
@param size 字节数
@returns 格式化后的大小,如 '3.2MB' | private static formatSize(size: number): string {
if (size === 0) return '0B';
const units = ['B', 'KB', 'MB', 'GB'];
const index = Math.floor(Math.log(size) / Math.log(1024));
const formattedSize = (size / Math.pow(1024, index)).toFixed(2);
return `${formattedSize}${units[index]}`;
} | 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 formatSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AS... | private static formatSize(size: number): string {
if (size === 0) return '0B';
const units = ['B', 'KB', 'MB', 'GB'];
const index = Math.floor(Math.log(size) / Math.log(1024));
const formattedSize = (size / Math.pow(1024, index)).toFixed(2);
return `${formattedSize}${units[index]}`;
} | https://github.com/cpdd5201314/harmonyOS-music-app | 32e1f42282d23600246ac233c554948ad76a997c | github |
HarmonyOS_Samples/MusicHome | products/default/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | Reserved for warm-start / new Want delivery (no-op for this sample). | onNewWant(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left ... | onNewWant(): void {
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 8bdf900c3b3557c2b84fd0d300095ad952dd3813 | gitcode |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedFixed64 | 访问 repeated fixed64 字段
JSON: array of string | visitRepeatedFixed64(value: bigint[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.map(v => v.toString()) as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedFixed64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left bigi... | visitRepeatedFixed64(value: bigint[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.map(v => v.toString()) as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | bce4a527a049c1df011773684c5535955d4c7c2b | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/PedometerApp/entry/src/main/ets/common/utils/StepsUtil.ets | arkts | checkStrIsEmpty | Check str is empty.
@param {string} str
@return {boolean} true | checkStrIsEmpty(str: string): boolean {
return str?.trim().length === 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkStrIsEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ... | checkStrIsEmpty(str: string): boolean {
return str?.trim().length === 0;
} | https://gitee.com/harmonyos/codelabs.git | 8be025ae697f0409971aee19c81d57ff08844b28 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | getDefaultSettings | 获取默认账本设置 | static getDefaultSettings(): LedgerSettings {
const result: LedgerSettings = {
requireApproval: false,
approvalThreshold: 1000,
allowMemberInvite: false,
defaultCurrency: 'CNY',
billVisibility: 'all',
notifyOnNewBill: true,
notifyOnApproval: true,
autoApproveRoles: ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDefaultSettings 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 Led... | static getDefaultSettings(): LedgerSettings {
const result: LedgerSettings = {
requireApproval: false,
approvalThreshold: 1000,
allowMemberInvite: false,
defaultCurrency: 'CNY',
billVisibility: 'all',
notifyOnNewBill: true,
notifyOnApproval: true,
autoApproveRoles: ... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 4627c07e8bf5703af178f96e5f2fa7f404baf975 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | isCompressedData | 检查是否为压缩格式 | function isCompressedData(data: string): boolean {
return data.startsWith(COMPRESSED_PREFIX);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isCompressedData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function isCompressedData(data: string): boolean {
return data.startsWith(COMPRESSED_PREFIX);
} | https://github.com/AlkaidLab/moonlight-harmony | acac1b8d5ed36b3e3ce93121661f5d77c0c43787 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BattleEngine.ets | arkts | getState | Immutable-ish view of the current state. Callers must not mutate. | getState(): BattleState {
return this.state_;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left BattleState AST#identifier#Right AST#ERROR#Right AST#... | getState(): BattleState {
return this.state_;
} | https://github.com/terryma2024/happyword | 71cf8c1088bc8fbc52cbb0a014afa5baffa1a6cc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | applyDifferentialPatch | 应用差分补丁 | private async applyDifferentialPatch(pluginId: string, patch: DifferentialPatch): Promise<void> {
try {
logger.debug(TAG, `应用差分补丁: ${pluginId}`);
// 应用补丁操作
for (const operation of patch.operations) {
await this.applyPatchOperation(pluginId, operation);
}
// 重新加载... | 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 applyDifferentialPatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pluginId AST#identifier#Right AST#ERROR#Left ... | private async applyDifferentialPatch(pluginId: string, patch: DifferentialPatch): Promise<void> {
try {
logger.debug(TAG, `应用差分补丁: ${pluginId}`);
// 应用补丁操作
for (const operation of patch.operations) {
await this.applyPatchOperation(pluginId, operation);
}
// 重新加载... | https://github.com/DaLongZhuaZi/manxia | 096dda0606b649f9d75cd7c68f85e32540a8a989 | github |
popsiclelmlm/Hey | entry/src/main/ets/features/subscriptions/SubscriptionVisuals.ets | arkts | leadingFlag | 提取名称开头内嵌的国旗 emoji(两个区域指示符,UTF-16 共 4 个码元)。 | function leadingFlag(name: string): string {
const trimmed = name.trimStart();
if (!isRegionalIndicator(trimmed.codePointAt(0))) {
return '';
}
if (!isRegionalIndicator(trimmed.codePointAt(2))) {
return '';
}
return trimmed.substring(0, 4);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left leadingFlag AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function leadingFlag(name: string): string {
const trimmed = name.trimStart();
if (!isRegionalIndicator(trimmed.codePointAt(0))) {
return '';
}
if (!isRegionalIndicator(trimmed.codePointAt(2))) {
return '';
}
return trimmed.substring(0, 4);
} | https://github.com/popsiclelmlm/Hey | 455ef2bccc747ea3131a00b5691c7819c8c779c3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | isBoolean | 检查值是否为布尔值
@param value - 要检查的值
@returns 是否为布尔值 | static isBoolean(value: Object): boolean {
return typeof value === 'boolean';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Objec... | static isBoolean(value: Object): boolean {
return typeof value === 'boolean';
} | https://github.com/DaLongZhuaZi/manxia | 4c889cc003120793a34ecf15dbe159ebbe115543 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toFixed | Return a string representing the value of this Decimal in normal (fixed-point) notation to
`decimalPlaces` fixed decimal places and rounded using rounding mode `rounding`.
@param { double } decimalPlaces Decimal places. Integer, 0 to MAX_DIGITS inclusive.
@param { Rounding } rounding Rounding mode. Integer, 0 to 8 incl... | public toFixed(decimalPlaces: double, rounding: Rounding): string {
Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS);
Utils.checkInt32(rounding, 0, 8);
let y = Utils.finalise(new Decimal(this), decimalPlaces + this.e + 1, rounding);
let str = y.finiteToString(false, decimalPlaces + y.e... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toFixed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left decimalPlaces AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double AST#iden... | public toFixed(decimalPlaces: double, rounding: Rounding): string {
Utils.checkInt32(decimalPlaces, 0, MAX_DIGITS);
Utils.checkInt32(rounding, 0, 8);
let y = Utils.finalise(new Decimal(this), decimalPlaces + this.e + 1, rounding);
let str = y.finiteToString(false, decimalPlaces + y.e... | https://gitcode.com/iop123123/arkts-static-skills | 6c47cd36e8c7960cd8833be8639e6d55dcb1df79 | gitcode |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t18_skipNulls | T18: skipNulls — uses parse strictNullHandling to create null values | t18_skipNulls(): void {
const popts: ParseOptions = { strictNullHandling: true };
const obj: Record<string, Object> = parse('a=1&b&c=3', popts);
const sopts: StringifyOptions = { skipNulls: true };
const result: string = stringify(obj, sopts);
// b has no =value, so strictNullHandling sets it to n... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t18_skipNulls AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | t18_skipNulls(): void {
const popts: ParseOptions = { strictNullHandling: true };
const obj: Record<string, Object> = parse('a=1&b&c=3', popts);
const sopts: StringifyOptions = { skipNulls: true };
const result: string = stringify(obj, sopts);
// b has no =value, so strictNullHandling sets it to n... | https://github.com/wgli-collab/qs-arkts | 59ff4d3b5fd8ffbc8e8d838507741f3cdf3abd75 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | decodeAction | 将编码字符串解码为 KeyAction | function decodeAction(s: string): KeyAction {
// 复合类型以 W|, X|, C| 开头
if (s.startsWith('W|')) {
const body = s.substring(2);
const segParts = body.split('|');
const segments: WheelPadSegment[] = [];
for (const sp of segParts) {
const colonIdx = sp.lastIndexOf(':');
if (colonIdx >= 0) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left decodeAction 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 ... | function decodeAction(s: string): KeyAction {
// 复合类型以 W|, X|, C| 开头
if (s.startsWith('W|')) {
const body = s.substring(2);
const segParts = body.split('|');
const segments: WheelPadSegment[] = [];
for (const sp of segParts) {
const colonIdx = sp.lastIndexOf(':');
if (colonIdx >= 0) {
... | https://github.com/AlkaidLab/moonlight-harmony | f11b7616a31d0a8cd4d0b519bf6f5e04b3fb6579 | github |
openharmony-sig/smartperf | device/device_ui/entry/src/main/ets/common/ui/detail/chart/components/LimitLine.ets | arkts | enableDashedLine | Enables the line to be drawn in dashed mode, e.g. like this "- - - - - -"
@param lineLength the length of the line pieces
@param spaceLength the length of space inbetween the pieces
@param phase offset, in degrees (normally, use 0) | public enableDashedLine(lineLength: number, spaceLength: number, phase: number) {
this.mDashPathEffect = new DashPathEffect([lineLength, spaceLength],phase);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableDashedLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu... | public enableDashedLine(lineLength: number, spaceLength: number, phase: number) {
this.mDashPathEffect = new DashPathEffect([lineLength, spaceLength],phase);
} | https://gitee.com/openharmony-sig/smartperf.git | f6ff703ecca7f803ff09390947ea011afc064a74 | gitee |
Octo-o-o-o/harmonyos-ai-workspace | tools/hooks/test-fixtures/BadRuntimePitfalls.ets | arkts | decode | ARKTS-DEPRECATED-DECODE: 弃用 API | function decode(buf: Uint8Array): string {
const dec = util.TextDecoder.create('utf-8');
return dec.decodeWithStream(buf); // ← 应改 decodeToString({stream:true})
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left decode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buf AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function decode(buf: Uint8Array): string {
const dec = util.TextDecoder.create('utf-8');
return dec.decodeWithStream(buf); // ← 应改 decodeToString({stream:true})
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | 223e4adbd1819e529c9101b0d83faab45d43eeb1 | github |
arkui-x/samples | CodeLab/Cases/feature/eraser/src/main/ets/model/RenderNodeModel.ets | arkts | makeNode | 从NodeController根节点获取的RenderNode,用于添加和删除新创建的MyRenderNode实例
MyNodeController实例绑定的NodeContainer创建时触发,创建根节点rootNode并将其挂载至NodeContainer | makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {
this.rootRenderNode = this.rootNode.getRenderNode();
}
return this.rootNode;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left makeNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext AST#identifier#Right AST#)#Left ... | makeNode(uiContext: UIContext): FrameNode {
this.rootNode = new FrameNode(uiContext);
if (this.rootNode !== null) {
this.rootRenderNode = this.rootNode.getRenderNode();
}
return this.rootNode;
} | https://gitcode.com/arkui-x/samples | 3bb1d6ef406d6dbb5812afe156f66c26d68cdee4 | gitcode |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | definePathParameter | Define path parameter metadata | static definePathParameter(paramIndex: number, paramName: string, target: Object, propertyKey: string | symbol): void {
let pathParams = this.getMetadata('retrofit:pathParams', target, propertyKey) as Record<number, string> || {};
pathParams[paramIndex] = paramName;
this.defineMetadata('retrofit:pathParam... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left definePathParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left paramIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | static definePathParameter(paramIndex: number, paramName: string, target: Object, propertyKey: string | symbol): void {
let pathParams = this.getMetadata('retrofit:pathParams', target, propertyKey) as Record<number, string> || {};
pathParams[paramIndex] = paramName;
this.defineMetadata('retrofit:pathParam... | https://github.com/killetom/ktretrofit | 595c189c06f52f1217549263de223d92ef52a6e6 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets | arkts | handleClearHistory | 清空搜索历史并刷新列表
@returns {Promise<void>} Promise<void> | private async handleClearHistory(): Promise<void> {
await this.searchHistoryRepository.clearAllSearchHistory();
this.hideClearHistoryDialog();
await this.loadSearchHistory();
} | 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 handleClearHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async handleClearHistory(): Promise<void> {
await this.searchHistoryRepository.clearAllSearchHistory();
this.hideClearHistoryDialog();
await this.loadSearchHistory();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 9cce6dbe7633ad63a3b5c4907861f89bde7daf64 | github |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | constructor | Word must be typed 3 times to be learned | constructor() {
this.models = new Map();
} | 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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
this.models = new Map();
} | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L41-L43 | e157aea21b4d85e364adc061711d7f4aee5cf51b | github |
HarmonyOS_Samples/arkts-clock | entry/src/main/ets/utils/DrawClock.ets | arkts | drawDot | Draw the center point | drawDot(context: CanvasRenderingContext2D) {
context.save();
context.beginPath();
context.fillStyle = '#05f';
context.arc(0, 0, 4, 0, 2 * Math.PI, false);
context.fill();
context.restore();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawDot 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 CanvasRenderingContext2D AST#i... | drawDot(context: CanvasRenderingContext2D) {
context.save();
context.beginPath();
context.fillStyle = '#05f';
context.arc(0, 0, 4, 0, 2 * Math.PI, false);
context.fill();
context.restore();
} | https://gitcode.com/HarmonyOS_Samples/arkts-clock | df7afaa2d54eaa3d5f55e9fa896524fa17fe5ba4 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/BarLineChartBaseModel.ets | arkts | setVisibleYRangeMaximum | Sets the size of the area (range on the y-axis) that should be maximum
visible at once.
@param maxYRange the maximum visible range on the y-axis
@param axis the axis for which this limit should apply | public setVisibleYRangeMaximum(maxYRange: number, axis: AxisDependency): void {
let yScale: number = this.getAxisRange(axis) / maxYRange;
this.mViewPortHandler.setMinimumScaleY(yScale);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVisibleYRangeMaximum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxYRange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | public setVisibleYRangeMaximum(maxYRange: number, axis: AxisDependency): void {
let yScale: number = this.getAxisRange(axis) / maxYRange;
this.mViewPortHandler.setMinimumScaleY(yScale);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 935bda07a292ebe645992870b1beedab1f83794e | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | from | Creates an BigUint64Array from array-like argument
@param o array-like object to initialize BigUint64Array
@param mapFn function to apply for each
@returns new BigUint64Array | public from(o: Object, mapFn: (e: Object) => BigInt): BigUint64Array {
let newF: (e: Object, index: int) => BigInt =
(e: Object, index: int): BigInt => { return mapFn(e) }
return this.from(o, newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R... | public from(o: Object, mapFn: (e: Object) => BigInt): BigUint64Array {
let newF: (e: Object, index: int) => BigInt =
(e: Object, index: int): BigInt => { return mapFn(e) }
return this.from(o, newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8dcf17de164869245d5f6da02c470474ae402ea8 | gitee |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets | arkts | grantPermissionWithResult | 授予权限并返回操作结果
@param permission 操作权限
@param flag 授权flag
@param tokenId 应用token
@param atManager atManager对象
return | private async grantPermissionWithResult(
permission: Permission, flag: number, tokenId: number, atManager: abilityAccessCtrl.AtManager
): Promise<optionAndState> {
try {
await atManager.grantUserGrantedPermission(tokenId, permission, flag);
Log.info(`grant permission success, permission: ${permi... | 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 grantPermissionWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#R... | private async grantPermissionWithResult(
permission: Permission, flag: number, tokenId: number, atManager: abilityAccessCtrl.AtManager
): Promise<optionAndState> {
try {
await atManager.grantUserGrantedPermission(tokenId, permission, flag);
Log.info(`grant permission success, permission: ${permi... | https://gitee.com/openharmony/applications_permission_manager.git | a296534a3b5faa0a927e393fe378821bab081a5c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelLoginManager.ets | arkts | clearAll | 清除所有登录状态 | clearAll(): void {
this.loginStatus.clear();
this.cookies.clear();
logger.info(TAG, '已清除所有登录状态');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAll 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... | clearAll(): void {
this.loginStatus.clear();
this.cookies.clear();
logger.info(TAG, '已清除所有登录状态');
} | https://github.com/DaLongZhuaZi/manxia | 9d1b3165e2d3c54e64509eda8efa317bdb53f01a | github |
arkui-x/samples | CodeLab/Cases/feature/collapsemenu/src/main/ets/model/BasicDataSource.ets | arkts | getData | 获取指定索引数据 | public getData(index: number): void {
console.info('getData, index:' + 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): void {
console.info('getData, index:' + index);
} | https://gitcode.com/arkui-x/samples | 034a87ee736abdb317cfd5811a65e16deba5655d | gitcode |
openharmony-sig/arkui_composite_component | source/TreeView/TreeView.ets | arkts | getInstance | Obtains the EventBusManager object.
@since 10 | public static getInstance(): TreeListenerManager {
if (AppStorage.Get(this.APP_KEY_EVENT_BUS) == null) {
AppStorage.SetOrCreate(this.APP_KEY_EVENT_BUS, new TreeListenerManager())
}
return AppStorage.Get(this.APP_KEY_EVENT_BUS);
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): TreeListenerManager {
if (AppStorage.Get(this.APP_KEY_EVENT_BUS) == null) {
AppStorage.SetOrCreate(this.APP_KEY_EVENT_BUS, new TreeListenerManager())
}
return AppStorage.Get(this.APP_KEY_EVENT_BUS);
} | https://gitee.com/openharmony-sig/arkui_composite_component.git | 025362e72812ff9e8e410755a384b3534c181fd0 | gitee |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | UI页面管理器 | onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability
GlobalContext.getContext().setObject('isForeground', true);
windowStage.loadContent('pages/SplashPage', (err, data) => {
if (err.code) {
Logger.error('windowStage', 'Failed to loa... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left win... | onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability
GlobalContext.getContext().setObject('isForeground', true);
windowStage.loadContent('pages/SplashPage', (err, data) => {
if (err.code) {
Logger.error('windowStage', 'Failed to loa... | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | 5364890fba1c30a4ee2b4e597e9708eca96be42c | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | decryptAes | aes 解密
本例演示的 ecb 模式,cbc 模式和 gcm 模式请参见文档 | public static decryptAes(cipherData: Uint8Array, keyData: Uint8Array): Uint8Array {
let cipherBlog: cryptoFramework.DataBlob = { data: cipherData };
let symKey = CryptoHelper.getAes128SymKey(keyData)
let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7');
cipher.initSync(cryptoFramework.Crypto... | 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 decryptAes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cipherData AST#identifier#Right AST#:#Left :... | public static decryptAes(cipherData: Uint8Array, keyData: Uint8Array): Uint8Array {
let cipherBlog: cryptoFramework.DataBlob = { data: cipherData };
let symKey = CryptoHelper.getAes128SymKey(keyData)
let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7');
cipher.initSync(cryptoFramework.Crypto... | https://github.com/webabcd/HarmonyDemo | 68eef7d466ab944492ba12ada4c8b9fee517529f | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/EntityDataInput.ets | arkts | has | 检查是否包含键
@param key 键名
@returns 是否包含 | has(key: string): boolean {
return this.data.has(key)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has 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 ... | has(key: string): boolean {
return this.data.has(key)
} | https://github.com/offlinecat-dev/OCNetORM | 48f250e027eda4e12ffde13d33af7067892c42ce | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | replaceVariables | 替换字符串中的变量 | private replaceVariables(text: string, variables: VariableMap): string {
let result = text;
if (variables.searchKeyword) {
result = result.replace(/\{\{searchKeyword\}\}/g, variables.searchKeyword);
}
if (variables.mangaId) {
result = result.replace(/\{\{mangaId\}\}/g, variables.manga... | 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#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private replaceVariables(text: string, variables: VariableMap): string {
let result = text;
if (variables.searchKeyword) {
result = result.replace(/\{\{searchKeyword\}\}/g, variables.searchKeyword);
}
if (variables.mangaId) {
result = result.replace(/\{\{mangaId\}\}/g, variables.manga... | https://github.com/DaLongZhuaZi/manxia | c36e24569ad5bfdb5de074307d9ee794e3b88268 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/formatter/DefaultValueFormatter.ets | arkts | getDecimalDigits | Returns the number of decimal digits this formatter uses.
@return | public getDecimalDigits(): number {
return this.mDecimalDigits;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDecimalDigits 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 AS... | public getDecimalDigits(): number {
return this.mDecimalDigits;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 63f03888f1ea30cdd112e14c2fe290bb73991d81 | gitee |
openharmony/developtools_ace_ets2bundle | compiler/sample/pages/testcases/stacktestsuite.ets | arkts | fitToText | alignToText | fitToText(fit) {
if (fit >= this.stackFits.length)
return "Unknown (" + fit + ")";
return "StackFit." + this.stackFits[fit] + "(" + /*StackFit[this.stackFits[fit]]*/ + ")";
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fitToText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fit AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression... | fitToText(fit) {
if (fit >= this.stackFits.length)
return "Unknown (" + fit + ")";
return "StackFit." + this.stackFits[fit] + "(" + /*StackFit[this.stackFits[fit]]*/ + ")";
} | https://gitee.com/openharmony/developtools_ace_ets2bundle.git | ab1f8ff7d9244b9853ec6b221ba2f314b76a7454 | gitee |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/UserService.ets | arkts | getUserSettings | 获取用户设置 | async getUserSettings(): Promise<UserSettings> {
if (!this.store) {
console.warn('用户服务未初始化,返回默认设置');
return new UserSettings();
}
try {
const data = await this.store.get(UserService.USER_SETTINGS_KEY, '');
if (data && typeof data === 'string' && data.length > 0) {
const se... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getUserSettings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left... | async getUserSettings(): Promise<UserSettings> {
if (!this.store) {
console.warn('用户服务未初始化,返回默认设置');
return new UserSettings();
}
try {
const data = await this.store.get(UserService.USER_SETTINGS_KEY, '');
if (data && typeof data === 'string' && data.length > 0) {
const se... | https://gitcode.com/openharmony/codelabs | 745b9c2352d79505d8d0dbe2377e0b1f1cd09c8f | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/parking/ParkingService.ets | arkts | calculateDistance | 计算两点之间的距离(Haversine公式) | calculateDistance(lat1: number, lng1: number, lat2: number, lng2: number): number {
const R = 6371000;
const dLat = (lat2 - lat1) * Math.PI / 180;
const dLng = (lng2 - lng1) * Math.PI / 180;
const a = Math.sin(dLat / 2) ** 2 + Math.cos(lat1 * Math.PI / 180) *
Math.cos(lat2 * Math.PI / 180) * Mat... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lat1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left... | calculateDistance(lat1: number, lng1: number, lat2: number, lng2: number): number {
const R = 6371000;
const dLat = (lat2 - lat1) * Math.PI / 180;
const dLng = (lng2 - lng1) * Math.PI / 180;
const a = Math.sin(dLat / 2) ** 2 + Math.cos(lat1 * Math.PI / 180) *
Math.cos(lat2 * Math.PI / 180) * Mat... | https://github.com/LJ666-ui/harmony-health-care | c2062811e8c23fa13b2a1ce0217c66e0e73057a0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/Logger.ets | arkts | setHilogOutputLevel | 设置hilog输出级别
此设置控制日志是否输出到系统的hilog
@param level - hilog输出的最低日志级别,设置为OFF则完全关闭hilog输出 | public setHilogOutputLevel(level: LogLevel): void {
this.hilogOutputLevel = level;
console.log(`[NGF] hilog输出级别已设置为: ${LOG_LEVEL_NAMES[LOG_LEVEL_VALUES.indexOf(level)]}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHilogOutputLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public setHilogOutputLevel(level: LogLevel): void {
this.hilogOutputLevel = level;
console.log(`[NGF] hilog输出级别已设置为: ${LOG_LEVEL_NAMES[LOG_LEVEL_VALUES.indexOf(level)]}`);
} | https://github.com/DaLongZhuaZi/manxia | 3c7cc1228b941343fca3b98703402f2a45d75ff7 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/pages/TitleWindowPage.ets | arkts | createSubscriberCallBack | 创建订阅者回调 | function createSubscriberCallBack(err, data) {
subscriber = data;
//订阅公共事件
CommonEvent.subscribe(subscriber, subscribeCallBack);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createSubscriberCallBack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left err AST#identifier#Right AST#required_parameter#Right AST#,#L... | function createSubscriberCallBack(err, data) {
subscriber = data;
//订阅公共事件
CommonEvent.subscribe(subscriber, subscribeCallBack);
} | https://gitee.com/openharmony/developtools_profiler.git | 007f5c0955e48cfcd627e03676a39aa9ca8b8f77 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/DownloadManager.ets | arkts | getFileExtension | 从URL中提取文件扩展名 | private getFileExtension(url: string): string {
try {
// 移除查询参数
const urlWithoutQuery = url.split('?')[0];
// 获取最后一个路径段
const lastSegment = urlWithoutQuery.split('/').pop() || '';
// 获取扩展名
const lastDot = lastSegment.lastIndexOf('.');
if (lastDot === -1) return 'jpg';
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private getFileExtension(url: string): string {
try {
// 移除查询参数
const urlWithoutQuery = url.split('?')[0];
// 获取最后一个路径段
const lastSegment = urlWithoutQuery.split('/').pop() || '';
// 获取扩展名
const lastDot = lastSegment.lastIndexOf('.');
if (lastDot === -1) return 'jpg';
... | https://github.com/DaLongZhuaZi/manxia | 3a688119b1c9c8d4e67748702ba013af24c87fc7 | github |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getNextYear | 获取下个月的年份
@param year 年
@param month 月
@returns 下个月的年份 | static getNextYear(year: number, month: number): number {
return (month + 1 > 12) ? year + 1 : year;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNextYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb... | static getNextYear(year: number, month: number): number {
return (month + 1 > 12) ? year + 1 : year;
} | https://gitcode.com/arkui-x/samples | f508c1f7e9d09213b04fe1ba4c7783a6c434c722 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | getCacheSize | 获取缓存大小
@returns 缓存的设置数量 | public getCacheSize(): number {
return this.settingsCache.size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCacheSize 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#nu... | public getCacheSize(): number {
return this.settingsCache.size;
} | https://github.com/richshaw2015/nds | f4db0fe626d8f09c6673d7779098b98363a0964b | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test18_original_index.ets | arkts | fizzBuzz | === Round 18: FizzBuzz, Insertion sort, Caesar cipher, Prime check,
Iterative fibonacci, Binary tree insert, Fast exponentiation,
String.codePointAt, Array.isArray checks ===
--- FizzBuzz --- | function fizzBuzz(n: number): string {
let result: string = '';
for (let i: number = 1; i <= n; i++) {
let mod3: number = i % 3;
let mod5: number = i % 5;
if (mod3 === 0 && mod5 === 0) {
result = result + 'FizzBuzz';
} else if (mod3 === 0) {
result = result + 'Fizz';
} else if (mod5 ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fizzBuzz AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | function fizzBuzz(n: number): string {
let result: string = '';
for (let i: number = 1; i <= n; i++) {
let mod3: number = i % 3;
let mod5: number = i % 5;
if (mod3 === 0 && mod5 === 0) {
result = result + 'FizzBuzz';
} else if (mod3 === 0) {
result = result + 'Fizz';
} else if (mod5 ... | https://github.com/miaochiahao/ark-ghidra | 9cf9a930cb1dea52266c1117649d9595cb9ad60a | github |
HarmonyOS_Samples/guide-snippets | Ability/AppStartup/entry/src/main/ets/startup/StartupConfig.ets | arkts | onRequestCustomMatchRule | [EndExclude startup_config]
[StartExclude startup_entryconfig] | onRequestCustomMatchRule(want: Want): string {
if (want?.parameters?.fromType == 'card') {
return 'ruleCard';
}
return '';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRequestCustomMatchRule 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#identifier#Left Want AST#identifier#Right AST#)... | onRequestCustomMatchRule(want: Want): string {
if (want?.parameters?.fromType == 'card') {
return 'ruleCard';
}
return '';
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 84af7f62898628fcbff5d7c92992b6aa4b5085d5 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/ui/EnhancedCards.ets | arkts | interactive | 创建交互卡片样式 | static interactive(): CardStyle {
return new CardStyle(
CardType.INTERACTIVE,
DesignTokens.Colors.SURFACE_PRIMARY,
DesignTokens.BorderRadius.XL,
2,
DesignTokens.Colors.PRIMARY,
0.15,
{
left: DesignTokens.Spacing.XL,
right: DesignTokens.Spacing.XL,
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left interactive 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 CardStyle ... | static interactive(): CardStyle {
return new CardStyle(
CardType.INTERACTIVE,
DesignTokens.Colors.SURFACE_PRIMARY,
DesignTokens.BorderRadius.XL,
2,
DesignTokens.Colors.PRIMARY,
0.15,
{
left: DesignTokens.Spacing.XL,
right: DesignTokens.Spacing.XL,
... | https://github.com/CLMC2025/Vignette | 474fee6c692fd92d758f18328342c7d78fc7b9e1 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | appendOptionGroup | Appends the usage clause for an OptionGroup to a StringBuffer. The clause is wrapped in square brackets if the group
is required. The display of the options is handled by appendOption
@param buff the StringBuffer to append to
@param group the group to append
@see #appendOption(StringBuffer,Option,boolean) | private appendOptionGroup(buff: string, group: OptionGroup): string {
if (!(group.isRequired())) {
buff += "[";
}
let optList: JList<CliOption> = group.getOptions();
let arr: Array<CliOption> = new Array(optList.length());
for (let index = 0;index < optList.length(); index++) {
arr[ind... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendOptionGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buff AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private appendOptionGroup(buff: string, group: OptionGroup): string {
if (!(group.isRequired())) {
buff += "[";
}
let optList: JList<CliOption> = group.getOptions();
let arr: Array<CliOption> = new Array(optList.length());
for (let index = 0;index < optList.length(); index++) {
arr[ind... | https://gitee.com/openharmony-sig/commons-cli.git | a36abbf04265516ec94201bef0bfd253f41e7460 | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/viewmodel/MainViewModel.ets | arkts | getCenterGridData | Get data of the Center grid.
@return {Array<PageResource>} firstGridData. | public getCenterGridData(): Array<ItemData> {
let firstGridData: Array<ItemData> = [];
CENTER_GRID_DATA.forEach((itemData: ItemData) => {
let data: ItemData = {
title: itemData.title,
img: itemData.img,
clickPrompt: itemData.clickPrompt
};
firstGridData.push(data);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCenterGridData 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... | public getCenterGridData(): Array<ItemData> {
let firstGridData: Array<ItemData> = [];
CENTER_GRID_DATA.forEach((itemData: ItemData) => {
let data: ItemData = {
title: itemData.title,
img: itemData.img,
clickPrompt: itemData.clickPrompt
};
firstGridData.push(data);
... | https://gitee.com/harmonyos/codelabs.git | 76eedd56803565db13232d358e5cacbd6d9ba94e | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | hashPasswordWithSalt | 使用盐值验证密码 | private static async hashPasswordWithSalt(password: string, storedHash: string): Promise<string> {
try {
if (!storedHash.includes(':')) {
// 旧格式兼容
const encoder = new util.TextEncoder();
const bytes = encoder.encodeInto(password);
const md = cryptoFramework.createMd('SHA256')... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left hashPasswordWithSalt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password ... | private static async hashPasswordWithSalt(password: string, storedHash: string): Promise<string> {
try {
if (!storedHash.includes(':')) {
// 旧格式兼容
const encoder = new util.TextEncoder();
const bytes = encoder.encodeInto(password);
const md = cryptoFramework.createMd('SHA256')... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7ebad37ec086b66ebebf2a08b0e59586a5e08107 | github |
the-wwyang/kids-learning-app | src/main/ets/services/LearningRecordService.ets | arkts | groupRecordsByDate | 按日期分组记录
@param records 答题记录列表
@returns 按日期分组的记录 | static groupRecordsByDate(records: AnswerRecord[]): Map<string, AnswerRecord[]> {
const grouped = new Map<string, AnswerRecord[]>();
for (const record of records) {
const date = record.timestamp.split('T')[0]; // YYYY-MM-DD
if (!grouped.has(date)) {
grouped.set(date, []);
}
gr... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left groupRecordsByDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | static groupRecordsByDate(records: AnswerRecord[]): Map<string, AnswerRecord[]> {
const grouped = new Map<string, AnswerRecord[]>();
for (const record of records) {
const date = record.timestamp.split('T')[0]; // YYYY-MM-DD
if (!grouped.has(date)) {
grouped.set(date, []);
}
gr... | https://github.com/the-wwyang/kids-learning-app | d899152288128c3b430333d9a1a861e68d47c301 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | ecmaMonthFromTime | @see ECMA-262, 21.4.1.4
@returns Month number (within year). | function ecmaMonthFromTime(time: long): byte {
let year = ecmaYearFromTime(time);
let dayWithinYear = ecmaDayFromTime(time) - ecmaDayFromYear(year);
let inLeapYear = ecmaInLeapYear(year);
for (let i = 1; i < 12; i++) {
if (dayWithinYear < getFirstDayInMonth(inLeapYear, i)) {
return... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaMonthFromTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function ecmaMonthFromTime(time: long): byte {
let year = ecmaYearFromTime(time);
let dayWithinYear = ecmaDayFromTime(time) - ecmaDayFromYear(year);
let inLeapYear = ecmaInLeapYear(year);
for (let i = 1; i < 12; i++) {
if (dayWithinYear < getFirstDayInMonth(inLeapYear, i)) {
return... | https://gitcode.com/iop123123/arkts-static-skills | ed4bc1189b1e6e4cd96a8b18a306facc6c103a20 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/19.multiplicative_expressions/02.division_operator/nan_inf.ets | arkts | main | ---
desc: Division with NaN and INF
params: {{ni.x}} / {{ni.y}} == {{ni.result}}
--- | function main(): void {
assert {{ni.x}} / {{ni.y}} == {{ni.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 {
assert {{ni.x}} / {{ni.y}} == {{ni.result}};
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 501fa5155b50a668939f76e0ea7cf2c2f92c9fda | gitee |
codelably/HCompass | core/navigation/src/main/ets/GuardManager.ets | arkts | register | 注册路由守卫
@param guard 守卫实例 | register(guard: RouteGuard): void {
// 按优先级排序插入
const priority = guard.priority ?? 100;
let insertIndex = this.guards.findIndex(g => (g.priority ?? 100) > priority);
if (insertIndex === -1) {
insertIndex = this.guards.length;
}
this.guards.splice(insertIndex, 0, guard);
this.log(`Gu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left guard AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RouteGuard AST#identifier#Right AST#)#Left ) A... | register(guard: RouteGuard): void {
// 按优先级排序插入
const priority = guard.priority ?? 100;
let insertIndex = this.guards.findIndex(g => (g.priority ?? 100) > priority);
if (insertIndex === -1) {
insertIndex = this.guards.length;
}
this.guards.splice(insertIndex, 0, guard);
this.log(`Gu... | https://github.com/codelably/HCompass | fa17943c9b04b7032aff4442c3cbda114c40d7c0 | github |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | getPartMapParameters | Get part map parameters metadata | static getPartMapParameters(target: Object, propertyKey?: string | symbol): number[] | null {
return this.getMetadata('retrofit:partMapParams', target, propertyKey) || null;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPartMapParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | static getPartMapParameters(target: Object, propertyKey?: string | symbol): number[] | null {
return this.getMetadata('retrofit:partMapParams', target, propertyKey) || null;
} | https://github.com/killetom/ktretrofit | 274936848b9ade983942dff9067ca99fdbda4dc6 | github |
codelably/HCompass | core/navigation/src/main/ets/NavigationService.ets | arkts | popTo | 返回到指定路由
@param name 目标路由名称
@param inclusive 是否移除目标自身 | popTo(name: string, inclusive: boolean = false): void {
if (!this.stack) {
return;
}
try {
this.stack.popToName(name, inclusive);
this.log(`Popped to: ${name}`);
} catch (err) {
this.logError(`Pop to failed: ${JSON.stringify(err)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left popTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig... | popTo(name: string, inclusive: boolean = false): void {
if (!this.stack) {
return;
}
try {
this.stack.popToName(name, inclusive);
this.log(`Popped to: ${name}`);
} catch (err) {
this.logError(`Pop to failed: ${JSON.stringify(err)}`);
}
} | https://github.com/codelably/HCompass | c80090a5338a9549e778f47eb4a4f37bf71f4804 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets | arkts | searchAll | 使用所有启用的规则搜索 | async searchAll(word: string): Promise<DictSearchResult[]> {
const enabledRules = this.getEnabledRules();
const results: DictSearchResult[] = [];
for (const rule of enabledRules) {
const result = await this.searchWithRule(rule, word);
results.push(result);
}
return results;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left word AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async searchAll(word: string): Promise<DictSearchResult[]> {
const enabledRules = this.getEnabledRules();
const results: DictSearchResult[] = [];
for (const rule of enabledRules) {
const result = await this.searchWithRule(rule, word);
results.push(result);
}
return results;
} | https://github.com/DaLongZhuaZi/manxia | 30520bd1629ac821515c02bf5415c9d61a6a6e7b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | getCachedSourceIconPath | 获取缓存的图源图标路径(如果已缓存) | public getCachedSourceIconPath(sourceId: string, iconUrl: string): string | null {
try {
const cachePath = this.getSourceIconCachePath(sourceId, iconUrl);
if (!this.isReadableFile(cachePath)) {
return null;
}
return cachePath;
} catch (_error) {
return null;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCachedSourceIconPath 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 A... | public getCachedSourceIconPath(sourceId: string, iconUrl: string): string | null {
try {
const cachePath = this.getSourceIconCachePath(sourceId, iconUrl);
if (!this.isReadableFile(cachePath)) {
return null;
}
return cachePath;
} catch (_error) {
return null;
}
} | https://github.com/DaLongZhuaZi/manxia | 931c157ad6714bbd6b7101e75016903d878532ef | github |
bhengubv/aether-protocol | arkts/src/main/ets/incentive/TipPacketPayload.ets | arkts | readString | Reads a string field, returning '' when absent or not a string. | function readString(obj: Record<string, ESObject>, key: string): string {
const v: ESObject = obj[key];
return typeof v === 'string' ? v as string : '';
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left readString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left obj AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function readString(obj: Record<string, ESObject>, key: string): string {
const v: ESObject = obj[key];
return typeof v === 'string' ? v as string : '';
} | https://github.com/bhengubv/aether-protocol | f5455afa3edaf01af44f72b0d796e3a5bafa86c4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | reduce | Reduces data into a single value using left-to-right traversal
@param fn condition
@param init initial value
@returns reduction result | public reduce(fn: (acc: byte, curVal: byte, curIndex: int, array: Int8Array) => byte, init: byte): byte {
let acc = init
for (let i = 0; i < this.length; ++i) {
acc = fn(acc, this.at(i), i, this)
}
return acc
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public reduce(fn: (acc: byte, curVal: byte, curIndex: int, array: Int8Array) => byte, init: byte): byte {
let acc = init
for (let i = 0; i < this.length; ++i) {
acc = fn(acc, this.at(i), i, this)
}
return acc
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b8477a6a514ca2d1bfd6f1f8293d4c2e34d80401 | gitee |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_overload/user/main.ets | arkts | testLong | 测试 long (i64) | function testLong() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc((1000000).toLong(), (1000000).toLong());
arktest.assertEQ(res, 1000000);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLong 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_declaratio... | function testLong() {
let instance: test_overload.OverloadInterface =
test_overload.get_interface();
let res = instance.overloadFunc((1000000).toLong(), (1000000).toLong());
arktest.assertEQ(res, 1000000);
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | a6bad1c3907b8d90cb3499b9829fd1eaeed40e29 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | getCenterCircleBox | returns the center of the circlebox
@return | public getCenterCircleBox(): MPPointF {
return MPPointF.getInstance(this.mCircleBox.centerX(), this.mCircleBox.centerY());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCenterCircleBox 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 MPP... | public getCenterCircleBox(): MPPointF {
return MPPointF.getInstance(this.mCircleBox.centerX(), this.mCircleBox.centerY());
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7b9479157d78a68fff8b191011a4bf1b25ae4ef3 | gitee |
who7708/harmonyos-codelabs | ImageEdit/entry/src/main/ets/utils/AdjustUtil.ets | arkts | rgb2hsv | RGB transform to HSV.
@param red 0- 255.
@param green 0- 255.
@param blue 0- 255.
@return h (0 - 360) s(0 - 100) v (0 - 100). | function rgb2hsv(red: number, green: number, blue: number) {
let hsvH: number = 0, hsvS: number = 0, hsvV: number = 0;
const rgbR: number = colorTransform(red);
const rgbG: number = colorTransform(green);
const rgbB: number = colorTransform(blue);
const maxValue = Math.max(rgbR, Math.max(rgbG, rgbB));
const... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left rgb2hsv AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left red AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function rgb2hsv(red: number, green: number, blue: number) {
let hsvH: number = 0, hsvS: number = 0, hsvV: number = 0;
const rgbR: number = colorTransform(red);
const rgbG: number = colorTransform(green);
const rgbB: number = colorTransform(blue);
const maxValue = Math.max(rgbR, Math.max(rgbG, rgbB));
const... | https://github.com/who7708/harmonyos-codelabs | 04a4e731e8135fefd4f8f55ed4248e72449101f4 | github |
LZZLHY/hlib | entry/src/main/ets/utils/PublicDownloadDir.ets | arkts | isTabletSilent | 平板 / 2in1 静默路线是否可用(syscap)。 | static isTabletSilent(): boolean {
return canIUse('SystemCapability.FileManagement.File.Environment.FolderObtain');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isTabletSilent 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... | static isTabletSilent(): boolean {
return canIUse('SystemCapability.FileManagement.File.Environment.FolderObtain');
} | https://github.com/LZZLHY/hlib | 779f1b87d5c97ae292e4efc12f3da9c21f09db9f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Editor/FileEditorService.ets | arkts | createSession | 创建独立编辑会话 | public createSession(params: FileEditorOpenParams): FileEditorSessionInfo {
const now = Date.now();
const instanceId = params.instanceId && params.instanceId.length > 0
? params.instanceId
: this.createInstanceId();
const sessionId = params.sessionId && params.sessionId.length > 0
? para... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public createSession(params: FileEditorOpenParams): FileEditorSessionInfo {
const now = Date.now();
const instanceId = params.instanceId && params.instanceId.length > 0
? params.instanceId
: this.createInstanceId();
const sessionId = params.sessionId && params.sessionId.length > 0
? para... | https://github.com/DaLongZhuaZi/manxia | 693cb920ab88487b4574e1662c428d219ba98bcc | github |
openharmony/applications_mms | entry/src/main/ets/utils/TelephoneUtil.ets | arkts | dealTelephoneSort | Mobile number, sorted in ascending order.
@param telephone
@return | dealTelephoneSort(telephone) {
if (telephone == null || telephone == common.string.EMPTY_STR) {
return common.string.EMPTY_STR;
}
let result = common.string.EMPTY_STR;
let telephones = telephone.split(common.string.COMMA);
// If there is only one mobile number, no... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left dealTelephoneSort AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left telephone AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right ... | dealTelephoneSort(telephone) {
if (telephone == null || telephone == common.string.EMPTY_STR) {
return common.string.EMPTY_STR;
}
let result = common.string.EMPTY_STR;
let telephones = telephone.split(common.string.COMMA);
// If there is only one mobile number, no... | https://gitee.com/openharmony/applications_mms.git | c047c9c2e0f01941c5a03014bee67e0b7b92855a | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/TaskDao.ets | arkts | queryById | 根据 ID 查询任务
@param id 任务 ID
@returns Promise<Record<string, any> | null> 任务记录或 null | async queryById(id: number): Promise<Record<string, number | string | boolean> | null> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return null;
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName)... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async queryById(id: number): Promise<Record<string, number | string | boolean> | null> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return null;
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName)... | https://github.com/Kira-Yagami-Light/Kira-Projects | f509ff9fab7f03012dbe0fe3c490d35ee9aade84 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets | arkts | getStatusText | 获取当前状态描述(用于性能面板显示) | getStatusText(): string {
if (!this.enabled) return '';
let mode: string;
if (this.serverSupported && this.serverEnableRetries === 0) {
mode = 'server';
} else if (this.serverSupported && this.serverEnableRetries > 0) {
mode = 'connecting';
} else {
mode = 'local';
}
retu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatusText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen... | getStatusText(): string {
if (!this.enabled) return '';
let mode: string;
if (this.serverSupported && this.serverEnableRetries === 0) {
mode = 'server';
} else if (this.serverSupported && this.serverEnableRetries > 0) {
mode = 'connecting';
} else {
mode = 'local';
}
retu... | https://github.com/AlkaidLab/moonlight-harmony | 50cc0d4f5ecabe3e965deaa8a52377880c648eba | github |
offlinecat-dev/OCNetORM | src/main/ets/core/HooksProcessor.ets | arkts | hasAfterLoadHook | 检查实体是否有 afterLoad 钩子
@param entityName 实体名称
@returns 是否有 afterLoad 钩子 | hasAfterLoadHook(entityName: string): boolean {
return this.hasHook(entityName, 'afterLoad')
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAfterLoadHook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) ... | hasAfterLoadHook(entityName: string): boolean {
return this.hasHook(entityName, 'afterLoad')
} | https://github.com/offlinecat-dev/OCNetORM | d54272273772153c00914c9de512e4428ba14de5 | github |
Cool_foolisher1/ArkTSRepository | MultiCalculator/common/src/main/ets/utils/CheckEmptyUtil.ets | arkts | isEmpty | 检查对象是否为空 | public isEmpty(obj: object | string): boolean {
return (typeof obj === 'undefined' || obj === null || obj === '')
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AS... | public isEmpty(obj: object | string): boolean {
return (typeof obj === 'undefined' || obj === null || obj === '')
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 6a91b6fcda2be0efdba55e759b467add95ec0c73 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/list/ListDemo5.ets | arkts | <arrow> | 自定义 ForEach() 的键值生成逻辑
根据打印的日志理解
本例的 List 永远都只会渲染 5 个 item 且每个 item 的显示内容不变
即使点击本例的按钮,在位置 0 处添加一项后,也只会渲染 5 个 item 且每个 item 的显示内容不变(item 的顺序可能会有变化)
开发时要注意这个问题
所以,实际开发时建议用每个 item 的唯一标识做键值 | (item: number) => {
return (item % 5).toString()
}) | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#number#Left number AST#number#Right AST#predefined_type#Rig... | (item: number) => {
return (item % 5).toString()
}) | https://github.com/webabcd/HarmonyDemo | 65145225a1d1f83f7f5326b435bdb689c658e6b9 | github |
arkui-x/samples | CodeLab/Cases/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets | arkts | createSecuritySettingView | 创建安全设置底部弹窗视图 | @Builder
function createSecuritySettingView() {
SecuritySettingView()
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left createSecuritySettingView AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#R... | @Builder
function createSecuritySettingView() {
SecuritySettingView()
} | https://gitcode.com/arkui-x/samples | 088122ffa39db4ab49f45fe64e320bf079f48007 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/YAxisRenderer.ets | arkts | renderAxisLabels | draws the y-axis labels to the screen | public renderAxisLabels(c: CanvasRenderingContext2D, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
if (!this.mYAxis) {
return
}
if (!this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled())
return;
let positions: number[] = this.getTransformedPositions();
if (this.mAx... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left renderAxisLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ca... | public renderAxisLabels(c: CanvasRenderingContext2D, isHorizontalFlip: boolean, isLeftAxis: boolean): void {
if (!this.mYAxis) {
return
}
if (!this.mYAxis.isEnabled() || !this.mYAxis.isDrawLabelsEnabled())
return;
let positions: number[] = this.getTransformedPositions();
if (this.mAx... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 4cce72e6256babcef45ae91ec5286dab7d502709 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/components/loading/LoadingDialogUtils.ets | arkts | showSuccess | 显示 success hud
@param value 可不传 | async showSuccess(value: ResourceStr | LoadingSettings = ''): Promise<void> {
await this.showDialog(new LoadingActionOptions(LoadingState.SUCCESS, value))
this.hideDialogDelay(LoadingState.SUCCESS, value)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left showSuccess AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async showSuccess(value: ResourceStr | LoadingSettings = ''): Promise<void> {
await this.showDialog(new LoadingActionOptions(LoadingState.SUCCESS, value))
this.hideDialogDelay(LoadingState.SUCCESS, value)
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/loading/LoadingDialogUtils.ets#L56-L59 | 125ee10cc0a96f3c52805309f29b47f413bd642f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | replaceAll | The replaceAll() method returns a new string with all matches of a pattern replaced by a replacement.
The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match.
The original string is left unchanged. | public replaceAll(patten: RegExp, replacement: String) : String {
throw new Error("Not implemented");
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left patten AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Reg... | public replaceAll(patten: RegExp, replacement: String) : String {
throw new Error("Not implemented");
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 79e1cee63cddc6943104832da5d63ba6e23ee3f6 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | setUsingSliceColorAsValueLineColor | This method is deprecated.
Use setUseValueColorForLine(...) instead.
@param enabled
@Deprecated | public setUsingSliceColorAsValueLineColor(enabled: boolean): void {
this.setUseValueColorForLine(enabled);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUsingSliceColorAsValueLineColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | public setUsingSliceColorAsValueLineColor(enabled: boolean): void {
this.setUseValueColorForLine(enabled);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 111cf447f4dd7dc5d1a763e7ecc53479523b9080 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_uint.ets | arkts | main | ---
desc: check subtraction of two unsigned integers
--- | function main(): void {
const a: uint = {{v.left}}
const b: uint = {{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: uint = {{v.left}}
const b: uint = {{v.right}}
assert (a - b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b00bbb805d9ef6867b2a00255d37319fafc4e01d | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WishlistStore.ets | arkts | removeCustomWish | V0.4.7 — remove a custom wish. Refuses any wish that is not
`isCustom=true` so the parent can't accidentally drop one of the
baked-in default wishes. Returns true on success. | removeCustomWish(wishId: string): boolean {
if (wishId.length === 0) {
return false;
}
let idx: number = -1;
for (let i = 0; i < this.snap.wishes.length; i++) {
if (this.snap.wishes[i].id === wishId) {
idx = i;
break;
}
}
if (idx < 0) {
return false;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeCustomWish AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wishId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Lef... | removeCustomWish(wishId: string): boolean {
if (wishId.length === 0) {
return false;
}
let idx: number = -1;
for (let i = 0; i < this.snap.wishes.length; i++) {
if (this.snap.wishes[i].id === wishId) {
idx = i;
break;
}
}
if (idx < 0) {
return false;
... | https://github.com/terryma2024/happyword | 8a7fc8b5b291b1d2a3eabd978b7873c055b6644d | github |
openharmony/codelabs | ETSUI/Habit/entry/src/main/ets/common/bean/Category.ets | arkts | constructor | 分类也有颜色 | constructor(name: string, color: string) {
this.name = name;
this.color = color;
} | 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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | constructor(name: string, color: string) {
this.name = name;
this.color = color;
} | https://gitcode.com/openharmony/codelabs | cc62116f2031719b7bc84b52cf81b55a3db873e4 | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/util/ColorPickerUtil.ets | arkts | getBlockColor | Calculates a color based on slider position
@param value Slider value (0-100)
@returns RGBA color string | public static getBlockColor(value: number): string {
// Calculate the corresponding color based on the area of the slider.colorPercent(0-1)
if (value < 0 || value > 100) {
return ''
}
const colorPercent = value / 100 * ColorPickerUtil.COLOR_SEGMENTS;
let selectedColor: string = '';
const... | 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 getBlockColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : A... | public static getBlockColor(value: number): string {
// Calculate the corresponding color based on the area of the slider.colorPercent(0-1)
if (value < 0 || value > 100) {
return ''
}
const colorPercent = value / 100 * ColorPickerUtil.COLOR_SEGMENTS;
let selectedColor: string = '';
const... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | ddbec8a3ea17bd3586a45ca7216254a5e3e0096b | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CommentManager.ets | arkts | addComment | Add a comment | static async addComment(productId: string, username: string, content: string, avatar?: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
let serverCommentId: string = Date.now().toString();
... | 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 addComment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | static async addComment(productId: string, username: string, content: string, avatar?: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
let serverCommentId: string = Date.now().toString();
... | https://github.com/Harrisonls2004/WaterFlow | 9c195fb108f5cd2aed8de7f7dc6e4f6aa42de7db | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | storeSystemBarHeights | 获取并存储系统栏高度信息
@param windowOrContext 可以传入Window实例或UIContext | static storeSystemBarHeights(windowOrContext?: window.Window | UIContext): void {
try {
let mainWindow: window.Window | null = null;
if (windowOrContext) {
// 使用typeof检查是否是Window实例(Window有getWindowAvoidArea方法)
const temp = windowOrContext as window.Window;
if (typeof temp.getW... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left storeSystemBarHeights AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left windowOrContext AST#identifier#Right AST#E... | static storeSystemBarHeights(windowOrContext?: window.Window | UIContext): void {
try {
let mainWindow: window.Window | null = null;
if (windowOrContext) {
// 使用typeof检查是否是Window实例(Window有getWindowAvoidArea方法)
const temp = windowOrContext as window.Window;
if (typeof temp.getW... | https://github.com/DaLongZhuaZi/manxia | 9c878df2b5a876d2d874d2d95a9d2b77af26235a | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test48_original_index.ets | arkts | circularAccess | --- Modulo wrapping (circular index) --- | function circularAccess(arr: string[], index: number): string {
let wrapped: number = index % arr.length;
if (wrapped < 0) {
wrapped = wrapped + arr.length;
}
return arr[wrapped];
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left circularAccess AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function circularAccess(arr: string[], index: number): string {
let wrapped: number = index % arr.length;
if (wrapped < 0) {
wrapped = wrapped + arr.length;
}
return arr[wrapped];
} | https://github.com/miaochiahao/ark-ghidra | a9698cc988063d78d632454359cbd768befe2d1c | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/EventSourcing.ets | arkts | shouldCreateSnapshot | 检查是否需要创建快照 | static shouldCreateSnapshot(
currentVersion: number,
lastSnapshotVersion: number,
frequency: number
): boolean {
if (frequency === SNAPSHOT_FREQUENCY_NEVER) {
return false;
}
return currentVersion - lastSnapshotVersion >= frequency;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shouldCreateSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentVersion AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numbe... | static shouldCreateSnapshot(
currentVersion: number,
lastSnapshotVersion: number,
frequency: number
): boolean {
if (frequency === SNAPSHOT_FREQUENCY_NEVER) {
return false;
}
return currentVersion - lastSnapshotVersion >= frequency;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | af15b9029ea3bd09f745912299dccdb4117ec49f | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/HttpUtil.ets | arkts | setImageBaseUrl | 设置图片服务器URL
@param imageBaseUrl 图片服务器URL | static setImageBaseUrl(imageBaseUrl: string): void {
HttpUtil.imageBaseUrl = imageBaseUrl;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setImageBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imageBaseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | static setImageBaseUrl(imageBaseUrl: string): void {
HttpUtil.imageBaseUrl = imageBaseUrl;
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | b0a99ecaf5ca1e0e4668d0361a81646893160335 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Enforcement/UnifiedDetailPageEnforcer.ets | arkts | getLastEnforcementTimestamp | 获取上次执行时间戳 | getLastEnforcementTimestamp(): number {
if (!this.settingsManager) {
return 0;
}
const timestamp = this.settingsManager.getString(EnforcementSettingKeys.LAST_ENFORCEMENT_TIMESTAMP, '0');
return parseInt(timestamp, 10) || 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastEnforcementTimestamp 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#Righ... | getLastEnforcementTimestamp(): number {
if (!this.settingsManager) {
return 0;
}
const timestamp = this.settingsManager.getString(EnforcementSettingKeys.LAST_ENFORCEMENT_TIMESTAMP, '0');
return parseInt(timestamp, 10) || 0;
} | https://github.com/DaLongZhuaZi/manxia | a93397ee9ba5b4700e8b37c5d97640e803785414 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistoryChunk.ets | arkts | deleteHistory | Delete the entries corresponding to the specified timestamp DIRECTLY from the chunk file, and then overwrite the file. Also updates this.entries and the index.
@param filePath The history chunk file path.
@param timestampsToDelete The timestamps to delete.
@author ChatGLM @ 2026 Mar 31, modified by awa_Liny. | async deleteHistory(timestampsToDelete: Set<string>) {
const startTime = Date.now();
meow(`Starts now: chunk ${this.chunkPath} (${Date.now() - startTime} ms))`, 'meowHistoryChunk][deleteHistory', meowLevel.INFO);
// Read full text.
let text = '';
try {
text = fastbuffer.from(await readArray... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left timestampsToDelete AST#identifier#Right AST#type_annotation#Left ... | async deleteHistory(timestampsToDelete: Set<string>) {
const startTime = Date.now();
meow(`Starts now: chunk ${this.chunkPath} (${Date.now() - startTime} ms))`, 'meowHistoryChunk][deleteHistory', meowLevel.INFO);
// Read full text.
let text = '';
try {
text = fastbuffer.from(await readArray... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 40532eb8f043f6680589b234023459cdd4f84eac | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/HelpCenterPage.ets | arkts | getHelpItemIcon | 图标映射表:根据帮助项 id 返回对应的系统图标 | function getHelpItemIcon(id: string): Resource {
switch (id) {
case 'quick_start':
return $r('sys.symbol.play_circle');
case 'reader_guide':
return $r('sys.symbol.book_open_fill');
case 'library_management':
return $r('sys.symbol.book_open_fill');
case 'file_import':
return $r(... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getHelpItemIcon AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function getHelpItemIcon(id: string): Resource {
switch (id) {
case 'quick_start':
return $r('sys.symbol.play_circle');
case 'reader_guide':
return $r('sys.symbol.book_open_fill');
case 'library_management':
return $r('sys.symbol.book_open_fill');
case 'file_import':
return $r(... | https://github.com/DaLongZhuaZi/manxia | 31ea32bb6b531a4e75c648965a09dd3d28514039 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from a set of type std.core.Set<int>.
@param { Set<int> } set - A set object to convert to an array.
@returns { Int16Array } - A new Int16Array
@throws { RangeError } - Input parameter error.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(set: Set<int>): Int16Array {
const length = set.size;
const result = new Int16Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('Wrong Le... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ... | public static from(set: Set<int>): Int16Array {
const length = set.size;
const result = new Int16Array(length)
let iter = set.$_iterator()
for (let i:int = 0; i < length; ++i) {
const x = iter.next()
if (x.done) {
throw new RangeError('Wrong Le... | https://gitcode.com/iop123123/arkts-static-skills | 63f614f0edf8ebc1ffde59d502d75a2092685136 | gitcode |
LZZLHY/hlib | entry/src/main/ets/viewmodel/FavoritesVM.ets | arkts | toggle | 切换收藏态。返回新状态(true=已收藏,false=已取消)。 | static async toggle(book: Book): Promise<boolean> {
const has: boolean = await FavoritesStore.has(book.id);
if (has) {
await FavoritesVM.remove(book.id);
return false;
}
await FavoritesVM.add(book);
return true;
} | 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 toggle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left book AST#identifier#Right AST#:#Left : AST#:#Righ... | static async toggle(book: Book): Promise<boolean> {
const has: boolean = await FavoritesStore.has(book.id);
if (has) {
await FavoritesVM.remove(book.id);
return false;
}
await FavoritesVM.add(book);
return true;
} | https://github.com/LZZLHY/hlib | 660425452fb6930fd9a8461f231956c885361024 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | ecmaMakeDay | @see ECMA-262, 21.4.1.15
@param year
@param month
@param date
@returns Elapsed number of days since Unix Epoch. | function ecmaMakeDay(year: long, month: long, date: long): long {
let ym = (year + floor(month.toDouble() / 12.0 as double)).toInt();
let mn = (month % 12).toByte();
if (mn < 0) {
mn += 12;
}
let days: long = ecmaDayFromYear(ym).toLong() + (getFirstDayInMonth(ecmaInLeapYear(ym), mn)).toLon... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaMakeDay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function ecmaMakeDay(year: long, month: long, date: long): long {
let ym = (year + floor(month.toDouble() / 12.0 as double)).toInt();
let mn = (month % 12).toByte();
if (mn < 0) {
mn += 12;
}
let days: long = ecmaDayFromYear(ym).toLong() + (getFirstDayInMonth(ecmaInLeapYear(ym), mn)).toLon... | https://gitcode.com/iop123123/arkts-static-skills | 99f2a3a0f9c814cab059004cac26d5e75c0cd6de | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.