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 |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets | arkts | isHighSurrogate | isHighSurrogate(char) checks if the char is a high surrogate.
@param { char } value the char to be checked.
@returns { boolean }
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isHighSurrogate(value: char): boolean {
return (Char.HIGH_SURROGATE_MIN.compareTo(value) <= 0)
&& (Char.HIGH_SURROGATE_MAX.compareTo(value) >= 0);
} | 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 isHighSurrogate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public static isHighSurrogate(value: char): boolean {
return (Char.HIGH_SURROGATE_MIN.compareTo(value) <= 0)
&& (Char.HIGH_SURROGATE_MAX.compareTo(value) >= 0);
} | https://gitcode.com/iop123123/arkts-static-skills | 4f5fecc8946ad16ff0cb8202cae0bde6433909ef | gitcode |
silence17/harmonydemo | common_lib/src/main/ets/utils/axios/HttpClient.ets | arkts | _doPost | 实际post集合
@param param 请求参数集合 | private _doPost(param: RequestParam<T>) {
if (param.showLoading) {
Utils.showLoading()
}
RequestTask.post<ResponseData<T>, null>(param.url, param.params, null)
.then(response => {
this._processServiceCommon(param, response);
}).catch(err => {
Log.error("post请求异常", err);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _doPost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres... | private _doPost(param: RequestParam<T>) {
if (param.showLoading) {
Utils.showLoading()
}
RequestTask.post<ResponseData<T>, null>(param.url, param.params, null)
.then(response => {
this._processServiceCommon(param, response);
}).catch(err => {
Log.error("post请求异常", err);
... | https://github.com/silence17/harmonydemo | d4137d56f8387db52cc7a4564675dff0a00a0c08 | github |
OHPG/FinVideo | entry/src/main/ets/player/VersionSelectStrategy.ets | arkts | selectByScore | ─── Highest / Lowest 策略 ────────────────────────────────────────────────── | private static selectByScore(sources: FinItemSource[], lowest: boolean): FinItemSource {
const sorted = [...sources].sort((a, b) => {
const heightDiff = (b.height ?? 0) - (a.height ?? 0)
if (heightDiff !== 0) return heightDiff
return (b.bitrate ?? 0) - (a.bitrate ?? 0)
})
return lowest ?... | 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 selectByScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Lef... | private static selectByScore(sources: FinItemSource[], lowest: boolean): FinItemSource {
const sorted = [...sources].sort((a, b) => {
const heightDiff = (b.height ?? 0) - (a.height ?? 0)
if (heightDiff !== 0) return heightDiff
return (b.bitrate ?? 0) - (a.bitrate ?? 0)
})
return lowest ?... | https://github.com/OHPG/FinVideo | 0c96e596a7b3764ee41ed588b9e19c6b27bc1898 | github |
bhengubv/aether-protocol | arkts/src/main/ets/incentive/TipPacketPayload.ets | arkts | toJsonBytes | Serialises to UTF-8 JSON bytes (the wire body). | toJsonBytes(): Uint8Array {
return utf8Encode(this.toJsonString());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toJsonBytes 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 Uint8Array AST#identifier#Right AST#ERROR#Right AS... | toJsonBytes(): Uint8Array {
return utf8Encode(this.toJsonString());
} | https://github.com/bhengubv/aether-protocol | 4dea0be0cb7195fa4bb61c56e3c4037cbca73322 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/language/LanguageState.ets | arkts | notifySubscribers | Notify all subscribers about layout direction change | private notifySubscribers(): void {
console.log(`[LanguageState] 📢 Notifying ${this.subscribers.length} subscribers`);
this.subscribers.forEach(cb => cb(this.currentLayoutDirection));
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifySubscribers 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#e... | private notifySubscribers(): void {
console.log(`[LanguageState] 📢 Notifying ${this.subscribers.length} subscribers`);
this.subscribers.forEach(cb => cb(this.currentLayoutDirection));
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 0d66f81a62f4b62dc73441d20e820082e6db8f82 | github |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnInputPage.ets | arkts | build | 构建输入框展示页面 | build() {
AppNavDestination({
title: "输入框",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "输入框",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | https://github.com/codelably/tuniao-ui | 3d79b21473147ac3ba81220aae084d55a1b26802 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets | arkts | codeNeedsNetwork | 检测代码是否需要网络请求
包含以下函数调用时需要使用WebView执行:
- java.ajax / java.ajaxAll - 网络请求
- java.post / java.get(url) - 网络请求
- java.connect / java.head - 网络请求
- java.startBrowserAwait / java.startBrowser - 浏览器操作
- java.webView - WebView操作
- Jsoup.connect - 网络请求 | private codeNeedsNetwork(code: string): boolean {
// 明确需要网络请求的函数模式
const networkPatterns: RegExp[] = [
/java\s*\.\s*ajax\s*\(/,
/java\s*\.\s*ajaxAll\s*\(/,
/java\s*\.\s*post\s*\(/,
/java\s*\.\s*connect\s*\(/,
/java\s*\.\s*head\s*\(/,
/java\s*\.\s*startBrowserAwait\s*\(/,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left codeNeedsNetwork AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private codeNeedsNetwork(code: string): boolean {
// 明确需要网络请求的函数模式
const networkPatterns: RegExp[] = [
/java\s*\.\s*ajax\s*\(/,
/java\s*\.\s*ajaxAll\s*\(/,
/java\s*\.\s*post\s*\(/,
/java\s*\.\s*connect\s*\(/,
/java\s*\.\s*head\s*\(/,
/java\s*\.\s*startBrowserAwait\s*\(/,
... | https://github.com/DaLongZhuaZi/manxia | 64fc49dd6b8a5a5c641f937f24a0b6544109e82b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/SandboxManager.ets | arkts | initialize | 初始化沙箱管理器 | public async initialize(context: Context, config?: Partial<StorageConfig>): Promise<void> {
try {
logger.info(TAG, '沙箱管理器开始初始化...');
if (!context) {
throw new Error('初始化时传入的Context为null');
}
this.context = context;
logger.info(TAG, '✅ Context已设置到SandboxManager');
... | 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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST... | public async initialize(context: Context, config?: Partial<StorageConfig>): Promise<void> {
try {
logger.info(TAG, '沙箱管理器开始初始化...');
if (!context) {
throw new Error('初始化时传入的Context为null');
}
this.context = context;
logger.info(TAG, '✅ Context已设置到SandboxManager');
... | https://github.com/DaLongZhuaZi/manxia | 42b3c2e1c2fc90ad5528e43fac93b6b0c698d291 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | getCookie | 获取当前用户的cookie
@returns | getCookie(): string | null {
return this.cookie;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCookie AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left... | getCookie(): string | null {
return this.cookie;
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 5ec3101807a35e15cc550ea704acbe2723f22609 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | constructor | Creates an BigUint64Array with respect to length.
@param { number } length - Number of elements
@throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / BigUint64Array.BYTES_PER_ELEMENT)) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLengthInt = this... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / BigUint64Array.BYTES_PER_ELEMENT)) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLengthInt = this... | https://gitcode.com/iop123123/arkts-static-skills | f3e6511146a922f2738efbf398149bf51bf8e2fc | gitcode |
openharmony/applications_contacts | feature/call/src/main/ets/entity/CallLog.ets | arkts | read | Configure Call Logs as Read | read() {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left read AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}#Left } AST#}#Right AST#stateme... | read() {
} | https://gitee.com/openharmony/applications_contacts.git | d72ae450b6116935c09259836567f17c805707df | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/LineRadarRenderer.ets | arkts | clipPathSupported | Clip path with hardware acceleration only working properly on API level 18 and above.
@return | private clipPathSupported(): boolean {
return Utils.getSDKInt() >= 8;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clipPathSupported 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 bool... | private clipPathSupported(): boolean {
return Utils.getSDKInt() >= 8;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7aab8115220ee16fc489c93f6af25f902411b311 | gitee |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/CameraState.ets | arkts | setZoom | 设置缩放比 | setZoom(zoom: number): void {
// 检测对焦模式是否支持
Logger.info(TAG, `setZoom is called`);
this.session?.setZoomRatio(zoom)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setZoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left zoom AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#R... | setZoom(zoom: number): void {
// 检测对焦模式是否支持
Logger.info(TAG, `setZoom is called`);
this.session?.setZoomRatio(zoom)
} | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | baa065f883ca4e37b46da9e8296c7963f6650d1a | gitee |
zmuxuny/ai-guardian-star | entry/src/main/ets/common/CloudService.ets | arkts | verifyCode | 验证验证码 | async verifyCode(target: string, code: string, username: string): Promise<CloudResult> {
const body: VerifyCodeRequest = { target: target, code: code, username: username };
return postJson('/api/verifyCode', body);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left verifyCode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left target AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async verifyCode(target: string, code: string, username: string): Promise<CloudResult> {
const body: VerifyCodeRequest = { target: target, code: code, username: username };
return postJson('/api/verifyCode', body);
} | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/CloudService.ets#L139-L142 | 5f3ca8907d445a262fd6c031d2fbe2ee6fda2f98 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | params | Gets the params portion of the URL.
@return {URLParams} Returns the params portion of the URL. | get params(): URLParams {
let p = this.cParamsLazy;
if (p == null) {
p = new URLParams(this.cSearch);
p.parentUrl = this;
this.cParamsLazy = p;
}
return p;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left params 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 URLParams AST#identifier... | get params(): URLParams {
let p = this.cParamsLazy;
if (p == null) {
p = new URLParams(this.cSearch);
p.parentUrl = this;
this.cParamsLazy = p;
}
return p;
} | https://gitcode.com/iop123123/arkts-static-skills | fd6b8f705913666a01038544c850e8490695f30c | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | startAction | Calls the OnChartGestureListener to do the start callback
@param me | public startAction(isTouchEvent: boolean, me: TouchEvent | GestureEvent) {
let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener();
if (l != null) {
l.onChartGestureStart(isTouchEvent, me, this.mLastGesture);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boo... | public startAction(isTouchEvent: boolean, me: TouchEvent | GestureEvent) {
let l: OnChartGestureListener | null = this.mChart.getOnChartGestureListener();
if (l != null) {
l.onChartGestureStart(isTouchEvent, me, this.mLastGesture);
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9b541ee99d22d296b80075cf9659bfd8dea35cb8 | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitMapStringMessage | 访问 map<string, message> 字段
JSON: object with nested object values | visitMapStringMessage(value: Map<string, Message>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
const nestedVisitor = new JsonEncodingVisitor()
nestedVisitor.recursionDepth = this.recursionDepth ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapStringMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identif... | visitMapStringMessage(value: Map<string, Message>, fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
const obj: Record<string, Object> = {}
value.forEach((v, k) => {
const nestedVisitor = new JsonEncodingVisitor()
nestedVisitor.recursionDepth = this.recursionDepth ... | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | a94f8ebb15cc3b4378b2cc24c46d62ae5d7d22e8 | gitcode |
richshaw2015/nds | ohos/entry/src/test/ThemeManager.test.ets | arkts | generateCorruptedData | 生成随机损坏的主题数据
@returns 随机的损坏数据 | function generateCorruptedData(): string {
const corruptedData = [
'', // 空字符串
' ', // 空白字符
' ', // 多个空白
'\t', // Tab 字符
'\n', // 换行... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateCorruptedData 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#prede... | function generateCorruptedData(): string {
const corruptedData = [
'', // 空字符串
' ', // 空白字符
' ', // 多个空白
'\t', // Tab 字符
'\n', // 换行... | https://github.com/richshaw2015/nds | c8d10ad5960e0d09488028e18dc4b32955ac0f8e | github |
HarmonyOS_Samples/MusicHome | products/watch/src/main/ets/watchability/WatchAbility.ets | arkts | onWindowStageDestroy | Logs when the window stage is torn down. | onWindowStageDestroy(): void {
Logger.info('WatchAbility: Ability onWindowStageDestroy');
try {
MediaService.getInstance().release();
} catch (error) {
Logger.error(`MediaService release ${JSON.stringify(error)}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy 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#stateme... | onWindowStageDestroy(): void {
Logger.info('WatchAbility: Ability onWindowStageDestroy');
try {
MediaService.getInstance().release();
} catch (error) {
Logger.error(`MediaService release ${JSON.stringify(error)}`);
}
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | f980bb91be7282ce37aa297e5310e7e738456b9d | gitcode |
Vsolon0401/MallShopping | features/home/src/main/ets/model/homeService.ets | arkts | fetchProductCateList | 获取首页商品分类 | async fetchProductCateList(parentId) {
return Request.get('/home/productCateList/'+parentId)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchProductCateList AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentId AST#identifier#Right AST#)#Left ) A... | async fetchProductCateList(parentId) {
return Request.get('/home/productCateList/'+parentId)
} | https://github.com/Vsolon0401/MallShopping | d8a4412ae10b2e4680642b96c5e9e031f27b6862 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/component/FlashSaleItem.ets | arkts | build | 构建限时精选卡片项
@returns {void} 无返回值 | build(): void {
ColumnStart({
widthValue: 120,
paddingValue: {
left: $r("app.float.space_horizontal_small"),
right: $r("app.float.space_horizontal_small"),
},
onTap: (): void => this.onItemClick(this.goods.id)
}) {
NetWorkImage({
model: this.goods.mainPic,... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnStart({
widthValue: 120,
paddingValue: {
left: $r("app.float.space_horizontal_small"),
right: $r("app.float.space_horizontal_small"),
},
onTap: (): void => this.onItemClick(this.goods.id)
}) {
NetWorkImage({
model: this.goods.mainPic,... | https://github.com/Joker-x-dev/CoolMallArkTS | 9f6cc040b8b21d6868f4967c5b4c552f4e6a79b1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | setTransparentSystemBar | 设置透明系统栏
@param mainWindow 主窗口实例 | private static setTransparentSystemBar(mainWindow: window.Window): void {
if (AppStorage.get<boolean>('window_manager_theme_bar_enabled') !== false) {
WindowManager.applyThemeAwareSystemBar(mainWindow, true);
return;
}
try {
const themeStyle = WindowManager.resolveThemeSystemBarStyle();
... | 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 setTransparentSystemBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left mainWindow AST#i... | private static setTransparentSystemBar(mainWindow: window.Window): void {
if (AppStorage.get<boolean>('window_manager_theme_bar_enabled') !== false) {
WindowManager.applyThemeAwareSystemBar(mainWindow, true);
return;
}
try {
const themeStyle = WindowManager.resolveThemeSystemBarStyle();
... | https://github.com/DaLongZhuaZi/manxia | 2a84298b749c6eb89987393d521950f21bfd210c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/TokenManager.ets | arkts | getDoctorToken | 获取医生Token | static getDoctorToken(): string | null {
return SettingsUtil.get('doctorToken');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDoctorToken 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#binary_expression#Left ... | static getDoctorToken(): string | null {
return SettingsUtil.get('doctorToken');
} | https://github.com/LJ666-ui/harmony-health-care | 736ca2ffe64eb15491cc806aee2a250748c4fcfb | github |
qiaomu8559968/FlipClock | clock_component/src/main/ets/components/FlipDigit.ets | arkts | startTopAnimation | 第一阶段动画:顶层上部向下翻转 (0 -> 90)
视觉效果:旧数字的上半部分向下折叠,露出底层的“新数字上半部分” | startTopAnimation() {
Logger.debug(`FlipDigit-startTopAnimation angleTop: ${this.angleTop}`)
animateTo({
duration: 400, // 保持与 MyFlipClock 一致
onFinish: () => {
this.startBottomAnimation()
}
}, () => {
// 这里的角度从 90 改为 -90 只是为了改变旋转方向(向外翻 vs 向里翻)
// 实际上在 rotate 属性中,正负值决定... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startTopAnimation 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#... | startTopAnimation() {
Logger.debug(`FlipDigit-startTopAnimation angleTop: ${this.angleTop}`)
animateTo({
duration: 400, // 保持与 MyFlipClock 一致
onFinish: () => {
this.startBottomAnimation()
}
}, () => {
// 这里的角度从 90 改为 -90 只是为了改变旋转方向(向外翻 vs 向里翻)
// 实际上在 rotate 属性中,正负值决定... | https://gitcode.com/qiaomu8559968/FlipClock | 965e283af93b3753442ef773811b771f8f7d10d0 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets | arkts | push | Adds an element to the queue, waiting asynchronously if full.
@param { T } el Adds an element to the queue, waiting asynchronously if full.
@returns { Promise<void> } A Promise that resolves when the element has been successfully added to the queue.
@syscap SystemCapability.Utils.Lang | public async push(el: T): Promise<void> {
ConcurrencyHelpers.mutexLock(this.mutex);
await this.waitUntilQueueIsNotFull();
this.array[this.curTailIdx] = el;
this.increaseTailIdx();
this.condVar.notifyOne();
ConcurrencyHelpers.mutexUnlock(thi... | 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 push AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left el AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS... | public async push(el: T): Promise<void> {
ConcurrencyHelpers.mutexLock(this.mutex);
await this.waitUntilQueueIsNotFull();
this.array[this.curTailIdx] = el;
this.increaseTailIdx();
this.condVar.notifyOne();
ConcurrencyHelpers.mutexUnlock(thi... | https://gitcode.com/iop123123/arkts-static-skills | 88d851db97beed524a9d8723a97a20926302fd18 | gitcode |
Goway-Hui/harmonyos-next-dev | harmonyos-next-dev/assets/login-form-template.ets | arkts | mockLogin | ==================== Mock 登录 ==================== | mockLogin(username: string, password: string): Promise<{ token: string }> {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (username && password) {
resolve({ token: 'mock_token_' + Date.now() });
} else {
reject(new Error('用户名或密码错误'));
}
}, ... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left mockLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | mockLogin(username: string, password: string): Promise<{ token: string }> {
return new Promise((resolve, reject) => {
setTimeout(() => {
if (username && password) {
resolve({ token: 'mock_token_' + Date.now() });
} else {
reject(new Error('用户名或密码错误'));
}
}, ... | https://github.com/Goway-Hui/harmonyos-next-dev | 7a6e8f5247f9bba1a019a0133b90185d6cf9d8e8 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/ThemeUtil.ets | arkts | removeThemeChangeListener | 移除主题变更监听器 | static removeThemeChangeListener(listener: (theme: ThemeType) => void): void {
const index = ThemeUtil.listeners.indexOf(listener);
if (index > -1) {
ThemeUtil.listeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left removeThemeChangeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#... | static removeThemeChangeListener(listener: (theme: ThemeType) => void): void {
const index = ThemeUtil.listeners.indexOf(listener);
if (index > -1) {
ThemeUtil.listeners.splice(index, 1);
}
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 95bc84727fdb9bb3ca1b8e2f9fd311c831db944b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | getDuplicateDetectionThreshold | 获取重复检测相似度阈值 | async getDuplicateDetectionThreshold(): Promise<number> {
return this.getNumber(SettingKeys.DUPLICATE_DETECTION_THRESHOLD, 0.5);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getDuplicateDetectionThreshold AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal... | async getDuplicateDetectionThreshold(): Promise<number> {
return this.getNumber(SettingKeys.DUPLICATE_DETECTION_THRESHOLD, 0.5);
} | https://github.com/DaLongZhuaZi/manxia | 23901e2dd979d14bae24e82ed7dd4821b6ecd3f5 | github |
azhu0001/localsend-harmony | entry/src/main/ets/utils/FileProvider.ets | arkts | deleteFile | 删除文件
@param filePath 文件路径
@returns | static async deleteFile(filePath: string): Promise<void> {
try {
await fs.unlink(filePath)
} catch (e) {
console.error(`文件删除失败: ${Errors.getErrorMessage(e)}`);
}
} | 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 deleteFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | static async deleteFile(filePath: string): Promise<void> {
try {
await fs.unlink(filePath)
} catch (e) {
console.error(`文件删除失败: ${Errors.getErrorMessage(e)}`);
}
} | https://gitcode.com/azhu0001/localsend-harmony | 883d075d7b75167603fe6c231f9f85df2ee17ffc | gitcode |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | refreshKeywordEntries | Refreshes the keyword entries. | refreshKeywordEntries() {
const entries = getKeywordEntries(this.addressBarContentMajor);
if (entries.length > 0) {
// Put the prefered keys to the beginning
let matched: [string, string][] = [];
let unmatched: [string, string][] = [];
for (let i = 0; i < entries.length; i++) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshKeywordEntries 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_bl... | refreshKeywordEntries() {
const entries = getKeywordEntries(this.addressBarContentMajor);
if (entries.length > 0) {
// Put the prefered keys to the beginning
let matched: [string, string][] = [];
let unmatched: [string, string][] = [];
for (let i = 0; i < entries.length; i++) {
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 36cc35f50b72cae7ed625bf8d9114eee0c6337ca | github |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/utils/FriendHandler.ets | arkts | handleRequest | 处理申请 (接受/拒绝) | async handleRequest(requestId: number, status: number, fromPhone: string, myPhone: string) {
// A. 更新申请状态
let predicates = new relationalStore.RdbPredicates('FriendRequest');
predicates.equalTo('id', requestId);
try {
await this.store.update({ status: status }, predicates);
// B. 如果是接受,则建... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left handleRequest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left requestId AST#identifier#Right AST#type_annotation#Left ... | async handleRequest(requestId: number, status: number, fromPhone: string, myPhone: string) {
// A. 更新申请状态
let predicates = new relationalStore.RdbPredicates('FriendRequest');
predicates.equalTo('id', requestId);
try {
await this.store.update({ status: status }, predicates);
// B. 如果是接受,则建... | https://gitcode.com/openharmony/codelabs | c73e71498881751fb80041fe372c4d0526486e2b | gitcode |
tdcare/tdwebrtc | example/MediaStreamAdvancedExample.ets | arkts | createOptimalConfig | 创建最优配置
根据设备能力动态调整分辨率、帧率等参数 | private createOptimalConfig(codec: string): MediaStreamConfig {
const isLowEndDevice = !isCodecSupported('H264');
if (isLowEndDevice) {
// 低端设备配置
console.log('[MediaStreamExample] 检测到低端设备,使用降级配置');
return {
video: {
enabled: true,
width: 352, // CIF
h... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createOptimalConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left codec AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private createOptimalConfig(codec: string): MediaStreamConfig {
const isLowEndDevice = !isCodecSupported('H264');
if (isLowEndDevice) {
// 低端设备配置
console.log('[MediaStreamExample] 检测到低端设备,使用降级配置');
return {
video: {
enabled: true,
width: 352, // CIF
h... | https://github.com/tdcare/tdwebrtc | 04970dce69d80bf77a9543e70095f6481e3f0b8b | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets | arkts | getLowerKey | Return the lower key of the given key's element in the TreeMap
@param key: the key of the element which will be get the lower key
@returns the lower key of the given key's element if exists or undefined | getLowerKey(key: K): K | undefined {
this.checkEmptyContainer();
let resultEntry: TreeMapEntry<K, V> | undefined = undefined;
let entry = this.rootEntry;
while(entry !== undefined) {
if (this.comparator!(entry!.key, key) > 0) {
resultEntry = entry;
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLowerKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Ri... | getLowerKey(key: K): K | undefined {
this.checkEmptyContainer();
let resultEntry: TreeMapEntry<K, V> | undefined = undefined;
let entry = this.rootEntry;
while(entry !== undefined) {
if (this.comparator!(entry!.key, key) > 0) {
resultEntry = entry;
... | https://gitcode.com/iop123123/arkts-static-skills | 4c690bf052d8156a5704c955e98656534ee9aabe | gitcode |
PollenWang6/HiXD | entry/src/main/ets/pages/schoolcard/SchoolCardPage.ets | arkts | pickDate | 日期选择器 | pickDate(kind: number): void { // 0=开始, 1=结束
this.activePreset = -1;
const curDate = this.parseDate(kind === 0 ? this.beginDate : this.endDate);
DatePickerDialog.show({
start: new Date('2022-01-01'),
end: new Date(),
selected: curDate,
lunar: false,
onAccept: (value: DatePick... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pickDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kind AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#... | pickDate(kind: number): void { // 0=开始, 1=结束
this.activePreset = -1;
const curDate = this.parseDate(kind === 0 ? this.beginDate : this.endDate);
DatePickerDialog.show({
start: new Date('2022-01-01'),
end: new Date(),
selected: curDate,
lunar: false,
onAccept: (value: DatePick... | https://github.com/PollenWang6/HiXD | 886a927b09e328ec47042f2b7140a6fb4def0305 | github |
openharmony-sig/ohos_react_native | tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNAbility.ets | arkts | onWindowStageSetup | Override this method if, for example, you want to customize loading behavior. | protected async onWindowStageSetup(windowStage: window.WindowStage) {
windowStage.loadContent(this.getPagePath(), (err, data) => {
const logger = this.logger.clone("onLoadContent")
if (err.code) {
logger.error("Failed to load the content", err.code)
return;
}
logger.info("S... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left onWindowStageSetup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#... | protected async onWindowStageSetup(windowStage: window.WindowStage) {
windowStage.loadContent(this.getPagePath(), (err, data) => {
const logger = this.logger.clone("onLoadContent")
if (err.code) {
logger.error("Failed to load the content", err.code)
return;
}
logger.info("S... | https://gitee.com/openharmony-sig/ohos_react_native.git | f11da854cdf84e434fffc9150583269e7337e24b | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SmartBudgetPlan.ets | arkts | createDefaultConfig | 创建默认预测配置 | static createDefaultConfig(): ForecastEngineConfig {
const config: ForecastEngineConfig = {
algorithm: FORECAST_ENSEMBLE,
windowSize: 6,
alpha: 0.3,
beta: 0.1,
gamma: 0.2,
seasonalPeriod: 12,
confidenceLevel: 0.95,
minDataPoints: 12
};
return config;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefaultConfig 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 Fo... | static createDefaultConfig(): ForecastEngineConfig {
const config: ForecastEngineConfig = {
algorithm: FORECAST_ENSEMBLE,
windowSize: 6,
alpha: 0.3,
beta: 0.1,
gamma: 0.2,
seasonalPeriod: 12,
confidenceLevel: 0.95,
minDataPoints: 12
};
return config;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 9eca3464f012708e3f4278b717571f4f61b85e43 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | set | Copies all elements of arr to the current BigUint64Array starting from insertPos.
@param arr array to copy data from
@param insertPos start index where data from arr will be inserted
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} | public set(arr: BigInt[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: BigInt[]): size of arr is greater than BigUint64Array.length")
}
for (let ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: BigInt[], insertPos1: number): void {
const insertPos = insertPos1 as int
if (insertPos < 0 || insertPos + arr.length > this.length) {
throw new RangeError("set(insertPos: int, arr: BigInt[]): size of arr is greater than BigUint64Array.length")
}
for (let ... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | eddaa593f4fe724bf5019f092860df6984b5ec59 | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/ParentalControlService.ets | arkts | startSession | 启动学习会话 | public startSession(): void {
this.sessionStartTime = Date.now();
this.currentSessionMinutes = 0;
console.info('ParentalControlService: 会话开始');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left startSession 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#expressio... | public startSession(): void {
this.sessionStartTime = Date.now();
this.currentSessionMinutes = 0;
console.info('ParentalControlService: 会话开始');
} | https://github.com/the-wwyang/kids-learning-app | b1e3583fa6dcd173a9218dba63923fe8fe39880e | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | appendOption | Appends the usage clause for an Option to a StringBuffer.
@param buff the StringBuffer to append to
@param option the Option to append
@param required whether the Option is required or not | private appendOption(option: CliOption, required: boolean): string {
let buff = "";
if (!required) {
buff += "[";
}
if (option.getOpt() != null) {
buff += "-" + option.getOpt();
} else {
buff += "--" + option.getLongOpt();
}
// if the Option has a value and a non blank ar... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private appendOption(option: CliOption, required: boolean): string {
let buff = "";
if (!required) {
buff += "[";
}
if (option.getOpt() != null) {
buff += "-" + option.getOpt();
} else {
buff += "--" + option.getLongOpt();
}
// if the Option has a value and a non blank ar... | https://gitee.com/openharmony-sig/commons-cli.git | 166a165911fd22a24ea703cc4965f1b90cae6d9e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/DatabaseManager.ets | arkts | close | 关闭数据库 | public async close(): Promise<void> {
if (this.store) {
try {
await this.store.close();
this.store = null;
this.isInitialized = false;
logger.info(TAG, '数据库已关闭');
} catch (error) {
logger.error(TAG, `关闭数据库失败: ${String(error)}`);
throw error as Error;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left close AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A... | public async close(): Promise<void> {
if (this.store) {
try {
await this.store.close();
this.store = null;
this.isInitialized = false;
logger.info(TAG, '数据库已关闭');
} catch (error) {
logger.error(TAG, `关闭数据库失败: ${String(error)}`);
throw error as Error;
... | https://github.com/DaLongZhuaZi/manxia | a7d16e65fe7156208d570f1274f40c4c45acd3a7 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | md5 | 计算指定数据的 md5 哈希值 | public static md5(data: Uint8Array): Uint8Array {
let md5 = cryptoFramework.createMd('MD5');
md5.updateSync({ data: data });
let md5Result = md5.digestSync();
return md5Result.data
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left md5 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#ide... | public static md5(data: Uint8Array): Uint8Array {
let md5 = cryptoFramework.createMd('MD5');
md5.updateSync({ data: data });
let md5Result = md5.digestSync();
return md5Result.data
} | https://github.com/webabcd/HarmonyDemo | 1c3517d5e0438d88aec786fabc7700779e52a133 | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V30.ets | arkts | getNonEmptyLine | vCard 3.0 requires that the line with space at the beginning of the line
must be combined with previous line. | protected getNonEmptyLine():string {
let line:string|null;
let builder:StringBuilder|null = null;
while ((line = this.mReader!.nextLine()) != null) {
// Skip empty lines in order to accommodate implementations that
// send line termination variations such as \r\r\n.
... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getNonEmptyLine 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 s... | protected getNonEmptyLine():string {
let line:string|null;
let builder:StringBuilder|null = null;
while ((line = this.mReader!.nextLine()) != null) {
// Skip empty lines in order to accommodate implementations that
// send line termination variations such as \r\r\n.
... | https://gitee.com/openharmony-tpc/VCard.git | b8843b9892f2d2c5d82539c97e02b66b53f711dc | gitee |
Gramony/Gramony | features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets | arkts | notifyDataDelete | 通知LazyForEach组件需要在index对应索引处删除该子组件 | notifyDataDelete(index: number): void {
Logger.debug('notifyDataDelete: ' + index);
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left... | notifyDataDelete(index: number): void {
Logger.debug('notifyDataDelete: ' + index);
this.listeners.forEach(listener => {
listener.onDataDelete(index);
})
} | https://github.com/Gramony/Gramony | a78e36c04d903acd89b1c0f1757e2dc7b1f95779 | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | sendKeyEvent | 发送按键事件
@param key NDS 按键
@param isDown 是否按下 | static sendKeyEvent(key: NDSKey, isDown: boolean): void {
MelonDSNative.native.sendKeyEvent(key, isDown);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendKeyEvent 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 NDSK... | static sendKeyEvent(key: NDSKey, isDown: boolean): void {
MelonDSNative.native.sendKeyEvent(key, isDown);
} | https://github.com/richshaw2015/nds | ce9d4ff4af35d755cd9be2f7c4b173f4c4156710 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/CoffeeDao.ets | arkts | getRdbStore | 获取 rdbStore,每次操作时重新获取 | private getRdbStore(): relationalStore.RdbStore | null {
return CoffeeDatabase.getRdbStore();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRdbStore 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#binary_expression#Left ... | private getRdbStore(): relationalStore.RdbStore | null {
return CoffeeDatabase.getRdbStore();
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 9ed5550ed86eb9650cdcc156d0565fef3e31786f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/multiplication/multiplication_byte.ets | arkts | main | ---
desc: check multiplication of two bytes
--- | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{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: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a * b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 002901a5c8b8aa8038f49cff92789cbe00a9f47d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getSFWOnlineComics | [新增] 获取SFW(非NSFW)在线漫画列表
@returns Promise<OnlineComicInfo[]> SFW在线漫画列表 | public async getSFWOnlineComics(): Promise<OnlineComicInfo[]> {
try {
const records = await this.databaseManager.query(
'online_comic_info',
undefined,
'(isNSFW = ? OR isNSFW IS NULL)',
[0],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} ... | 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 getSFWOnlineComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public async getSFWOnlineComics(): Promise<OnlineComicInfo[]> {
try {
const records = await this.databaseManager.query(
'online_comic_info',
undefined,
'(isNSFW = ? OR isNSFW IS NULL)',
[0],
'lastUpdateTime DESC'
);
logger.info(TAG, `查询到 ${records.length} ... | https://github.com/DaLongZhuaZi/manxia | 48bc016231131ad390044efddce9d64760a73cc9 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/ImageFormat/ets/common/src/main/ets/common/utils/LogUtil.ets | arkts | warn | Show log in warn level.
@param args | public warn(...args: string[]): void {
hilog.warn(this.domain, this.prefix, this.format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left warn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args... | public warn(...args: string[]): void {
hilog.warn(this.domain, this.prefix, this.format, args);
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 14dae5ff2412cb568b7ec36d29190d119c93741c | github |
openharmony-sig/ohos_dataorm | entry/src/main/ets/pages/MuktiDataViewlibrary.ets | arkts | addData2 | 第二个数据库 | addData2() {
if (!this.mConvertInfo2) {
this.mConvertInfo2 = new ConvertInfo();
}
let images = new ArrayList<string>();
images.add("image1");
images.add("image2");
this.mConvertInfo2.images = images;
if (this.noteDao2) {
this.noteDao2.insert(this.mConvertInfo2);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addData2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Lef... | addData2() {
if (!this.mConvertInfo2) {
this.mConvertInfo2 = new ConvertInfo();
}
let images = new ArrayList<string>();
images.add("image1");
images.add("image2");
this.mConvertInfo2.images = images;
if (this.noteDao2) {
this.noteDao2.insert(this.mConvertInfo2);
}
} | https://gitee.com/openharmony-sig/ohos_dataorm.git | bb42f96bb7a3a1998bc9d15f892f8d81eab96b9f | gitee |
axiomaster/bonio | harmonyos/entry/src/main/ets/voice/VoiceWakeManager.ets | arkts | handleError | Handle speech recognition errors. | public handleError(errorCode: number): void {
if (this.stopRequested) return;
this._isListening = false;
// Map common error codes
switch (errorCode) {
case 1: // no match
case 6: // speech timeout
this._statusText = 'Listening';
break;
case 2: // network error
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R... | public handleError(errorCode: number): void {
if (this.stopRequested) return;
this._isListening = false;
// Map common error codes
switch (errorCode) {
case 1: // no match
case 6: // speech timeout
this._statusText = 'Listening';
break;
case 2: // network error
... | https://github.com/axiomaster/bonio | 79a69fe510ace82d374d69f687cc772952b2b1c9 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/contactlist/pages/ContactList.ets | arkts | getHeaderBuilder | Helper method to create header builder with context | getHeaderBuilder(): () => void {
return () => {
this.ManagementSectionBuilder()
}
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left getHeaderBuilder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Le... | getHeaderBuilder(): () => void {
return () => {
this.ManagementSectionBuilder()
}
} | https://github.com/Tencent-RTC/TUIKit_Harmony | a5dd2af56df9f2069cd40958c8c576a22c382b12 | github |
veaba/EsptouchForHarmony | entry/src/main/ets/esptouch/provision/APProvisioner.ets | arkts | waitForTargetWiFi | Wait for user to reconnect to the target WiFi network.
Non-fatal: returns after timeout even if not reconnected. | private async waitForTargetWiFi(ssid: string): Promise<void> {
let deadline: number = Date.now() + RECONNECT_TIMEOUT;
while (Date.now() < deadline) {
if (this.cancelled) {
return;
}
try {
let linkedInfo = await wifiManager.getLinkedInfo();
if (linkedInfo != null && li... | 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 waitForTargetWiFi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ssid AST#identifier#Right AST#:#Lef... | private async waitForTargetWiFi(ssid: string): Promise<void> {
let deadline: number = Date.now() + RECONNECT_TIMEOUT;
while (Date.now() < deadline) {
if (this.cancelled) {
return;
}
try {
let linkedInfo = await wifiManager.getLinkedInfo();
if (linkedInfo != null && li... | https://github.com/veaba/EsptouchForHarmony | 6070e42929d3ffbd4e42ac34d74e7fd01734d52a | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedMail/entry/src/main/ets/pages/MailHomePage.ets | arkts | documentSelect | Add appendix from file manager.
@param fileType | documentSelect(fileType: number): void {
try {
let DocumentSelectOptions = new picker.DocumentSelectOptions();
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult: Array<string>) => {
for (let documentSelectResultE... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left documentSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#... | documentSelect(fileType: number): void {
try {
let DocumentSelectOptions = new picker.DocumentSelectOptions();
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult: Array<string>) => {
for (let documentSelectResultE... | https://gitee.com/harmonyos/codelabs.git | be3ad5c1ff1d0ef1e65af6ab4c61a3a651063f79 | gitee |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | clearLanguage | Clear all learned data for a language (optional utility) | clearLanguage(lang: string): void {
this.models.delete(lang);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lang AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A... | clearLanguage(lang: string): void {
this.models.delete(lang);
} | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L566-L568 | d49419e00e033611bdc2c2faaccfe0e6259006a3 | github |
2763981847/Accounting-app | entry/src/main/ets/common/database/Rdb.ets | arkts | updateData | 更新数据
@param predicates - 更新数据的条件
@param data - 要更新的数据
@param callback - 更新成功后的回调函数 | updateData(predicates: relationalStore.RdbPredicates, data: relationalStore.ValuesBucket, callback: Function = () => {
}): void {
// 如果回调函数未提供,记录警告信息
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'updateData() has no callback!');
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left relationalSt... | updateData(predicates: relationalStore.RdbPredicates, data: relationalStore.ValuesBucket, callback: Function = () => {
}): void {
// 如果回调函数未提供,记录警告信息
if (!callback || typeof callback === 'undefined' || callback === undefined) {
Logger.info(CommonConstants.RDB_TAG, 'updateData() has no callback!');
... | https://github.com/2763981847/Accounting-app | f70e3267a28f4d9dac541d6992594f5cc53e8d72 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/display/TextTimerDemo.ets | arkts | applyContent | 返回指定的自定义 TextTimer | applyContent(): WrappedBuilder<[TextTimerConfiguration]> {
return wrapBuilder(buildTextTimer)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#L... | applyContent(): WrappedBuilder<[TextTimerConfiguration]> {
return wrapBuilder(buildTextTimer)
} | https://github.com/webabcd/HarmonyDemo | 3e2d16b71600ae6c6507f69965366a7b37ac4469 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | sampleMetrics | 采样其他性能指标 | private sampleMetrics(): void {
// 采样内存使用
const memoryUsed = this.getMemoryUsage();
this.metrics.memory.used = memoryUsed;
this.metrics.memory.peak = Math.max(this.metrics.memory.peak, memoryUsed);
this.metrics.memory.history.push(memoryUsed);
if (this.metrics.memory.history.length > this... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sampleMetrics 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#vo... | private sampleMetrics(): void {
// 采样内存使用
const memoryUsed = this.getMemoryUsage();
this.metrics.memory.used = memoryUsed;
this.metrics.memory.peak = Math.max(this.metrics.memory.peak, memoryUsed);
this.metrics.memory.history.push(memoryUsed);
if (this.metrics.memory.history.length > this... | https://github.com/DaLongZhuaZi/manxia | 64e0e6e85bf0398071a84993942666f4408088f8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | calculatePercentage | 计算百分比 | public calculatePercentage(part: number, total: number): number {
if (total === 0) return 0;
return Math.round((part / total) * 100);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculatePercentage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left part AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public calculatePercentage(part: number, total: number): number {
if (total === 0) return 0;
return Math.round((part / total) * 100);
} | https://github.com/DaLongZhuaZi/manxia | b7e9e9a9bb39f8fd84ccd31aacdfaee58931bea9 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateService.ets | arkts | saveAsTemplate | ==================== 模板管理 ====================
将条目保存为模板
@param entry 源条目
@param kdbx 数据库对象
@param templateName 模板名称(可选,默认使用条目标题)
@returns 创建的用户模板对象 | saveAsTemplate(entry: KdbxEntry, kdbx: Kdbx, templateName?: string): IUserTemplate | null {
try {
// 获取或创建模板分组
const templateGroup = this.getOrCreateTemplatesGroup(kdbx);
// 创建模板条目
const templateEntry = this.factory.createTemplateFromEntry(entry, templateGroup, kdbx.meta);
// 设置模板名... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left saveAsTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | saveAsTemplate(entry: KdbxEntry, kdbx: Kdbx, templateName?: string): IUserTemplate | null {
try {
// 获取或创建模板分组
const templateGroup = this.getOrCreateTemplatesGroup(kdbx);
// 创建模板条目
const templateEntry = this.factory.createTemplateFromEntry(entry, templateGroup, kdbx.meta);
// 设置模板名... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L184-L210 | f36c1df2276c4e6e9832a8ecb0949ad2bbe865f8 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | subTypeOf | T.subTypeOf(U) means that `T extends U`
subTypeOf
@param {Type} other type to check against
@returns {boolean}
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | protected subTypeOf(other: Type): boolean {
if (this.equals(other)) {
return true
} else if (other.equals(ObjectType)) {
let isNullish = (this) instanceof UndefinedType || (this) instanceof NullType
return this.isReference() && !isNullish
} else if (other ... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left subTypeOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Type AST#ide... | protected subTypeOf(other: Type): boolean {
if (this.equals(other)) {
return true
} else if (other.equals(ObjectType)) {
let isNullish = (this) instanceof UndefinedType || (this) instanceof NullType
return this.isReference() && !isNullish
} else if (other ... | https://gitcode.com/iop123123/arkts-static-skills | 0a8a0662a032fe137578337d776d48f628bb834e | gitcode |
XHXYT/Pixark | entry/src/main/ets/common/entity/DownloadTask.ets | arkts | setProgress | 设置进度 (由 ViewModel 回调触发)
@param progress 系统进度对象
@param reason 失败原因 (可选) | setProgress(progress: request.agent.Progress, reason?: string) {
this.updateProgressInfo(progress);
this.status_update_time = Date.now();
if (reason) {
this.reason = reason;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left progress AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#member_express... | setProgress(progress: request.agent.Progress, reason?: string) {
this.updateProgressInfo(progress);
this.status_update_time = Date.now();
if (reason) {
this.reason = reason;
}
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/entity/DownloadTask.ets#L89-L96 | c96c7f6437c3736b5378e0d41e5c1712f2934f83 | github |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | getInstance | 获取 Logger 单例实例
@returns Logger 实例 | static getInstance(): Logger {
return Logger.instance
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Logger AST... | static getInstance(): Logger {
return Logger.instance
} | https://github.com/offlinecat-dev/OCNetORM | 5bbb14673a0e38f8cee22b18e1f0d1a579077825 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/pages/Index/IndexPage.ets | arkts | aboutToAppear | 页面即将显示 | aboutToAppear(): void {
StyleUtil.init();
this.initializePage();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
StyleUtil.init();
this.initializePage();
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | b4f2f69dec50787bd7a7dbf137c590394f3843ad | github |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/store/MemoryStore.ets | arkts | addEvent | 添加新事件
@param item MemoryItem 对象
@returns Promise<void> | async function addEvent(item: MemoryItem): Promise<void> {
// 添加逻辑...
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left addEvent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annot... | async function addEvent(item: MemoryItem): Promise<void> {
// 添加逻辑...
} | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/store/MemoryStore.ets#L39-L41 | 53519a4d52b188d6ef6c0d7d3937b05f5394e79a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigInt64Array) => BigInt): BigInt {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = new BigInt(this.getUnsafe(... | 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 callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigInt64Array) => BigInt): BigInt {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = new BigInt(this.getUnsafe(... | https://gitcode.com/iop123123/arkts-static-skills | ca09c125ae769acbd2b91d02d96befc1f2f11db6 | gitcode |
HarmonyOS_Samples/guide-snippets | ArkData/KvStore/KvStoreSamples/entry/src/main/ets/entryability/EntryAbility.ets | arkts | checkPermissions | 权限校验入口 | async checkPermissions(): Promise<void> {
const permissions: Permissions[] = ['ohos.permission.DISTRIBUTED_DATASYNC'];
// 检查权限授予情况
let grantStatus: abilityAccessCtrl.GrantStatus = await this.checkAccessToken(permissions[0]);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkPermissions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen... | async checkPermissions(): Promise<void> {
const permissions: Permissions[] = ['ohos.permission.DISTRIBUTED_DATASYNC'];
// 检查权限授予情况
let grantStatus: abilityAccessCtrl.GrantStatus = await this.checkAccessToken(permissions[0]);
if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | f8b2ffb17a0273255b6617cdd43afd145776703d | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/AppStorageManager.ets | arkts | getAllLearningProgress | 获取所有学习进度 | public async getAllLearningProgress(): Promise<LearningProgress[]> {
if (this.dataPreferences === null || this.currentUserData === null) {
return [];
}
try {
const username = this.currentUserData.username;
const key = `${AppStorageManager.LEARNING_PROGRESS_KEY}_${username}`;
cons... | 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 getAllLearningProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public async getAllLearningProgress(): Promise<LearningProgress[]> {
if (this.dataPreferences === null || this.currentUserData === null) {
return [];
}
try {
const username = this.currentUserData.username;
const key = `${AppStorageManager.LEARNING_PROGRESS_KEY}_${username}`;
cons... | https://github.com/the-wwyang/kids-learning-app | ae8cac5441cbd686567aa01e765b4e2ad604ed82 | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | queryMessageDetail | Obtain information details.
@param telephone
@param threadId
@param callback | queryMessageDetail(telephone, threadId, callback) {
let actionData: LooseObject = {};
if (telephone != common.string.EMPTY_STR) {
actionData.telephone = telephone;
}
if (threadId != common.string.EMPTY_STR) {
actionData.threadId = threadId;
}
actionData.contactsNum = this.contactsN... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryMessageDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left telephone AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left threadId AST#identifier#Right AST#,#Left , AST#,... | queryMessageDetail(telephone, threadId, callback) {
let actionData: LooseObject = {};
if (telephone != common.string.EMPTY_STR) {
actionData.telephone = telephone;
}
if (threadId != common.string.EMPTY_STR) {
actionData.threadId = threadId;
}
actionData.contactsNum = this.contactsN... | https://gitee.com/openharmony/applications_mms.git | 753d3abb3155bfb7e3597cf9e2a126b79269c315 | gitee |
openharmony/communication_bluetooth_service | test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/BrInterfaceTest.ets | arkts | showPairFailedDialog | Show pair failed dialog | showPairFailedDialog() {
this.showPairingFailedDialog()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showPairFailedDialog 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_blo... | showPairFailedDialog() {
this.showPairingFailedDialog()
} | https://gitee.com/openharmony/communication_bluetooth_service.git | 903932333a943db5de46fc76e8df38b8549b7ce4 | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | readInt8 | Reads the next signed byte.
@returns The value. | readInt8(): number {
return this.getInt8(this.mByteOffset++)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readInt8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_blo... | readInt8(): number {
return this.getInt8(this.mByteOffset++)
} | https://gitee.com/openharmony-sig/flutter_engine.git | b2e30982126166ce61b2a1dc798de43b3887b7d6 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | executeSimple | 简单表达式求值(不依赖WebView)
用于处理简单的字符串操作和变量替换 | private executeSimple(code: string, context: JsContext): JsExecuteResult {
try {
let processedCode = code;
// 处理 cookie.removeCookie() 等副作用函数 - 直接忽略,返回空字符串
if (processedCode.includes('cookie.removeCookie') || processedCode.includes('cookie.getCookie')) {
// 提取cookie操作后面的实际代码
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeSimple AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private executeSimple(code: string, context: JsContext): JsExecuteResult {
try {
let processedCode = code;
// 处理 cookie.removeCookie() 等副作用函数 - 直接忽略,返回空字符串
if (processedCode.includes('cookie.removeCookie') || processedCode.includes('cookie.getCookie')) {
// 提取cookie操作后面的实际代码
... | https://github.com/DaLongZhuaZi/manxia | dc6cc0c41c9b0810bba1a0bbda201387bc6de181 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | addFavorite | Add a favorite | static async addFavorite(productId: string, productName: string, price: string, imageUrl: string, username: string): Promise<boolean> {
try {
console.info('FavoritesManager: Adding favorite:', productId, 'SERVER_ENABLED:', SERVER_ENABLED);
if (!FavoritesManager.preferencesInstance) {
console.... | 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 addFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async addFavorite(productId: string, productName: string, price: string, imageUrl: string, username: string): Promise<boolean> {
try {
console.info('FavoritesManager: Adding favorite:', productId, 'SERVER_ENABLED:', SERVER_ENABLED);
if (!FavoritesManager.preferencesInstance) {
console.... | https://github.com/Harrisonls2004/WaterFlow | a41aaa3c2f7d39fad965f3f300c88a3a5a0d83bd | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/MoonBridge.ets | arkts | setPerformanceModeEnabled | ==========================================================================
性能模式
==========================================================================
设置是否启用性能模式
性能模式会优化线程优先级和系统资源调度
@param enabled 是否启用 | setPerformanceModeEnabled(enabled: boolean): void {
nativeLib.setPerformanceModeEnabled(enabled);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPerformanceModeEnabled 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#Right AST#identifier#Left boolean AST#identifier#Righ... | setPerformanceModeEnabled(enabled: boolean): void {
nativeLib.setPerformanceModeEnabled(enabled);
} | https://github.com/AlkaidLab/moonlight-harmony | f130d2f6515b6e82d8b020021d327a954663462f | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets | arkts | username | Sets the username portion of the URL.
@param { string } input - The username portion of the URL. | set username(input: string) {
if (this.cHost == null || this.cHost == '' || this.cProtocol == 'file:') {
return;
}
this.urlInner.setUserName(fixIllegalString(input));
this.cUsername = this.urlInner.getUsername();
this.setHref();
... | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left username AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#iden... | set username(input: string) {
if (this.cHost == null || this.cHost == '' || this.cProtocol == 'file:') {
return;
}
this.urlInner.setUserName(fixIllegalString(input));
this.cUsername = this.urlInner.getUsername();
this.setHref();
... | https://gitcode.com/iop123123/arkts-static-skills | 9624c75d0e93954a6f13ce6b518c85de2e2b57f3 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzeComicFiles | 分析漫画文件 | private async analyzeComicFiles(): Promise<StorageItem> {
try {
const comicsPath = this.sandboxManager.getDirectory('comics');
const dirInfo = await this.getDirectoryInfo(comicsPath);
const size = dirInfo.size;
const count = dirInfo.count;
return {
type: StorageType.CO... | 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 analyzeComicFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async analyzeComicFiles(): Promise<StorageItem> {
try {
const comicsPath = this.sandboxManager.getDirectory('comics');
const dirInfo = await this.getDirectoryInfo(comicsPath);
const size = dirInfo.size;
const count = dirInfo.count;
return {
type: StorageType.CO... | https://github.com/DaLongZhuaZi/manxia | 3d151e82fd584fc7f68d23e9d1023ed6af3119c0 | github |
openharmony/arkui_ace_engine | examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets | arkts | testAnimationOptionsDuration | ===================== AnimationOptions 测试 ===================== | testAnimationOptionsDuration() {
this.addLog('=== Test: AnimationOptions.duration ===');
const durations = [100, 500, 1000, 2000, 5000, 10000];
for (const dur of durations) {
try {
const opts: AnimationOptions = { duration: dur };
const anim = new AnimatedDrawableDescriptor($r('app.m... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left testAnimationOptionsDuration 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#state... | testAnimationOptionsDuration() {
this.addLog('=== Test: AnimationOptions.duration ===');
const durations = [100, 500, 1000, 2000, 5000, 10000];
for (const dur of durations) {
try {
const opts: AnimationOptions = { duration: dur };
const anim = new AnimatedDrawableDescriptor($r('app.m... | https://gitcode.com/openharmony/arkui_ace_engine | aa9bee0897c912d2b90822f9c505a8c31f21d600 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | setHdrStateCallback | ---------------------------------------------------------------------------
回调设置
--------------------------------------------------------------------------- | setHdrStateCallback(callback: HdrStateCallback | null): void {
this.hdrStateCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHdrStateCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left HdrSt... | setHdrStateCallback(callback: HdrStateCallback | null): void {
this.hdrStateCallback = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | 796c4dce61c51b965a14f60f8c42b693b17ab286 | github |
electronicminer/Harmony-Markdown-Editor | entry/src/main/ets/components/AIChatPanel.ets | arkts | stepSummary | 生成单步的可读摘要 | stepSummary(step: AgentStep): string {
if (step.note && step.note.length > 0) {
return step.note;
}
// 行号范围描述
const range: string = (typeof step.startLine === 'number' && step.startLine > 0)
? (step.endLine && step.endLine > step.startLine ? `第 ${step.startLine}-${step.endLine} 行` : `第 ${s... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stepSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left step AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AgentStep AST#identifier#Right AST#)#Left ) ... | stepSummary(step: AgentStep): string {
if (step.note && step.note.length > 0) {
return step.note;
}
// 行号范围描述
const range: string = (typeof step.startLine === 'number' && step.startLine > 0)
? (step.endLine && step.endLine > step.startLine ? `第 ${step.startLine}-${step.endLine} 行` : `第 ${s... | https://github.com/electronicminer/Harmony-Markdown-Editor | c67ce58457b8e4017be1093e3009f28aaf6140e9 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/Category.ets | arkts | fromJson | 从 JSON 解析 | static fromJson(json: Record<string, Object>): Category {
const category = new Category();
const idVal = json['id'];
category.id = idVal !== undefined && idVal !== null ? Number(idVal.toString()) : 0;
const nameVal = json['name'];
category.name = nameVal !== undefined && nameVal !== null ? nameV... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expressio... | static fromJson(json: Record<string, Object>): Category {
const category = new Category();
const idVal = json['id'];
category.id = idVal !== undefined && idVal !== null ? Number(idVal.toString()) : 0;
const nameVal = json['name'];
category.name = nameVal !== undefined && nameVal !== null ? nameV... | https://github.com/Amaz1ny/HarmonyDO-public | 47475fa57434084fd2fdd6a8ef7e70458197abb5 | github |
CLMC2025/Vignette | entry/src/main/ets/sync/VersionControl.ets | arkts | resolveConflict | 解决版本冲突(基于时间戳) | resolveConflict(otherVersion: VersionInfo): VersionInfo {
if (this.currentVersion.timestamp > otherVersion.timestamp) {
return this.currentVersion;
} else {
return otherVersion;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resolveConflict AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left otherVersion AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left VersionInfo AST#identifier#Right AST#ERROR#Right... | resolveConflict(otherVersion: VersionInfo): VersionInfo {
if (this.currentVersion.timestamp > otherVersion.timestamp) {
return this.currentVersion;
} else {
return otherVersion;
}
} | https://github.com/CLMC2025/Vignette | 320cd8943cd2dcb1d9ed5a273929b72577cf4a33 | github |
apap6628114/nga_oh | entry/src/main/ets/common/components/post-item/PostComments.ets | arkts | filterBBTags | 过滤掉指定类型的 BBCode 节点(递归处理子节点)。
用于评论区渲染时剔除引用(QUOTE)与回复引用(POST_BY)等嵌套结构,
保留干净的评论文本。被剔除节点的子节点会一并丢弃,但保留的节点会
深拷贝并递归过滤其 children。
@param nodes - 待过滤的 BBCode 节点数组
@param skipTypes - 需要剔除的节点类型集合
@returns 过滤后的新节点数组 | function filterBBTags(nodes: BBNode[], skipTypes: BBNodeType[]): BBNode[] {
const result: BBNode[] = []
for (const node of nodes) {
if (skipTypes.indexOf(node.type) >= 0) continue
if (node.children.length > 0) {
const n = new BBNode()
n.type = node.type
n.text = node.text
n.id = node... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left filterBBTags AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nodes AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function filterBBTags(nodes: BBNode[], skipTypes: BBNodeType[]): BBNode[] {
const result: BBNode[] = []
for (const node of nodes) {
if (skipTypes.indexOf(node.type) >= 0) continue
if (node.children.length > 0) {
const n = new BBNode()
n.type = node.type
n.text = node.text
n.id = node... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/components/post-item/PostComments.ets#L21-L49 | 61b90025818b70d423993f2aba5a71417842d68d | github |
openharmony/codelabs | ETSUI/SimpleCalculator/entry/src/main/ets/common/util/CalculateUtil.ets | arkts | dealQueue | Processing expressions in queues.
@param queue Expression Queue.
@return The end result. | dealQueue(queue: Array<string>): string {
if (CheckEmptyUtil.isEmpty(queue)) {
return 'NaN';
}
let outputStack: string[] = [];
while (queue.length > 0) {
let current: string | undefined = queue.shift();
if (current !== undefined) {
if (!this.isSymbol(current)) {
out... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dealQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left queue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Array AST#i... | dealQueue(queue: Array<string>): string {
if (CheckEmptyUtil.isEmpty(queue)) {
return 'NaN';
}
let outputStack: string[] = [];
while (queue.length > 0) {
let current: string | undefined = queue.shift();
if (current !== undefined) {
if (!this.isSymbol(current)) {
out... | https://gitee.com/openharmony/codelabs.git | 05174d98ef25e84b043e5e8a7ea3fd6c1f3e11dd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | setNsfwScopeImageSource | 设置图源NSFW作用域 | public async setNsfwScopeImageSource(enabled: boolean): Promise<void> {
try {
await this.settingsManager.setBoolean(SettingKeys.NSFW_SCOPE_IMAGE_SOURCE_ENABLED, enabled);
this.nsfwScopeImageSourceEnabled = enabled;
logger.info(TAG, `图源NSFW作用域已${enabled ? '启用' : '禁用'}`);
} catch (error) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setNsfwScopeImageSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST... | public async setNsfwScopeImageSource(enabled: boolean): Promise<void> {
try {
await this.settingsManager.setBoolean(SettingKeys.NSFW_SCOPE_IMAGE_SOURCE_ENABLED, enabled);
this.nsfwScopeImageSourceEnabled = enabled;
logger.info(TAG, `图源NSFW作用域已${enabled ? '启用' : '禁用'}`);
} catch (error) {
... | https://github.com/DaLongZhuaZi/manxia | cb260742d8cda0ae10d0a1310067907b0eaffd89 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnFormViewModel.ets | arkts | submitCustomTypeForm | ==================== 自定义类型表单操作 ====================
提交自定义类型表单 | submitCustomTypeForm(): void {
this.customTypeController.validate().then((res): void => {
if (res.valid) {
const values: string = JSON.stringify(this.customTypeController.getFormValues());
this.validateResultMsg = `表单值: ${values}`;
} else {
const labels: Array<string> = res.fie... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left submitCustomTypeForm 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#stateme... | submitCustomTypeForm(): void {
this.customTypeController.validate().then((res): void => {
if (res.valid) {
const values: string = JSON.stringify(this.customTypeController.getFormValues());
this.validateResultMsg = `表单值: ${values}`;
} else {
const labels: Array<string> = res.fie... | https://github.com/codelably/tuniao-ui | 68f96e7266dc359aca4bfa0f9c80567d0a96f3d3 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/ContactListPresenter.ets | arkts | onShareItemClick | Event callback when an item is clicked in the sharing dialog box
@param item item
@param index index | onShareItemClick(item: string, index: number | null) {
HiLog.i(TAG, 'onShareItemClick !!! index is %s' + index);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onShareItemClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Ri... | onShareItemClick(item: string, index: number | null) {
HiLog.i(TAG, 'onShareItemClick !!! index is %s' + index);
} | https://gitee.com/openharmony/applications_contacts.git | f899b7e0e07117bb738a582ffee52d778206af80 | gitee |
arkui-x/samples | CodeLab/Cases/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets | arkts | dropTable | 删除表
@param tableName 表名 | async dropTable(tableName: string, targetVersion: number): Promise<void> {
if (store === undefined) {
return;
}
const deleteTableSql: string = util.format(Constants.DROP_TABLE_SQL_TEMPLATE, tableName);
try {
await store.executeSql(deleteTableSql);
} catch (err) {
logger.error(`dr... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left dropTable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AST#... | async dropTable(tableName: string, targetVersion: number): Promise<void> {
if (store === undefined) {
return;
}
const deleteTableSql: string = util.format(Constants.DROP_TABLE_SQL_TEMPLATE, tableName);
try {
await store.executeSql(deleteTableSql);
} catch (err) {
logger.error(`dr... | https://gitcode.com/arkui-x/samples | 896446bccb428aec72bb647bcf86a3c88c405f42 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | getDeviceInfo | 获取当前设备信息 | public getDeviceInfo(): DeviceInfo {
if (!this.currentDeviceInfo) {
this.updateDeviceInfo();
}
return this.currentDeviceInfo as DeviceInfo;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDeviceInfo 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 DeviceIn... | public getDeviceInfo(): DeviceInfo {
if (!this.currentDeviceInfo) {
this.updateDeviceInfo();
}
return this.currentDeviceInfo as DeviceInfo;
} | https://github.com/DaLongZhuaZi/manxia | d46f4cccd47ca53c64afc56b9f92c0951bdb0ffc | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPPerformanceManager.ets | arkts | decompressImage | 解压缩图像数据 | async decompressImage(
compressedData: ArrayBuffer,
algorithm: CompressionAlgorithm
): Promise<ArrayBuffer> {
try {
switch (algorithm) {
case CompressionAlgorithm.RLE:
return await this.decompressRLE(compressedData)
case CompressionAlgorithm.JPEG:
case Compression... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left decompressImage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left compressedData AST#identifier#Right AST#type_annotation#Left AS... | async decompressImage(
compressedData: ArrayBuffer,
algorithm: CompressionAlgorithm
): Promise<ArrayBuffer> {
try {
switch (algorithm) {
case CompressionAlgorithm.RLE:
return await this.decompressRLE(compressedData)
case CompressionAlgorithm.JPEG:
case Compression... | https://github.com/AetheriumSimulator/qemu-hmos | cf558483d81525078d1e554dfaf63f474588c7f7 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/UserDAO.ets | arkts | restore | 恢复软删除 - 使用 DAOHelper 统一方法 | static async restore(userId: number) {
await DAOHelper.restore('users', 'user_id', userId, '[UserDAO]');
} | 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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R... | static async restore(userId: number) {
await DAOHelper.restore('users', 'user_id', userId, '[UserDAO]');
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 0fb5468fdc300ee80a46e0310c1320e165fb648d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | createDataBlob | 创建 DataBlob 辅助方法 | private static createDataBlob(data: Uint8Array): cryptoFramework.DataBlob {
const blob: cryptoFramework.DataBlob = {
data: data
};
return blob;
} | 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 createDataBlob AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left ... | private static createDataBlob(data: Uint8Array): cryptoFramework.DataBlob {
const blob: cryptoFramework.DataBlob = {
data: data
};
return blob;
} | https://github.com/AlkaidLab/moonlight-harmony | 2312b8ed564368a30ce5c5982c42c7135962e603 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | toString | toString() converts Char to String object that contains a single element with the underlying char.
@returns the String representation of the Char. | public override toString(): String {
// TODO(ivan-tyulyandin): if String(char) will be implemented, rewrite code below
let buf = new char[1];
buf[0] = this.value;
return new String(buf);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): String {
// TODO(ivan-tyulyandin): if String(char) will be implemented, rewrite code below
let buf = new char[1];
buf[0] = this.value;
return new String(buf);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9c3f0bc55435aa9c758963e07bd465675ad82ad8 | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/pages/MainPage.ets | arkts | onEpisodeSearchSubmit | 执行搜索(用户点击搜索或回车) | onEpisodeSearchSubmit() {
if (this.episodeSearchKeyword && this.episodeSearchKeyword.trim() !== '') {
this.searchEpisodes();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onEpisodeSearchSubmit 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_bl... | onEpisodeSearchSubmit() {
if (this.episodeSearchKeyword && this.episodeSearchKeyword.trim() !== '') {
this.searchEpisodes();
}
} | https://github.com/pangpang20/antennaPodHM | 10751817a8a7d884316a3573f2355ca9ad067b9c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | from | Creates a new `Array` instance from an iterable object, applying a mapping function to each element.
Every value to be added to the array is first passed through this function, and `mapfn`'s return value is added
to the array instead.
@param { ArrayLike<T> | Iterable<T> } iterable An iterable or array-like object to co... | public static from<T, U>(iterable: ArrayLike<T> | Iterable<T>, mapfn: (v: T, k: int) => U): Array<U> {
const ret: Array<U> = new Array<U>()
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by unknow... | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_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#<#Left < AST#<#Right AST#identifier#Left T AST#ident... | public static from<T, U>(iterable: ArrayLike<T> | Iterable<T>, mapfn: (v: T, k: int) => U): Array<U> {
const ret: Array<U> = new Array<U>()
// NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by unknow... | https://gitcode.com/iop123123/arkts-static-skills | cb316ed1f71c480d775a4634ebfd85b81a4f9952 | gitcode |
SuperBird007/HarmonyApp_beichengyu | entry/src/main/ets/component/OptionButton.ets | arkts | getBgColor | [!code focus:start]
修改返回值类型为 ResourceColor,并返回资源引用 $r | getBgColor(): ResourceColor {
switch (this.optionStatus) {
case OptionStatus.Right:
return $r('app.color.status_success') // "#1DBF7B"
case OptionStatus.Wrong:
return $r('app.color.status_danger') // "#FA635F"
default:
return $r('app.color.bg_option_default') // '#ffd7ece... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBgColor 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 ResourceColor AST#identifier#Right AST#ERROR#Right ... | getBgColor(): ResourceColor {
switch (this.optionStatus) {
case OptionStatus.Right:
return $r('app.color.status_success') // "#1DBF7B"
case OptionStatus.Wrong:
return $r('app.color.status_danger') // "#FA635F"
default:
return $r('app.color.bg_option_default') // '#ffd7ece... | https://github.com/SuperBird007/HarmonyApp_beichengyu | 7cb4f6326f80dcdbba0b86ebb53ac1afc406cf96 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets | arkts | getEventInstancesByOriginalId | 根据原始事件ID获取所有实例 | async getEventInstancesByOriginalId(originalId: string): Promise<EventInstance[]> {
const rdbStore = await this.initDatabase();
const instances: EventInstance[] = [];
try {
const predicates = new relationalStore.RdbPredicates('event_instances');
predicates.equalTo('original_id', originalId);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEventInstancesByOriginalId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left originalId AST#identifier#Right AST#type_annotati... | async getEventInstancesByOriginalId(originalId: string): Promise<EventInstance[]> {
const rdbStore = await this.initDatabase();
const instances: EventInstance[] = [];
try {
const predicates = new relationalStore.RdbPredicates('event_instances');
predicates.equalTo('original_id', originalId);
... | https://gitcode.com/openharmony/codelabs | 2fbfd58b4cbd7ced0a2f90093f244a210691f673 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmStateManager.ets | arkts | isStopped | is current stopped | async isStopped(): Promise<boolean> {
const currentState = await this.getState();
return currentState === STATE_STOP;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isStopped 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_ty... | async isStopped(): Promise<boolean> {
const currentState = await this.getState();
return currentState === STATE_STOP;
} | https://gitee.com/openharmony-sig/applications_clock.git | 6bb879a3fdab27592d3bdee88c4cb2728b411479 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test9_original_index.ets | arkts | testArrayEverySome | --- Array every/some/map --- | function testArrayEverySome(): string {
let nums: number[] = [2, 4, 6, 8];
let allEven: boolean = nums.every((n: number): boolean => {
return n % 2 === 0;
});
let hasBig: boolean = nums.some((n: number): boolean => {
return n > 5;
});
let doubled: number[] = nums.map((n: number): number => {
ret... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayEverySome 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#predefin... | function testArrayEverySome(): string {
let nums: number[] = [2, 4, 6, 8];
let allEven: boolean = nums.every((n: number): boolean => {
return n % 2 === 0;
});
let hasBig: boolean = nums.some((n: number): boolean => {
return n > 5;
});
let doubled: number[] = nums.map((n: number): number => {
ret... | https://github.com/miaochiahao/ark-ghidra | d41a2864d8a167fb3dc288cee6a6ae0e0ae2a8a0 | github |
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets | arkts | nativeSoftInputClosed | Notifies engine softinput closed. | public static nativeSoftInputClosed(): void {
tuanjie.nativeSoftInputClosed();
} | 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 nativeSoftInputClosed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | public static nativeSoftInputClosed(): void {
tuanjie.nativeSoftInputClosed();
} | https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie | fdce7105921498afe46ee397c522f3e25237bd6e | github |
DaLongZhuaZi/manxia | tmp/ohpm_research/unrar/package/src/main/ets/components/MainPage/UnrarApi.ets | arkts | extract | 同步解压文件
path:文件包路径
dest:要解压文件存放的路径
password:密码.
string:返回值,解压成功则返回解压成功,否则返回失败 | static extract(path: string, dest: string, password?: string): string {
return unrar_napi.extract(path, dest, password);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extract 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 string A... | static extract(path: string, dest: string, password?: string): string {
return unrar_napi.extract(path, dest, password);
} | https://github.com/DaLongZhuaZi/manxia | cd07a96bbe363dc7a9510f9f170d8975bf6885ce | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets | arkts | off | Destroy event.
@param type Registered Events.
@param callback Event callback.
@since 10 | public off(type: TreeListenType, callback: ((callbackParam: CallbackParam) => void) | undefined): void {
this._events.delete(type);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left off AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | public off(type: TreeListenType, callback: ((callbackParam: CallbackParam) => void) | undefined): void {
this._events.delete(type);
} | https://gitcode.com/openharmony/arkui_ace_engine | 822d356f8f4f35535153b42886f244c6e171b6db | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.