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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony/applications_contacts | feature/call/src/main/ets/missedcall/MissedCallNotifier.ets | arkts | createWantAgentForCommonEvent | create wantAgent for common event
@param mAction
@return return the created WantAgent object. | private async createWantAgentForCommonEvent(missedCallData: MissedCallNotifyData, action?: string) {
return await WantAgent.getWantAgent({
wants: [{ action: 'contact.event.CANCEL_MISSED', parameters: {
action: action,
missedCallData: missedCallData
}, }],
actionType: WantAgent.OperationType.SE... | 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 createWantAgentForCommonEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left missedCallData AST#iden... | private async createWantAgentForCommonEvent(missedCallData: MissedCallNotifyData, action?: string) {
return await WantAgent.getWantAgent({
wants: [{ action: 'contact.event.CANCEL_MISSED', parameters: {
action: action,
missedCallData: missedCallData
}, }],
actionType: WantAgent.OperationType.SE... | https://gitee.com/openharmony/applications_contacts.git | 7f46658aabac34866ea7e929e5a519129395bdcb | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | createEmptyStringField | 创建空的字符串字段 | static createEmptyStringField(): StringField {
const result: StringField = {
value: '',
rawText: '',
confidence: 0,
hasBoundingBox: false,
boundingBoxJson: ''
};
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEmptyStringField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left... | static createEmptyStringField(): StringField {
const result: StringField = {
value: '',
rawText: '',
confidence: 0,
hasBoundingBox: false,
boundingBoxJson: ''
};
return result;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e158ded6d5c5866b3cd46d48b0f74c063b36221a | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | hasConnectedSession | Check if any session is connected | static hasConnectedSession(): boolean {
let hasConnected = false;
GlobalSessionManager.sessions.forEach((session: SessionState) => {
if (session.isConnected()) {
hasConnected = true;
}
});
return hasConnected;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasConnectedSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boole... | static hasConnectedSession(): boolean {
let hasConnected = false;
GlobalSessionManager.sessions.forEach((session: SessionState) => {
if (session.isConnected()) {
hasConnected = true;
}
});
return hasConnected;
} | https://github.com/tangwengang-del/freerdp-harmonyos | fb7652b129db7de5fdda9cba8cd02c735a362224 | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | updateItemCount | 更新物品数量(从数据库读取并更新状态) | async updateItemCount(): Promise<void> {
try {
const items = await ItemRdb.queryAll();
const newCount = items.length;
if (newCount !== this.itemCount) {
console.info(`ItemStore: 物品数量更新 ${this.itemCount} -> ${newCount}`);
this.itemCount = newCount;
this.notifyListeners();... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateItemCount 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#gene... | async updateItemCount(): Promise<void> {
try {
const items = await ItemRdb.queryAll();
const newCount = items.length;
if (newCount !== this.itemCount) {
console.info(`ItemStore: 物品数量更新 ${this.itemCount} -> ${newCount}`);
this.itemCount = newCount;
this.notifyListeners();... | https://gitcode.com/openharmony/codelabs | e69ff995642b471b55c4d99bd0fc443b1f865567 | gitcode |
codelably/HCompass | core/navigation/src/main/ets/GuardManager.ets | arkts | unregisterByName | 通过名称注销守卫
@param name 守卫名称
@returns 是否注销成功 | unregisterByName(name: string): boolean {
const index = this.guards.findIndex(g => g.name === name);
if (index !== -1) {
this.guards.splice(index, 1);
this.log(`Guard unregistered by name: ${name}`);
return true;
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | unregisterByName(name: string): boolean {
const index = this.guards.findIndex(g => g.name === name);
if (index !== -1) {
this.guards.splice(index, 1);
this.log(`Guard unregistered by name: ${name}`);
return true;
}
return false;
} | https://github.com/codelably/HCompass | 94e838b06482f039f4fab5f60782aabfddc6f581 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGRoot.ets | arkts | setSvgId | 设置SVG标签id
@param id id | public setSvgId(id: string): void{
this.attributesObj[XMLConstants.XML_ID_ATTRIBUTE] = id;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSvgId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS... | public setSvgId(id: string): void{
this.attributesObj[XMLConstants.XML_ID_ATTRIBUTE] = id;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 757b69142b4d8533c2e754fc0f281a7779574436 | gitee |
751496032/ZRouter | RouterApi/src/main/ets/api/RouterMgr.ets | arkts | redirectForResult | 携带结果重定向到指定页面
@deprecated
@see {redirectForResult2}
@param name
@param param
@param callback | public redirectForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) {
this.pop(false)
this.pushForResult<ObjectOrNull>(name, param, callback)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left redirectForResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public redirectForResult(name: string, param?: ObjectOrNull, callback?: OnPopCallback) {
this.pop(false)
this.pushForResult<ObjectOrNull>(name, param, callback)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L806-L809 | 341c956d03f2f9da0fa0faf7bd620733274fc5ca | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Diagnostics/StartupDiagnostics.ets | arkts | recordPhaseEnd | 记录启动阶段完成 | public recordPhaseEnd(phase: StartupPhase, success: boolean = true, errorMessage?: string): void {
if (!this.isMonitoring) {
return;
}
const phaseInfo = this.phases.get(phase);
if (!phaseInfo) {
logger.warn('StartupDiagnostics', `⚠️ 未找到启动阶段信息: ${phase}`);
return;
}
const en... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recordPhaseEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public recordPhaseEnd(phase: StartupPhase, success: boolean = true, errorMessage?: string): void {
if (!this.isMonitoring) {
return;
}
const phaseInfo = this.phases.get(phase);
if (!phaseInfo) {
logger.warn('StartupDiagnostics', `⚠️ 未找到启动阶段信息: ${phase}`);
return;
}
const en... | https://github.com/DaLongZhuaZi/manxia | 4cf0d4770f2b839d29c55e1db61d76320fc5bd15 | github |
PollenWang6/HiXD | entry/src/main/ets/services/DormWaterService.ets | arkts | getDeviceList | ===== 获取设备列表 ===== | async getDeviceList(): Promise<DormWaterDevice[]> {
const resp: string = await httpGet(API_BASE + '/api/v1/ui/app/master', authHeaders());
const obj: Record<string, Object> = JSON.parse(resp) as Record<string, Object>;
if (Number(obj['code']) !== 0) {
throw new Error('获取设备失败: ' + String(obj['msg'] ?... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDeviceList 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#generi... | async getDeviceList(): Promise<DormWaterDevice[]> {
const resp: string = await httpGet(API_BASE + '/api/v1/ui/app/master', authHeaders());
const obj: Record<string, Object> = JSON.parse(resp) as Record<string, Object>;
if (Number(obj['code']) !== 0) {
throw new Error('获取设备失败: ' + String(obj['msg'] ?... | https://github.com/PollenWang6/HiXD | 77026a88df9b7dd65ded0bc8b3ba138b86932a60 | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/PermissionService.ets | arkts | ensure | 确保已授权:已授权直接返回 true;否则弹窗申请,依据结果返回。 | static async ensure(context: common.UIAbilityContext, permission: Permissions): Promise<boolean> {
if (await PermissionService.isGranted(permission)) {
return true;
}
const atManager = abilityAccessCtrl.createAtManager();
try {
const data = await atManager.requestPermissionsFromUser(contex... | 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 ensure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R... | static async ensure(context: common.UIAbilityContext, permission: Permissions): Promise<boolean> {
if (await PermissionService.isGranted(permission)) {
return true;
}
const atManager = abilityAccessCtrl.createAtManager();
try {
const data = await atManager.requestPermissionsFromUser(contex... | https://github.com/picklerick422/zju-learning-assistant-OH | f45bf8ff8f86ff0a3121e742c8f9310563c7d23a | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | setLineCodeLens | ==================== CodeLens ==================== | setLineCodeLens(lineOrData: number | ArrayBuffer,
itemsOrSize?: CodeLensItem[] | number): EditorActionResult | null {
if (lineOrData instanceof ArrayBuffer) {
return CoreProtocol.decodeEditorActionResult(
native.editorSetLineCodeLens(this.handle, lineOrData, lineOrData.byteLength))... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left setLineCodeLens AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left lineOrData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right A... | setLineCodeLens(lineOrData: number | ArrayBuffer,
itemsOrSize?: CodeLensItem[] | number): EditorActionResult | null {
if (lineOrData instanceof ArrayBuffer) {
return CoreProtocol.decodeEditorActionResult(
native.editorSetLineCodeLens(this.handle, lineOrData, lineOrData.byteLength))... | https://github.com/FinalScave/SweetEditor | 4fa18442f488efd909c762caf40ffa2f296b61f8 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/entryability/EntryAbility.ets | arkts | updateWindowState | 更新窗口状态 | private updateWindowState(win: window.Window): void {
try {
// 获取当前窗口状态
const statusType = win.getWindowStatus();
hilog.info(0x0000, 'EntryAbility', '当前窗口状态: %{public}d', statusType);
this.handleWindowStatusChange(statusType);
// 获取安全区域
const avoidArea = win.getWindowAvo... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateWindowState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expre... | private updateWindowState(win: window.Window): void {
try {
// 获取当前窗口状态
const statusType = win.getWindowStatus();
hilog.info(0x0000, 'EntryAbility', '当前窗口状态: %{public}d', statusType);
this.handleWindowStatusChange(statusType);
// 获取安全区域
const avoidArea = win.getWindowAvo... | https://github.com/AetheriumSimulator/qemu-hmos | cacd9054cb60d7c96be80c5152819bf125e90d63 | github |
ActiveInsighter/HMOS-CodeLab | common/src/main/ets/util/ResourceUtil.ets | arkts | getRawFileStringByKey | Get content from the raw file resource "hmos_web_config.json" by key.
@param context The base context of an ability or an application.
@param key The Json key value.
@returns Return the value of the key. | public static getRawFileStringByKey(context: Context, key: ConfigMapKey): string {
const configStr: string | undefined = AppStorage.get(key);
if (configStr) {
return configStr;
}
try {
const result: Uint8Array = context.resourceManager.getRawFileContentSync('hmos_web_config.json');
c... | 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 getRawFileStringByKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#... | public static getRawFileStringByKey(context: Context, key: ConfigMapKey): string {
const configStr: string | undefined = AppStorage.get(key);
if (configStr) {
return configStr;
}
try {
const result: Uint8Array = context.resourceManager.getRawFileContentSync('hmos_web_config.json');
c... | https://github.com/ActiveInsighter/HMOS-CodeLab | 5b0926c916c59064458d9c506f6f331108a23dd0 | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/selection/SelectDemo.ets | arkts | applyContent | 返回指定的自定义 MenuItemContent | applyContent(): WrappedBuilder<[MenuItemConfiguration]> {
return wrapBuilder(MenuItemBuilder)
} | 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<[MenuItemConfiguration]> {
return wrapBuilder(MenuItemBuilder)
} | https://github.com/webabcd/HarmonyDemo | 6a9a261537b21c2ad25288455cf6f56bc92f1aea | github |
wodekouwei/qlog | qloglib/src/main/ets/qlog/LogSdk.ets | arkts | setUploadDependency | 设置上传依赖,调用uploadLogFiles后会将日志文件压缩成zip,压缩成功后调用该回调交给业务处理日志压缩文件,可以上传网络或者写入到本地
@param uploadDependency | public static setUploadDependency(uploadDependency: UploadDependency): void {
UploadManager.getInstance().setUploadDependency(uploadDependency);
} | 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 setUploadDependency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uploadDependency AST#identifier#Rig... | public static setUploadDependency(uploadDependency: UploadDependency): void {
UploadManager.getInstance().setUploadDependency(uploadDependency);
} | https://gitcode.com/wodekouwei/qlog | 537f2cb5efb347f3b8f3477bf05118eb0fba6693 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | setSourceNSFW | 设置书源的NSFW状态 | async setSourceNSFW(sourceId: string, isNSFW: boolean): Promise<boolean> {
const source = this.sources.get(sourceId);
if (source) {
source.isNSFW = isNSFW;
// 更新数据库
try {
const dataManager = getNovelDataManager();
await dataManager.saveSource(source);
logger.in... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setSourceNSFW AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async setSourceNSFW(sourceId: string, isNSFW: boolean): Promise<boolean> {
const source = this.sources.get(sourceId);
if (source) {
source.isNSFW = isNSFW;
// 更新数据库
try {
const dataManager = getNovelDataManager();
await dataManager.saveSource(source);
logger.in... | https://github.com/DaLongZhuaZi/manxia | 3be2229925a5881680b63e083d6c23daf503105f | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedBytes | 访问 repeated bytes 字段
JSON: array of base64 string | visitRepeatedBytes(value: Uint8Array[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.map(v => this.bytesToBase64(v)) as Object
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Uint8A... | visitRepeatedBytes(value: Uint8Array[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
this.json[fieldName] = value.map(v => this.bytesToBase64(v)) as Object
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | b8dec0402b4377ea18b0485b0c7be076599c04dc | gitcode |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | initializeSoundConfigs | 初始化音效配置 | private initializeSoundConfigs(): void {
// 按钮音效
this.registerSound({
type: SoundType.BUTTON_CLICK,
path: 'sounds/button_click.mp3',
volume: 0.6,
loop: false,
preload: true
});
this.registerSound({
type: SoundType.BUTTON_HOVER,
path: 'sounds/button_hover.mp3'... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeSoundConfigs 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 ... | private initializeSoundConfigs(): void {
// 按钮音效
this.registerSound({
type: SoundType.BUTTON_CLICK,
path: 'sounds/button_click.mp3',
volume: 0.6,
loop: false,
preload: true
});
this.registerSound({
type: SoundType.BUTTON_HOVER,
path: 'sounds/button_hover.mp3'... | https://github.com/the-wwyang/kids-learning-app | f978cc66bb1abe5f063cf84ad7e1a330ff305eb1 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/BillDAO.ets | arkts | getByUserId | 根据用户ID查询账单 | static async getByUserId(userId: number): Promise<Bill[]> {
const sql = `SELECT * FROM bills WHERE user_id = ? AND is_deleted = 0 ORDER BY transaction_date DESC`;
const rs = await DatabaseManager.getDatabase().querySql(sql, [userId]);
const list: Bill[] = [];
try {
while (rs.goToNextRow()) {
... | 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 getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST... | static async getByUserId(userId: number): Promise<Bill[]> {
const sql = `SELECT * FROM bills WHERE user_id = ? AND is_deleted = 0 ORDER BY transaction_date DESC`;
const rs = await DatabaseManager.getDatabase().querySql(sql, [userId]);
const list: Bill[] = [];
try {
while (rs.goToNextRow()) {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cab5fd25601c6dcb92e27def6505b5160d57a46a | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/GoodsRepository.ets | arkts | submitGoodsComment | 提交商品评论
@param params 评论提交请求参数
@returns 提交结果 | async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.submitGoodsComment(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitGoodsComment AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#L... | async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> {
return this.networkDataSource.submitGoodsComment(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 75278538d8d6f41aeb1f993702e24fff4e8b26b6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | saveSourceCredentials | 保存图源登录凭据(用户名/密码),存储到用户设置 | async saveSourceCredentials(sourceId: number, username: string, password: string): Promise<void> {
const key: string = `source:${String(sourceId)}:credentials`;
const value: string = JSON.stringify({ username, password });
await this.saveSetting(key, value, 'json');
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveSourceCredentials AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS... | async saveSourceCredentials(sourceId: number, username: string, password: string): Promise<void> {
const key: string = `source:${String(sourceId)}:credentials`;
const value: string = JSON.stringify({ username, password });
await this.saveSetting(key, value, 'json');
} | https://github.com/DaLongZhuaZi/manxia | 6990e227c0c7a194878bf9b84a0bb56d8a332958 | github |
richshaw2015/nds | ohos/entry/src/test/AxisDeadZoneProperty.test.ets | arkts | positiveKeyForAxis | ============================================================================
Helpers
============================================================================
Get the expected positive-direction NDS key for a given axis.
axisId 0 (horizontal): positive -> RIGHT
axisId 1 (vertical): positive -> DOWN | function positiveKeyForAxis(axisId: number): number {
return axisId === 0 ? NDSKEY_RIGHT : NDSKEY_DOWN;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left positiveKeyForAxis AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left axisId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function positiveKeyForAxis(axisId: number): number {
return axisId === 0 ? NDSKEY_RIGHT : NDSKEY_DOWN;
} | https://github.com/richshaw2015/nds | adc8224919619d08fbb1fd0fdc4fc920c6d7dc9e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | indexOf | Returns the index of the first occurrence of a value in BigInt64Array.
@param { BigInt } searchElement - The value to locate in the array.
@param { int } [fromIndex] - The array index at which to begin the search.
If fromIndex is undefined, the search starts at index 0.
@returns { int } - index of element if it present... | public indexOf(searchElement: BigInt, fromIndex?: int): int {
return this.indexOfImpl(searchElement.getLong(), fromIndex ?? 0)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left BigInt AST#iden... | public indexOf(searchElement: BigInt, fromIndex?: int): int {
return this.indexOfImpl(searchElement.getLong(), fromIndex ?? 0)
} | https://gitcode.com/iop123123/arkts-static-skills | 75965bdfa570108abcbea336343e1c0d6c388ec0 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | min | Return a new Decimal whose value is the minimum of the arguments.
@param { Value[] } n {double | string | Decimal}
@returns { Decimal } the Decimal type | static min(...values: Value[]): Decimal {
let result = new Decimal(values[0]);
for (let i = 1; i < values.length; i++) {
let other = new Decimal(values[i]);
if (other.isNaN()) {
result = other;
break;
}
if (Utils.greate... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left min 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 value... | static min(...values: Value[]): Decimal {
let result = new Decimal(values[0]);
for (let i = 1; i < values.length; i++) {
let other = new Decimal(values[i]);
if (other.isNaN()) {
result = other;
break;
}
if (Utils.greate... | https://gitcode.com/iop123123/arkts-static-skills | 88744f2188f57649f8f812eed91208877a75f90e | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | getCurrentBitrate | 获取当前码率 | getCurrentBitrate(): number {
return this.streamingSession?.getCurrentBitrate() || this.streamConfig?.bitrate || 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentBitrate 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#stat... | getCurrentBitrate(): number {
return this.streamingSession?.getCurrentBitrate() || this.streamConfig?.bitrate || 0;
} | https://github.com/AlkaidLab/moonlight-harmony | 60ea4bcc832eeb08a018e1d8d2d6e69fb4f2a4fd | github |
honjow/Next2V | shared/src/main/ets/utils/FoldScreenUtil.ets | arkts | clearCallbacks | Clear all callbacks | clearCallbacks(): void {
this.callbacks = []
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | clearCallbacks(): void {
this.callbacks = []
} | https://github.com/honjow/Next2V | 7017fec8a9901b977cce619f907f4ffa84d9708f | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BubbleComponent.ets | arkts | getBubbleRightPadding | 右部内边距
@returns | getBubbleRightPadding(): number {
const p = this.mShadowRadius + this.mBubbleBorderSize
const rightPadding =
p + (this.mShadowX > 0 ? this.mShadowX : 0) + (this.mArrowLocation == ArrowLocation.RIGHT ? this.mArrowHeight : 0)
return rightPadding + (this.mBubbleRightPadding == -1 ? this.mBubblePadding ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBubbleRightPadding 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#... | getBubbleRightPadding(): number {
const p = this.mShadowRadius + this.mBubbleBorderSize
const rightPadding =
p + (this.mShadowX > 0 ? this.mShadowX : 0) + (this.mArrowLocation == ArrowLocation.RIGHT ? this.mArrowHeight : 0)
return rightPadding + (this.mBubbleRightPadding == -1 ? this.mBubblePadding ... | https://github.com/wuba/omni-ui | c3fbca7a8c6b51dc423ee4ec95da3d368cd18a5f | github |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | unregisterDataChangeListener | 取消注册数据变化监听器 | unregisterDataChangeListener(listener: DataChangeListener): void {
let index = this.listeners.indexOf(listener);
if (index >= 0) {
// 在listeners里面,就删除
this.listeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
let index = this.listeners.indexOf(listener);
if (index >= 0) {
// 在listeners里面,就删除
this.listeners.splice(index, 1);
}
} | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | 156262cb1fdc6e08f0e25bfb452079de5f955889 | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicDownloadService.ets | arkts | getTaskInfo | 获取下载任务信息 | getTaskInfo(taskId: string): DownloadTaskInfo | undefined {
return this.downloadTasks.get(taskId);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTaskInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | getTaskInfo(taskId: string): DownloadTaskInfo | undefined {
return this.downloadTasks.get(taskId);
} | https://github.com/cpdd5201314/harmonyOS-music-app | 209f70a7d6ad0fb467ddcd5cf77ae0e13e7d884c | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyConfig.ets | arkts | _internalContent | Underscore prefix marks these as SDK-internal, integrators shouldn't
touch them (the corresponding modules are disabled). The fields stay
`protected` so they don't surface in autocomplete on a CountlyConfig
instance; CountlyInstance uses these getters to pull values during
init() (see CountlyInstance.applyCountlyConfig... | public get _internalContent(): ContentConfig { return this.content; } | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left _internalContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public get _internalContent(): ContentConfig { return this.content; } | https://github.com/Countly/countly-sdk-hos | 1947f541847f087191353877a2f4d0b60c48745a | github |
OHPG/FinVideo | entry/src/main/ets/data/Repository.ets | arkts | getMovie | 获取电影信息
@param id 电影id
@returns | public getMovie(id: string): Promise<FinItem> {
return this.requireApi().getMovie(id)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMovie AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS... | public getMovie(id: string): Promise<FinItem> {
return this.requireApi().getMovie(id)
} | https://github.com/OHPG/FinVideo | 768e2f35f109b4303f7ff7d9b54fe4a1c0f14fef | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/UnknownWordHandler.ets | arkts | getUnknownWordCount | 获取未知词汇数量 | getUnknownWordCount(): number {
return this.unknownWords.size;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUnknownWordCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#st... | getUnknownWordCount(): number {
return this.unknownWords.size;
} | https://github.com/CLMC2025/Vignette | a3ffce801315c8d3e9f8c59e47ba36b6ce13cbc4 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | fromCompactV2 | 将 v2 紧凑格式还原为 CustomKeyDef | function fromCompactV2(ck: CompactKeyV2): CustomKeyDef {
return {
id: generateKeyId(),
label: ck.l,
action: decodeAction(ck.a),
shape: (ck.s === 'c' ? 'circle' : (ck.s === 'h' ? 'hexagon' : 'rect')) as KeyShape,
behavior: (ck.b === 't' ? 'toggle' : 'momentary') as KeyBehavior,
xPercent: ck.x,
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fromCompactV2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ck AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function fromCompactV2(ck: CompactKeyV2): CustomKeyDef {
return {
id: generateKeyId(),
label: ck.l,
action: decodeAction(ck.a),
shape: (ck.s === 'c' ? 'circle' : (ck.s === 'h' ? 'hexagon' : 'rect')) as KeyShape,
behavior: (ck.b === 't' ? 'toggle' : 'momentary') as KeyBehavior,
xPercent: ck.x,
... | https://github.com/AlkaidLab/moonlight-harmony | 93d47da52c87131f845966d80f89084f3b38c3eb | github |
openharmony-sig/applications_inputmethod | entry/src/main/ets/pages/index.ets | arkts | aboutToAppear | onPageHide():void{
mxg
InputHandler.getInstance().hideKeyboardSelf();
} | aboutToAppear() : void{
var dHeight = AppStorage.Get<number>("dHeight")
if (dHeight == 1280) {
keyboardHeight = inputStyle.keyboardHeight_1280;
basicButtonWidth = inputStyle.basicButtonWidth_1280;
basicButtonHeight = inputStyle.basicButtonHeight_1280;
switchButtonWidth = inputStyle.sw... | 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{
var dHeight = AppStorage.Get<number>("dHeight")
if (dHeight == 1280) {
keyboardHeight = inputStyle.keyboardHeight_1280;
basicButtonWidth = inputStyle.basicButtonWidth_1280;
basicButtonHeight = inputStyle.basicButtonHeight_1280;
switchButtonWidth = inputStyle.sw... | https://gitee.com/openharmony-sig/applications_inputmethod.git | f43f37038352d5614becc184f6ac9ee2103577ca | gitee |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | getFormData | Get form data used to assign values to cards.
@return {formData} return form data | getFormData(listData: MovieDataBean[]): object {
if (this.isEmptyArr(listData)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'getFormData listData is empty');
return [];
}
let oneRandom: number = this.getRandomInt(listData.length);
let twoRandom: number = this.getRandomInt(oneRandom);
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left MovieDataB... | getFormData(listData: MovieDataBean[]): object {
if (this.isEmptyArr(listData)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'getFormData listData is empty');
return [];
}
let oneRandom: number = this.getRandomInt(listData.length);
let twoRandom: number = this.getRandomInt(oneRandom);
... | https://gitee.com/openharmony/codelabs.git | 316dc9f56ca91df7b6a362c09c97ab3b10ec986a | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TrackpadGestureHandler.ets | arkts | resetGestureFlags | ==================== 辅助方法 ==================== | private resetGestureFlags(): void {
this.confirmedMove = false;
this.confirmedDrag = false;
this.confirmedScroll = false;
this.distanceMoved = 0;
this.isDoubleClickDrag = false;
this.isPotentialDoubleClick = false;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetGestureFlags 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 resetGestureFlags(): void {
this.confirmedMove = false;
this.confirmedDrag = false;
this.confirmedScroll = false;
this.distanceMoved = 0;
this.isDoubleClickDrag = false;
this.isPotentialDoubleClick = false;
} | https://github.com/AlkaidLab/moonlight-harmony | a761b7a6be429d4071231e804cdedd65e1d7b344 | github |
openharmony/applications_mms | entry/src/main/ets/pages/conversation/conversationController.ets | arkts | deleteDialogShow | Delete a dialog box. | deleteDialogShow() {
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_con_tip1');
let item = this.mmsList[this.mmsIndex];
item.isShowMsgLongMenu = false
HiLog.i(TAG, 'deleteDialogShow, isShowMsgLongMenu=' + item.isShowMsgLongMenu);
this.hasLockMsg = item.isLock;
if (!item.isMsm) {... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteDialogShow 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#L... | deleteDialogShow() {
this.strMsgDeleteDialogTip = $r('app.string.msg_delete_dialog_con_tip1');
let item = this.mmsList[this.mmsIndex];
item.isShowMsgLongMenu = false
HiLog.i(TAG, 'deleteDialogShow, isShowMsgLongMenu=' + item.isShowMsgLongMenu);
this.hasLockMsg = item.isLock;
if (!item.isMsm) {... | https://gitee.com/openharmony/applications_mms.git | 58c263ddf39a6a087d2d552a21afa26baba444af | gitee |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerView.ets | arkts | updateList | 更新小图列表 | updateList(videoThumbs: ThumbContent[]) {
this.mVideoThumbOption = {
videoThumbWidth: (this.mSeekBarWidth - 2 * this.thumbWidth) / this.maxCountRange,
videoThumbs: videoThumbs
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left videoThumbs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifie... | updateList(videoThumbs: ThumbContent[]) {
this.mVideoThumbOption = {
videoThumbWidth: (this.mSeekBarWidth - 2 * this.thumbWidth) / this.maxCountRange,
videoThumbs: videoThumbs
}
} | https://github.com/openharmony/applications_app_samples | d0743f99b78b9038b7af6bc1ea00132359030445 | github |
qiuhaotc/Sunshine_HarmonyOS | entry/src/main/ets/utils/SunshineRatingSystem.ets | arkts | getStarsDisplay | 获取星级显示字符串 | static getStarsDisplay(stars: number): string {
return '⭐'.repeat(stars) + '☆'.repeat(5 - stars);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStarsDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stars AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static getStarsDisplay(stars: number): string {
return '⭐'.repeat(stars) + '☆'.repeat(5 - stars);
} | https://github.com/qiuhaotc/Sunshine_HarmonyOS | 3c0c5b060df9b9022e2ed557be14a719398e180b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorBitwiseAnd | Performs bitwise AND operation with another BigInt.
@param { BigInt } other The other BigInt.
@returns { BigInt } The result of the bitwise AND.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorBitwiseAnd(other: BigInt): BigInt {
return this.bitwiseHelper(other, (a:int, b:int) => {return (a & b)})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorBitwiseAnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public operatorBitwiseAnd(other: BigInt): BigInt {
return this.bitwiseHelper(other, (a:int, b:int) => {return (a & b)})
} | https://gitcode.com/iop123123/arkts-static-skills | 3a7719f2705b249c9caa2a87176bb4452651939f | gitcode |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | getLeftPadding | Gets the 'leftPadding'.
@return the 'leftPadding' | public getLeftPadding(): number {
return this.defaultLeftPad;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLeftPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getLeftPadding(): number {
return this.defaultLeftPad;
} | https://gitee.com/openharmony-sig/commons-cli.git | 7868b59ff8f3b0c1ec41f50b1d2ac9d29f6e3f27 | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets | arkts | getDimension | 获取尺寸资源
@param context 上下文对象
@param resId 尺寸资源ID
@returns Promise<number> 尺寸值 | public static async getDimension(context: common.UIAbilityContext, resId: number): Promise<number> {
try {
const value = await context.resourceManager.getStringValue(resId);
return parseFloat(value) || 0;
} catch (error) {
logger.warn(`Failed to get dimension resource ${resId}:`, error);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getDimension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left conte... | public static async getDimension(context: common.UIAbilityContext, resId: number): Promise<number> {
try {
const value = await context.resourceManager.getStringValue(resId);
return parseFloat(value) || 0;
} catch (error) {
logger.warn(`Failed to get dimension resource ${resId}:`, error);
... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 07ea3e3d7cd41553a9317732781a7b8f68329139 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/TypeCreator.ets | arkts | addAttributes | Sets all provided attributes to `true`
@param attrs attribute to set
@returns this | public addAttributes(attrs: int): ClassTypeCreator throws {
this.attrs.add(attrs)
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addAttributes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attrs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | public addAttributes(attrs: int): ClassTypeCreator throws {
this.attrs.add(attrs)
return this;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4e900100f3223e4bc7c3927d1aa6644fafa2a5c5 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | mapRowToCommand | 映射数据库行到命令对象 | private static mapRowToCommand(resultSet: relationalStore.ResultSet): Command {
return new Command(
DAOHelper.getString(resultSet, 'command_id'),
DAOHelper.getString(resultSet, 'command_type'),
DAOHelper.getString(resultSet, 'aggregate_type'),
DAOHelper.getLong(resultSet, 'aggregate_id'),
... | 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 mapRowToCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:... | private static mapRowToCommand(resultSet: relationalStore.ResultSet): Command {
return new Command(
DAOHelper.getString(resultSet, 'command_id'),
DAOHelper.getString(resultSet, 'command_type'),
DAOHelper.getString(resultSet, 'aggregate_type'),
DAOHelper.getLong(resultSet, 'aggregate_id'),
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7b5db63136094e140d215f3ff815d60f12eecb17 | github |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/material/pbr_clearcoat.ets | arkts | setClearcoat | [End pbr_clearcoat_changeClearcoatTexture]
Adjust clearcoat intensity
[Start pbr_clearcoat_setClearcoat] | setClearcoat(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).clearCoat.factor;
f.x = v / RESO;
(this.material as MetallicRoughnessMaterial).clearCoat.factor = f;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setClearcoat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST... | setClearcoat(v: number) {
if (this.material) {
const f: Vec4 = (this.material as MetallicRoughnessMaterial).clearCoat.factor;
f.x = v / RESO;
(this.material as MetallicRoughnessMaterial).clearCoat.factor = f;
}
} | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 64b9786d74b018af3ad2906d6d4f563b5f65eb93 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/JSRuntime.ets | arkts | hasProperty | ===================
=================== | public static hasProperty(object: Any, name: String): boolean {
JSRuntime.checkIntrinsicMethod();
} | 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 hasProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left object AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public static hasProperty(object: Any, name: String): boolean {
JSRuntime.checkIntrinsicMethod();
} | https://gitcode.com/iop123123/arkts-static-skills | 07861bf34ed1b1bdb9511050460188bbdf37dafc | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates an BigUint64Array with respect to buf.
@param buf data initializer | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / BigUint64Array.BYTES_PER_ELEMENT)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#R... | public constructor(buf: ArrayBuffer)
{
this(buf, 0, buf.byteLength / BigUint64Array.BYTES_PER_ELEMENT)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7228735d1ec1ab00753ee72b05c3996dac1477f6 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | ecmaYearFromTime | @see ECMA-262, 21.4.1.3
@returns Year, corresponding to the given time. | function ecmaYearFromTime(time: long): int {
let approx: int = (floor(time / msPerDay / 365.2425)).toInt() + 1970 as int;
let yearMs: long = ecmaDayFromYear(approx) * msPerDay;
if (yearMs > time) {
approx--;
}
if ((yearMs + ecmaDaysInYear(approx) * msPerDay) <= time) {
approx++;
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaYearFromTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function ecmaYearFromTime(time: long): int {
let approx: int = (floor(time / msPerDay / 365.2425)).toInt() + 1970 as int;
let yearMs: long = ecmaDayFromYear(approx) * msPerDay;
if (yearMs > time) {
approx--;
}
if ((yearMs + ecmaDaysInYear(approx) * msPerDay) <= time) {
approx++;
... | https://gitcode.com/iop123123/arkts-static-skills | 5902cedba50b03d77a76ad18ded4d121ec633ca7 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setUTCHours | Sets the hour for a specified date according to universal time.
@param value new hours | public setUTCHours(value: byte): void {
assert value >= 0 && value <= 23;
let hours = ecmaHourFromTime(this.ms);
this.ms -= msPerHour * hours;
this.ms += msPerHour * value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left byte AST#identifier... | public setUTCHours(value: byte): void {
assert value >= 0 && value <= 23;
let hours = ecmaHourFromTime(this.ms);
this.ms -= msPerHour * hours;
this.ms += msPerHour * value;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | da81ef35d34d6a966dc300e86dc70ff1ca8008b6 | gitee |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/Pigeon.ets | arkts | setup | Sets up an instance of `AnalysisImageUtils` to handle messages through the `binaryMessenger`. | static setup(binaryMessenger: BinaryMessenger, api: AnalysisImageUtils | null): void {
{
let channel: BasicMessageChannel<Object> =
new BasicMessageChannel(
binaryMessenger, "dev.flutter.pigeon.camerawesome.AnalysisImageUtils.nv21toJpeg",
A... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left setup AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left binaryMessenger AST#identifier#Right AST#:#Left : AST#:#Ri... | static setup(binaryMessenger: BinaryMessenger, api: AnalysisImageUtils | null): void {
{
let channel: BasicMessageChannel<Object> =
new BasicMessageChannel(
binaryMessenger, "dev.flutter.pigeon.camerawesome.AnalysisImageUtils.nv21toJpeg",
A... | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | cdc32b9b82694cc75c91c71c74eca87e3c690be6 | gitee |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/SendableStandardMethodCodec.ets | arkts | constructor | Creates a new method codec based on the specified message codec. | constructor(messageCodec: SendableStandardMessageCodec) {
this.messageCodec = messageCodec;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left messageCodec AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SendableStandardMessa... | constructor(messageCodec: SendableStandardMessageCodec) {
this.messageCodec = messageCodec;
} | https://gitee.com/openharmony-sig/flutter_engine.git | d5f9739f69efd8b32e12300c55d3638adfbf5d81 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | filter | creates a new BigUint64Array from current BigUint64Array based on a condition fn
@param fn the condition to apply for each element
@returns a new BigUint64Array with elements from current BigUint64Array that satisfy condition fn | public filter(fn: (val: BigInt, index: int) => boolean): BigUint64Array {
let newF: (val: BigInt, index: int, array: BigUint64Array) => boolean =
(val: BigInt, index: int, array: BigUint64Array): boolean => { return fn(val, index) }
return this.filter(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: BigInt, index: int) => boolean): BigUint64Array {
let newF: (val: BigInt, index: int, array: BigUint64Array) => boolean =
(val: BigInt, index: int, array: BigUint64Array): boolean => { return fn(val, index) }
return this.filter(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a187b03b7a224311e462b8a3260daf8032ce6eab | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | generateWaypointInstruction | 生成途经点指令
@param node 当前节点
@param prevNode 前一节点 | private generateWaypointInstruction(
node: GraphNode,
prevNode: GraphNode | null
): string {
if (!prevNode) return '从起点出发';
const distance = Math.round(this.getDistance(prevNode.position, node.position));
const type = this.determineWaypointType(node, prevNode);
switch (type) {
case W... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateWaypointInstruction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i... | private generateWaypointInstruction(
node: GraphNode,
prevNode: GraphNode | null
): string {
if (!prevNode) return '从起点出发';
const distance = Math.round(this.getDistance(prevNode.position, node.position));
const type = this.determineWaypointType(node, prevNode);
switch (type) {
case W... | https://github.com/LJ666-ui/harmony-health-care | d65a9f3a9df7e015ab02c276cc36abacaf290e64 | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | entry | Image edit model init.
@param pixelMap | entry(pixelMap: PixelMapWrapper): void {
Logger.info(TAG, `entry pixelMap: ${JSON.stringify(pixelMap)}`);
this.input = pixelMap;
this.filter = new ImageFilterCrop();
this.initialize();
if (this.isCropShowInitialized) {
let limit = this.calcNewLimit();
this.cropShow.init(limit, this.ima... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left entry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pixelMap AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixelMapWrapper AST#identifier#Right AST#)#Lef... | entry(pixelMap: PixelMapWrapper): void {
Logger.info(TAG, `entry pixelMap: ${JSON.stringify(pixelMap)}`);
this.input = pixelMap;
this.filter = new ImageFilterCrop();
this.initialize();
if (this.isCropShowInitialized) {
let limit = this.calcNewLimit();
this.cropShow.init(limit, this.ima... | https://gitee.com/openharmony/codelabs.git | 43a6071391ac5b846188c9499698a0a8ce7ebc18 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | getPreviousPosition | 获取指定条目的之前位置 | public getPreviousPosition(id: string): ItemPosition | null {
return this.previousPositions.get(id) || null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreviousPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public getPreviousPosition(id: string): ItemPosition | null {
return this.previousPositions.get(id) || null;
} | https://github.com/DaLongZhuaZi/manxia | 0ef91c930aaf76a86ad56f3842b3756089e4b29d | github |
CLMC2025/Vignette | entry/src/main/ets/database/DBManager.ets | arkts | generateCET4Words | Generate CET-4 mock words | static generateCET4Words(): WordItem[] {
const wordList: string[] = [
'abandon', 'ability', 'abnormal', 'aboard', 'abolish',
'absorb', 'abstract', 'abundant', 'abuse', 'academic',
'accelerate', 'accent', 'accept', 'access', 'accident',
'accommodate', 'accompany', 'accomplish', 'accord', 'a... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateCET4Words 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 Word... | static generateCET4Words(): WordItem[] {
const wordList: string[] = [
'abandon', 'ability', 'abnormal', 'aboard', 'abolish',
'absorb', 'abstract', 'abundant', 'abuse', 'academic',
'accelerate', 'accent', 'accept', 'access', 'accident',
'accommodate', 'accompany', 'accomplish', 'accord', 'a... | https://github.com/CLMC2025/Vignette | 3f6f2d664f7d4cdf90c674fd4d099aa5fe671ec6 | github |
Joker-x-dev/CoolMallArkTS | entry/src/main/ets/adapter/WindowAdapter.ets | arkts | updateBreakpoint | 更新断点状态
@param {number} windowWidthPx - 窗口宽度(px)
@returns {void} 无返回值 | private updateBreakpoint(windowWidthPx: number): void {
if (!this.windowClass) {
return;
}
const displayId = this.getDisplayId();
if (displayId === undefined) {
console.error("Failed to obtain displayId for breakpoint.");
return;
}
const windowWidthVp = this.pxToVp(windowWidt... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowWidthPx AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | private updateBreakpoint(windowWidthPx: number): void {
if (!this.windowClass) {
return;
}
const displayId = this.getDisplayId();
if (displayId === undefined) {
console.error("Failed to obtain displayId for breakpoint.");
return;
}
const windowWidthVp = this.pxToVp(windowWidt... | https://github.com/Joker-x-dev/CoolMallArkTS | 7835076f536940d13fe2b7f9b5660248f24c1423 | github |
daugf2527/harmonyos-libretro-emulator | deprecated/legacy/archive/entry/src/main/ets/pages/Game2048.ets | arkts | handleInput | 处理按键输入 | handleInput(keyId: number, pressed: boolean) {
try {
testNapi.setInput(keyId, pressed);
hilog.info(0xD002, 'Game2048', `按键: ${keyId}, 按下: ${pressed}`);
} catch (e) {
const error = e as Error;
hilog.error(0xD002, 'Game2048', `输入错误: ${error.message}`);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keyId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ... | handleInput(keyId: number, pressed: boolean) {
try {
testNapi.setInput(keyId, pressed);
hilog.info(0xD002, 'Game2048', `按键: ${keyId}, 按下: ${pressed}`);
} catch (e) {
const error = e as Error;
hilog.error(0xD002, 'Game2048', `输入错误: ${error.message}`);
}
} | https://github.com/daugf2527/harmonyos-libretro-emulator | b217d67d1d8f5a4f8a6098ca03cd161b57f07707 | github |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/CustomCalendar.ets | arkts | toToday | 跳转到今天 | toToday(){
this.isSelectDay = this.today;
this.currentYM = this.today;
this.initDay(this.currentYM);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toToday 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... | toToday(){
this.isSelectDay = this.today;
this.currentYM = this.today;
this.initDay(this.currentYM);
} | https://gitee.com/openharmony-sig/ohos_easyui.git | 93c0380bc8978f0aedd8f9307479807d96814878 | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/CategoryRepository.ets | arkts | deleteCategory | 删除分类
@param id 分类 ID
@returns Promise<boolean> 是否成功 | async deleteCategory(id: number): Promise<boolean> {
try {
const deletedRows = await this.dao.deleteById(id);
if (deletedRows > 0) {
Logger.info(this.LOG_TAG, `Category deleted: ${id}`);
return true;
}
return false;
} catch (err) {
Logger.error(this.LOG_TAG, `Fai... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | async deleteCategory(id: number): Promise<boolean> {
try {
const deletedRows = await this.dao.deleteById(id);
if (deletedRows > 0) {
Logger.info(this.LOG_TAG, `Category deleted: ${id}`);
return true;
}
return false;
} catch (err) {
Logger.error(this.LOG_TAG, `Fai... | https://github.com/Kira-Yagami-Light/Kira-Projects | 2515d46f77d4fade1977177b0aebb0f202c55115 | github |
openharmony-sig/online_event | college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/MainAbility/pages/music2.ets | arkts | pauseAnimation | 暂停音乐动画 | pauseAnimation() {
// 清除唱盘转动定时器
if (this.turntableTimer) {
// this.turntableAngle = this.turntableAngle
clearInterval(this.turntableTimer)
this.turntableTimer = undefined
}
// 唱盘指针上拨动画
animateTo({ duration: 1500, curve:... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pauseAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef... | pauseAnimation() {
// 清除唱盘转动定时器
if (this.turntableTimer) {
// this.turntableAngle = this.turntableAngle
clearInterval(this.turntableTimer)
this.turntableTimer = undefined
}
// 唱盘指针上拨动画
animateTo({ duration: 1500, curve:... | https://gitee.com/openharmony-sig/online_event.git | afcdbc4242ba1595c0d59e10f044ca94a8137a01 | gitee |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/loading/TnLoading.ets | arkts | getLoadingSizeConfig | 根据尺寸类型获取加载组件尺寸配置
@param size 尺寸类型
@returns 尺寸配置 | function getLoadingSizeConfig(size: TnLoadingSizeType | undefined): TnLoadingSizeConfig {
switch (size) {
case "sm":
return {
iconSize: 20,
flowerBarWidth: 2,
borderWidth: 2
};
case "lg":
return {
iconSize: 36,
flowerBarWidth: 3,
borderWidth: 4... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getLoadingSizeConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left size AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function getLoadingSizeConfig(size: TnLoadingSizeType | undefined): TnLoadingSizeConfig {
switch (size) {
case "sm":
return {
iconSize: 20,
flowerBarWidth: 2,
borderWidth: 2
};
case "lg":
return {
iconSize: 36,
flowerBarWidth: 3,
borderWidth: 4... | https://github.com/codelably/tuniao-ui | f05ea32d7d2ffcf169f59d198dcf4d3bb9288071 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/PairingManager.ets | arkts | getClientCertHex | 获取客户端证书的十六进制表示(PEM 格式)
Android 使用 PEM 格式的证书 | getClientCertHex(): string {
if (!this.clientCertPem) {
return '';
}
return CryptoUtil.bytesToHex(this.clientCertPem);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getClientCertHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#state... | getClientCertHex(): string {
if (!this.clientCertPem) {
return '';
}
return CryptoUtil.bytesToHex(this.clientCertPem);
} | https://github.com/AlkaidLab/moonlight-harmony | a945a03e9795f0de0266e14b2830c632a0832713 | github |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/WebDownloadFileImpl.ets | arkts | handleDownloadStart | 重写抽象类方法 | protected handleDownloadStart(): void {
WebDownloadFileHelper.openDownloadPopUpWindow()
WebDownloadFileHelper._webDownloadItem = this.webDownloadItem
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleDownloadStart 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#Rig... | protected handleDownloadStart(): void {
WebDownloadFileHelper.openDownloadPopUpWindow()
WebDownloadFileHelper._webDownloadItem = this.webDownloadItem
} | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | 73ec0d66f2ff130baa120aca91fced0662d08e4b | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/common/VNCConnection.ets | arkts | connect | 连接到VNC服务器
@param host VNC服务器地址
@param port VNC服务器端口 | async connect(host: string, port: number): Promise<void> {
if (this.connectionState === VNCConnectionState.CONNECTING ||
this.connectionState === VNCConnectionState.CONNECTED) {
throw new Error('Already connecting or connected');
}
this.host = host;
this.port = port;
this.setState(V... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left connect AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left host AST#identifier#Right AST#type_an... | async connect(host: string, port: number): Promise<void> {
if (this.connectionState === VNCConnectionState.CONNECTING ||
this.connectionState === VNCConnectionState.CONNECTED) {
throw new Error('Already connecting or connected');
}
this.host = host;
this.port = port;
this.setState(V... | https://github.com/AetheriumSimulator/qemu-hmos | 33c452cf65839471235f3f5f0189d5ea85159413 | github |
azhu0001/localsend-harmony | entry/src/main/ets/service/upload/UploadServer.ets | arkts | disconnection | 关闭TCP Socket链接,所有文件上传完成后关闭 | disconnection() {
this.tcp.close().then(() => {
this.isConnected = false
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left disconnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | disconnection() {
this.tcp.close().then(() => {
this.isConnected = false
})
} | https://gitcode.com/azhu0001/localsend-harmony | 751ee96e714fc498b4e63f6111c8d6358479e0d0 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets | arkts | getMinFixedRectSize | Get min fixed rect size.
@param rate
@param minLength
@returns rect width and height. | static getMinFixedRectSize(rate: number, minLength: number): Array<number> {
let width = minLength;
let height = minLength;
if (rate > 1) {
width = height * rate;
} else {
height = width / rate;
}
return [width, height];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMinFixedRectSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rate AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static getMinFixedRectSize(rate: number, minLength: number): Array<number> {
let width = minLength;
let height = minLength;
if (rate > 1) {
width = height * rate;
} else {
height = width / rate;
}
return [width, height];
} | https://gitee.com/openharmony/codelabs.git | cbc2363ce3695ea6ba307f0f999633b68b7c8ed5 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test61_original_index.ets | arkts | twoSum | --- Two-sum with Map --- | function twoSum(nums: number[], target: number): number[] {
let seen: Map<number, number> = new Map();
for (let i: number = 0; i < nums.length; i++) {
let complement: number = target - nums[i];
let found: number | undefined = seen.get(complement);
if (found !== undefined) {
return [found, i];
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left twoSum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nums AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function twoSum(nums: number[], target: number): number[] {
let seen: Map<number, number> = new Map();
for (let i: number = 0; i < nums.length; i++) {
let complement: number = target - nums[i];
let found: number | undefined = seen.get(complement);
if (found !== undefined) {
return [found, i];
... | https://github.com/miaochiahao/ark-ghidra | c6fa30a172399956b0323e33045594ae41aea922 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/not_equal/not_equal_float.ets | arkts | main | ---
desc: check not equality of two floats
--- | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
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: float = {{v.left}} as float
const b: float = {{v.right}} as float
assert (a != b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 59f4d11e15e96a7e51ff8f38fb63e1b86dbe1f9a | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | $_invoke | Creates a new instance of BigInt from union of bigint/number/string/boolean
@param { BigInt | Number | String | Boolean } value source value
@returns { BigInt } A new BigInt instance from union of bigint/number/string/boolean
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: BigInt | Double | String | Boolean): BigInt {
if (value instanceof BigInt) {
return new BigInt(value as BigInt)
} else if (value instanceof Double) {
return new BigInt(value as Double)
} else if (value instanceof String) {
return new... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left... | static $_invoke(value: BigInt | Double | String | Boolean): BigInt {
if (value instanceof BigInt) {
return new BigInt(value as BigInt)
} else if (value instanceof Double) {
return new BigInt(value as Double)
} else if (value instanceof String) {
return new... | https://gitcode.com/iop123123/arkts-static-skills | 0628b20cef924c895ed26b4bead473d920b29e41 | gitcode |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/GestureUtils.ets | arkts | applyResistance | 应用阻力效果
@param delta - 原始位移
@param resistance - 阻力系数
@returns 应用阻力后的位移 | static applyResistance(delta: number, resistance: number): number {
return delta * resistance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applyResistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left delta AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static applyResistance(delta: number, resistance: number): number {
return delta * resistance;
} | https://github.com/kumaleap/ArkSwipeDeck | a04ccaab133a8259e99d63970c342eb244e02076 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getPressScale | 获取按下缩放比例 | static getPressScale(): number {
return 0.98;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPressScale 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#n... | static getPressScale(): number {
return 0.98;
} | https://github.com/chendi126/harmonyOS-TCP | 04bccb943a73e4e094ab065698375e2c8374e85d | github |
youyeyejie/ZhiXing_ActHub | entry/src/main/ets/app/AppStates.ets | arkts | whiteNoisePlayer | 返回白噪音播放器。 | get whiteNoisePlayer(): WhiteNoisePlayer {
return this._whiteNoisePlayer;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left whiteNoisePlayer 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 WhiteNoisePlay... | get whiteNoisePlayer(): WhiteNoisePlayer {
return this._whiteNoisePlayer;
} | https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppStates.ets#L160-L162 | a9b6896ef8ed530dfee8a1181186c23fa4bed163 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/pages/PathPlannerTestPage.ets | arkts | clearCache | ==================== 缓存管理方法 ==================== | clearCache() {
this.planner.clearCache();
this.updateSystemStatus();
console.log('🗑️ 已清空缓存');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | clearCache() {
this.planner.clearCache();
this.updateSystemStatus();
console.log('🗑️ 已清空缓存');
} | https://github.com/LJ666-ui/harmony-health-care | 78275b023832c02c0238f3f765ca1e9607f23f31 | github |
openharmony-sig/FastBle | library/src/main/ets/bluetooth/BleConnector.ets | arkts | enableCharacteristicIndicate | indicate | public enableCharacteristicIndicate(bleIndicateCallback: BleIndicateCallback, uuid_indicate: string,
useCharacteristicDescriptor: boolean): void {
if (this.mCharacteristic != null
/*&& (this.mCharacteristic.getProperties() | bluetooth.BLECharacteristic.PROPERTY_NOTIFY) > ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableCharacteristicIndicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bleIndicateCallback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public enableCharacteristicIndicate(bleIndicateCallback: BleIndicateCallback, uuid_indicate: string,
useCharacteristicDescriptor: boolean): void {
if (this.mCharacteristic != null
/*&& (this.mCharacteristic.getProperties() | bluetooth.BLECharacteristic.PROPERTY_NOTIFY) > ... | https://gitee.com/openharmony-sig/FastBle.git | 19645d59ff6680dfe8bd675e8cfa89b324f8ece3 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GameControllerService.ets | arkts | getAllDevices | 获取所有已连接设备 | getAllDevices(): GameControllerDeviceInfo[] {
const devices: GameControllerDeviceInfo[] = [];
const count = this.getDeviceCount();
for (let i = 0; i < count; i++) {
const info = this.getDeviceInfo(i);
if (info) {
devices.push(info);
}
}
return devices;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllDevices 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 GameControllerDeviceInfo AST#identifier#Right AS... | getAllDevices(): GameControllerDeviceInfo[] {
const devices: GameControllerDeviceInfo[] = [];
const count = this.getDeviceCount();
for (let i = 0; i < count; i++) {
const info = this.getDeviceInfo(i);
if (info) {
devices.push(info);
}
}
return devices;
} | https://github.com/AlkaidLab/moonlight-harmony | 4dc9b5430523828ed89452b3f0cb319bd2e1d759 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BubbleComponent.ets | arkts | getBubbleTopLeftRadius | 获取左上圆角
@returns | getBubbleTopLeftRadius(): number {
return this.mBubbleTopLeftRadius == -1 ? this.mBubbleRadius : this.mBubbleTopLeftRadius
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBubbleTopLeftRadius 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... | getBubbleTopLeftRadius(): number {
return this.mBubbleTopLeftRadius == -1 ? this.mBubbleRadius : this.mBubbleTopLeftRadius
} | https://github.com/wuba/omni-ui | 132117787a7c825b016ed9978727bceaca6ed7e6 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | aboutToDisappear | 页面隐藏时清理计时器
@returns {void} 无返回值 | aboutToDisappear(): void {
this.clearSideBarUnlockTimer();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
this.clearSideBarUnlockTimer();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7e1f31537e0f80a97a6f1b5a1d0de7c0830c018b | github |
harmonyos/codelabs | HarmonyOS_NEXT/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartViewModel.ets | arkts | initRandomValue | Randomly generate data.
@param count Init data count.
@returns JArrayList<EntryOhos>. | initRandomValue(count: number): JArrayList<EntryOhos> {
let values = new JArrayList<EntryOhos>();
values.add(new EntryOhos(0, 0));
let temp = 0;
for (let i = 1; i < count; i++) {
let val: number = Math.random() * 0.5;
let calculated: number = Math.random() * 100;
if (calculated > 50)... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left initRandomValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | initRandomValue(count: number): JArrayList<EntryOhos> {
let values = new JArrayList<EntryOhos>();
values.add(new EntryOhos(0, 0));
let temp = 0;
for (let i = 1; i < count; i++) {
let val: number = Math.random() * 0.5;
let calculated: number = Math.random() * 100;
if (calculated > 50)... | https://gitee.com/harmonyos/codelabs.git | 0ecc9e43f3d5a0cb4659d9316c0e016000232416 | gitee |
arkui-x/samples | CodeLab/Cases/feature/backgroundblur/src/main/ets/pages/TabsSample.ets | arkts | myContent | 功能介绍:在一些主页的场景中,为了实现更好的视觉体验,会给TabBar加上透明的背景模糊效果。
推荐场景:为了体验需要实现模糊效果的场景,例如购物商场的主页下方的TabBar效果。
核心组件:CustomTabsComponent.ets
实现步骤:
1.使用backgroundBrightness和backgroundBlurStyleTabBar属性实现TabBar背景模糊效果:
在自定义的TabBar实现中,添加backgroundBrightness和backgroundBlurStyleTabBar属性,实现透明模糊效果。其中backgroundBrightness
属性可以控制背景的亮度等效果,backgroundBlu... | @Builder
function myContent(info: string) {
Text(info)
.fontSize(24)
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left myContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#require... | @Builder
function myContent(info: string) {
Text(info)
.fontSize(24)
} | https://gitcode.com/arkui-x/samples | 1ce7fa31558785e25196153b8a98184991a4c069 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates an Int8Array with respect to buf and byteOffset.
@param buf data initializer
@param byteOffset byte offset from begin of the buf | public constructor(buf: Buffer, byteOffset: int) {
this(buf, byteOffset, buf.getByteLength() / Int8Array.BYTES_PER_ELEMENT)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe... | public constructor(buf: Buffer, byteOffset: int) {
this(buf, byteOffset, buf.getByteLength() / Int8Array.BYTES_PER_ELEMENT)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 36671236ecf8ae7475c7a0dfe7af50b565a8a424 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | convertToLedgerMember | 转换为LedgerMember | static convertToLedgerMember(resultSet: relationalStore.ResultSet): LedgerMember {
const member = new LedgerMember();
member.memberId = DAOHelper.getNumberValue(resultSet, 'member_id');
member.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id');
member.userId = DAOHelper.getNumberValue(resultS... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToLedgerMember AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#membe... | static convertToLedgerMember(resultSet: relationalStore.ResultSet): LedgerMember {
const member = new LedgerMember();
member.memberId = DAOHelper.getNumberValue(resultSet, 'member_id');
member.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id');
member.userId = DAOHelper.getNumberValue(resultS... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5281bb33709874231fa33cf19ca97b25265fbaed | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/TransactionDao.ets | arkts | insertTransaction | 插入交易记录
@param transaction 交易记录对象
@returns 新增交易的ID | public async insertTransaction(transaction: Transaction): Promise<number> {
const valueBucket: relationalStore.ValuesBucket = {
type: transaction.type,
amount: transaction.amount,
category_id: transaction.category_id,
date: transaction.date,
note: transaction.note || ''
};
t... | 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 insertTransaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left transaction AST#identifier#Right AST#:... | public async insertTransaction(transaction: Transaction): Promise<number> {
const valueBucket: relationalStore.ValuesBucket = {
type: transaction.type,
amount: transaction.amount,
category_id: transaction.category_id,
date: transaction.date,
note: transaction.note || ''
};
t... | https://github.com/fuhhhhhhhh/openharmony | 4b99d6d7b47d45eb9522dd894db84dfcf3816329 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/common/components/search.ets | arkts | aboutToAppear | Original application information array | aboutToAppear() {
this.oldApplicationItem = this.applicationItem;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.oldApplicationItem = this.applicationItem;
} | https://gitee.com/openharmony/applications_permission_manager.git | 23267f5ee3137f91175c48b4271c5631d79973ab | gitee |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/pages/Index.ets | arkts | deleteBookmark | Delete a bookmark | deleteBookmark(index: number): void {
this.bookmarks.splice(index, 1);
this.saveBookmarks();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteBookmark 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 )... | deleteBookmark(index: number): void {
this.bookmarks.splice(index, 1);
this.saveBookmarks();
} | https://github.com/tangwengang-del/freerdp-harmonyos | c87cba782cd668284765822e18d28965c07327a3 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets | arkts | notifyLanguageStateUpdate | Notify LanguageState to update layout direction | private static notifyLanguageStateUpdate(language: string): void {
try {
LanguageState.getInstance().updateLanguage(language);
} catch (error) {
hilog.warn(0x0000, 'ContextProvider', 'Failed to notify LanguageState: %{public}s', JSON.stringify(error));
}
} | 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 notifyLanguageStateUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left language AST#identifier#Right AST#ERROR#L... | private static notifyLanguageStateUpdate(language: string): void {
try {
LanguageState.getInstance().updateLanguage(language);
} catch (error) {
hilog.warn(0x0000, 'ContextProvider', 'Failed to notify LanguageState: %{public}s', JSON.stringify(error));
}
} | https://github.com/Tencent-RTC/TUIKit_Harmony | f37a8006c21f717ee1c62224c7516b31d6201075 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/json.ets | arkts | stringify | Converts chars array to JSON format
@param d: char[] - chars array to be converted to a JSON as an Array of Numbers
@returns String - JSON representation of chars array | public static stringify(d: char[]): String {
let s = new StringBuilder("[")
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append("\"" + d[i] + "\"")
s.append(',')
}
if (d.length > 0) {
s.append("\"" + d[last_elem] + "... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: char[]): String {
let s = new StringBuilder("[")
let last_elem = d.length - 1
for (let i = 0; i < last_elem; ++i) {
s.append("\"" + d[i] + "\"")
s.append(',')
}
if (d.length > 0) {
s.append("\"" + d[last_elem] + "... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9e339b53371cbe45e6f30871049c8144d559e22c | gitee |
CLMC2025/Vignette | entry/src/main/ets/context/TemplateManager.ets | arkts | initialize | 初始化模板库 | initialize(): void {
if (this.initialized) {
return;
}
this.loader.loadDefaultTemplates(this.templates);
this.loadExternalTemplatePackFromStorage();
this.initialized = true;
console.info('[TemplateManager] Templates initialized');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#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... | initialize(): void {
if (this.initialized) {
return;
}
this.loader.loadDefaultTemplates(this.templates);
this.loadExternalTemplatePackFromStorage();
this.initialized = true;
console.info('[TemplateManager] Templates initialized');
} | https://github.com/CLMC2025/Vignette | efd2abc4b8e9461516d25c8849954eb1a2c1df72 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | italics | The italics() method creates a string that embeds a string in a <i> element (<i>str</i>),
which causes a string to be displayed in a big font.
@returns { String }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public italics(): String{
return this.CreateHTMLString('i', '')
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left italics 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 String AST#ide... | public italics(): String{
return this.CreateHTMLString('i', '')
} | https://gitcode.com/iop123123/arkts-static-skills | 5cd5e8f462d711dd7ccb03c032537715a6eb6f7a | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectStaticField.ets | arkts | equals | Determine whether the current Static Field object is equal to another object.
@param { StaticField } other Another Static Field object to compare.
@returns { boolean } If two objects are equal, return true; otherwise, return false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(other: StaticField): boolean {
return this.fieldPtr == other.fieldPtr
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StaticFi... | public equals(other: StaticField): boolean {
return this.fieldPtr == other.fieldPtr
} | https://gitcode.com/iop123123/arkts-static-skills | ce328b547895872f2e114d39be89b04ce790f4fc | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | join | Adds all the elements of an array separated by the specified separator string
@param { String } [separator] - A string used to separate one element of an array from the next in the
resulting String. If omitted, the array elements are separated with a comma.
@returns { string } - joined representation
@syscap SystemCapa... | public join(separator?: String): string {
if (separator == undefined) {
return this.joinInternal(",")
}
return this.joinInternal(separator)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left join AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left separator AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST... | public join(separator?: String): string {
if (separator == undefined) {
return this.joinInternal(",")
}
return this.joinInternal(separator)
} | https://gitcode.com/iop123123/arkts-static-skills | 49371064d957130cd4590811883b36fba0328a25 | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/FamilyPackService.ets | arkts | peekRemoteEtag | HEAD-only ETag probe. Returns null on error; never throws. | async peekRemoteEtag(deviceToken: string, familyId?: string): Promise<string | null> {
if (deviceToken.length === 0) {
return null;
}
const fid: string = familyId !== undefined ? familyId : '';
const url: string = this.childPacksLatestUrl(fid);
const headers: Record<string, string> = this.au... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left peekRemoteEtag AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceToken AST#identifier#Rig... | async peekRemoteEtag(deviceToken: string, familyId?: string): Promise<string | null> {
if (deviceToken.length === 0) {
return null;
}
const fid: string = familyId !== undefined ? familyId : '';
const url: string = this.childPacksLatestUrl(fid);
const headers: Record<string, string> = this.au... | https://github.com/terryma2024/happyword | 74d14d1c40f5910a016cf2aa7a6d7ca057fc790b | github |
Octo-o-o-o/harmonyos-ai-workspace | samples/templates/web-bridge-h5-shell/BridgeJavaScriptProxy.ets | arkts | postMessage | 注意:`name` 字段必须出现在 javaScriptProxy 的 methodList 里
H5 通过 window.<proxyName>.postMessage(jsonString) 调用 | postMessage(raw: string): string {
return this.runtime.handleSync(raw)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left postMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#... | postMessage(raw: string): string {
return this.runtime.handleSync(raw)
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | f13f0a5b47ebe26916fc2285077ef3466cfc752b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | lastIndexOf | Returns the index of the last occurrence of a value in Int8Array.
@param { int } searchElement - The value to locate in the array. The search begins at index length - 1.
@returns { int } - right-most index of searchElement. It must be less than length. -1 if not found
@syscap SystemCapability.Utils.Lang
@FaAndStageMode... | public lastIndexOf(searchElement: int): int {
return this.lastIndexOf(searchElement, this.lengthInt - 1)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#ide... | public lastIndexOf(searchElement: int): int {
return this.lastIndexOf(searchElement, this.lengthInt - 1)
} | https://gitcode.com/iop123123/arkts-static-skills | b58f54e464dd29a77478ccdcf415c9e2e186f67f | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportToDownloadBackupFolder | [新增] 导出备份文件到Download/漫匹/backup文件夹
@param sourcePath 源备份文件路径
@param fileName 备份文件名
@returns 导出的文件路径,如果失败返回空字符串 | private async exportToDownloadBackupFolder(sourcePath: string, fileName: string): Promise<string> {
try {
// 从AppStorage获取Download同步目录路径
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (!downloadDirPath) {
logger.info(TAG, 'Download同步目录未配置,跳过导出到外部存储');
r... | 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 exportToDownloadBackupFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERR... | private async exportToDownloadBackupFolder(sourcePath: string, fileName: string): Promise<string> {
try {
// 从AppStorage获取Download同步目录路径
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (!downloadDirPath) {
logger.info(TAG, 'Download同步目录未配置,跳过导出到外部存储');
r... | https://github.com/DaLongZhuaZi/manxia | 2a401026448c411308cc33fb7a0b1da42fa13d26 | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | isAllSelected | 是否全选
@returns {boolean} 是否全选 | get isAllSelected(): boolean {
if (this.cartList.length === 0) {
return false;
}
for (const cart of this.cartList) {
for (const spec of cart.spec) {
const key = `${cart.goodsId}_${spec.id}`;
if (!this.selectedSpecIds.has(key)) {
return false;
}
}
}
... | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isAllSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#... | get isAllSelected(): boolean {
if (this.cartList.length === 0) {
return false;
}
for (const cart of this.cartList) {
for (const spec of cart.spec) {
const key = `${cart.goodsId}_${spec.id}`;
if (!this.selectedSpecIds.has(key)) {
return false;
}
}
}
... | https://github.com/Joker-x-dev/CoolMallArkTS | d03c9ec14f27166a8a211fe931910fa524c8a253 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets | arkts | judgeHasNet | 判断当前网络是否可用
使用网络前,例如打开一个应用时,需要检查当前连接的网络是否可用。
如果可用,则正常进行网络请求;如果不可用,则需要提示用户网络不可用。
@returns 当前网络是否可用 | judgeHasNet(): boolean {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return false;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
let cap = netCapability.networkCap || [];
if (cap.includes(connect... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left judgeHasNet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | judgeHasNet(): boolean {
try {
let netHandle = connection.getDefaultNetSync();
if (!netHandle || netHandle.netId === 0) {
return false;
}
let netCapability = connection.getNetCapabilitiesSync(netHandle);
let cap = netCapability.networkCap || [];
if (cap.includes(connect... | https://github.com/openharmony/applications_app_samples | 22f26d4e63d80f3821d9195b5fe7bc47520731ca | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | getChars | Gets the full char sequence that is representing this string.
@returns { char[] } char[] array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getChars(): char[] {
return this.getChars(0, this.getLength());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getChars 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_st... | public getChars(): char[] {
return this.getChars(0, this.getLength());
} | https://gitcode.com/iop123123/arkts-static-skills | ec904be8b0e01f2f06151e8326e66c3d2f57c91e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | sendValidationCancelledNotification | 发送校验取消通知 | public async sendValidationCancelledNotification(
taskId: string,
completed: number,
total: number
): Promise<boolean> {
const config: NotificationConfig = {
id: this.getNotificationId(taskId),
title: '书源校验已取消',
text: `已完成 ${completed}/${total}`,
type: NotificationType.VALIDA... | 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 sendValidationCancelledNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifie... | public async sendValidationCancelledNotification(
taskId: string,
completed: number,
total: number
): Promise<boolean> {
const config: NotificationConfig = {
id: this.getNotificationId(taskId),
title: '书源校验已取消',
text: `已完成 ${completed}/${total}`,
type: NotificationType.VALIDA... | https://github.com/DaLongZhuaZi/manxia | 82a33512508bff9c0891a991da77b7ba51257bfa | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets | arkts | popLast | Removes and returns the last element from the deque.
@returns { T } The last element of the deque. | public popLast(): T {
this.checkEmptyContainer();
this.rear = (this.rear - 1 + this.capacity) % this.capacity;
let element: T = this.buffer[this.rear] as T;
return element;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left popLast 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 T AST#identifi... | public popLast(): T {
this.checkEmptyContainer();
this.rear = (this.rear - 1 + this.capacity) % this.capacity;
let element: T = this.buffer[this.rear] as T;
return element;
} | https://gitcode.com/iop123123/arkts-static-skills | 589bfd3c5486b1003638eb734ca8cc75ae5781bd | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.