nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | authority | Sets the decoding permission component part of this URI.
@param { string } input | set authority(input: string) {
this.uriEntry.setAuthority(encodeURI(input))
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left authority AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#ide... | set authority(input: string) {
this.uriEntry.setAuthority(encodeURI(input))
} | https://gitcode.com/iop123123/arkts-static-skills | 5b65c93662dfc2f5ccd7305ca6df14d6e398fe01 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates a copy of Int32Array.
@param other data initializer | public constructor(other: Int32Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Int... | public constructor(other: Int32Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 782c2b346ffef3384cd7fae1b479da0a64d5cca6 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | setText | Sets the text content for the current XML element.
@param {string} text - The text content to set for the current XML element.
@throws {BusinessError} Throws an error if the `text` parameter is an empty string. | public setText(text: string): void {
this.checkEmptyParameter(text);
let stringBuilder = new StringBuilder();
if (this.type === XmlDynamicType.START_AND_ATTRIBUTES) {
this.spliceNamespace(stringBuilder);
stringBuilder.append('>');
}... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | public setText(text: string): void {
this.checkEmptyParameter(text);
let stringBuilder = new StringBuilder();
if (this.type === XmlDynamicType.START_AND_ATTRIBUTES) {
this.spliceNamespace(stringBuilder);
stringBuilder.append('>');
}... | https://gitcode.com/iop123123/arkts-static-skills | 1d0f3c3833c5bff159b31fe1056397c18ca84c41 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/AudioService.ets | arkts | setupStateCallbacks | 设置状态回调 | private setupStateCallbacks(): void {
if (this.avPlayer === null) {
return;
}
// 播放完成回调
this.avPlayer.on('stateChange', (state: string) => {
console.info(`AudioService: 状态变化 - ${state}`);
if (state === 'completed') {
this.isPlaying = false;
}
});
// 错误回调
t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupStateCallbacks 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... | private setupStateCallbacks(): void {
if (this.avPlayer === null) {
return;
}
// 播放完成回调
this.avPlayer.on('stateChange', (state: string) => {
console.info(`AudioService: 状态变化 - ${state}`);
if (state === 'completed') {
this.isPlaying = false;
}
});
// 错误回调
t... | https://github.com/the-wwyang/kids-learning-app | f52095359110094eda327ae2198e947f32be42aa | github |
arkui-x/samples | CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets | arkts | setPositionXY | 设置坐标
@param { RaisedCircleSetPostionXYType } obj | setPositionXY(position: RaisedCircleSetPostionXYType): void {
if (position.x || position.x === 0) {
this.oldPositionX = this.positionX;
this.positionX = position.x;
}
if (position.y || position.y === 0) {
this.oldPositionY = this.positionY
this.positionY = position.y;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPositionXY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left position AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RaisedCircleSetPostionXYType AST#ident... | setPositionXY(position: RaisedCircleSetPostionXYType): void {
if (position.x || position.x === 0) {
this.oldPositionX = this.positionX;
this.positionX = position.x;
}
if (position.y || position.y === 0) {
this.oldPositionY = this.positionY
this.positionY = position.y;
}
} | https://gitcode.com/arkui-x/samples | 89a5b3e2d0a8d992c309dd09ac0ab9a4378e03e7 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/utils/SettingsManager.ets | arkts | getAllCached | ============================================================================
缓存管理
============================================================================
获取所有缓存的设置
@returns 设置键值对映射 | public getAllCached(): Map<string, SettingValue> {
return new Map(this.settingsCache);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressio... | public getAllCached(): Map<string, SettingValue> {
return new Map(this.settingsCache);
} | https://github.com/richshaw2015/nds | 5f2756077ab0aa5cca9e865a4702465f759f1287 | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets | arkts | setPopExitAnimate | 退出状态(POP) 离开页的动画转场参数(B返回A 的 B离开转场)
@param param
@returns | public setPopExitAnimate(param: INavSingleAnimationParam) {
if (this._callback) {
this._callback.popExitParam = param
}
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPopExitAnimate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public setPopExitAnimate(param: INavSingleAnimationParam) {
if (this._callback) {
this._callback.popExitParam = param
}
return this
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets#L115-L120 | b2bf329dfa33f3da001439802fe08a42dc31bbdb | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | clearCache | 清除缓存(登出时调用) | static clearCache(): void {
FavoritesManager.favoriteProductIds.clear();
FavoritesManager.cacheLoaded = false;
FavoritesManager.currentCacheUser = '';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right 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#ERROR#Right AST#expression_... | static clearCache(): void {
FavoritesManager.favoriteProductIds.clear();
FavoritesManager.cacheLoaded = false;
FavoritesManager.currentCacheUser = '';
} | https://github.com/Harrisonls2004/WaterFlow | 19efe78f8dd3dc704c28a63f3043cf27840c84f6 | github |
PollenWang6/HiXD | entry/src/main/ets/services/SportService.ets | arkts | getClass | 获取体育课程信息(含成绩构成) | async getClass(): Promise<SportClassItem[]> {
if (this.userId.length === 0 || this.token.length === 0) {
await this.login();
}
const result: SportClassItem[] = [];
const body: Record<string, string> = {
'uid': this.userId,
'pageIndex': '1',
'pageSize': '100',
};
const... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getClass AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#... | async getClass(): Promise<SportClassItem[]> {
if (this.userId.length === 0 || this.token.length === 0) {
await this.login();
}
const result: SportClassItem[] = [];
const body: Record<string, string> = {
'uid': this.userId,
'pageIndex': '1',
'pageSize': '100',
};
const... | https://github.com/PollenWang6/HiXD | b5a3445f7d997b704b16c5d7aa08f4fb7a2d24fd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | equals | Checks for equality this instance with provided object, treated as a IntType
@param {Type} other type to be checked against
@returns {boolean} true if object also has IntType and
this type and other type both are reference or value
@throws {Error} - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStage... | public override equals(other: Type): boolean {
return other instanceof IntType
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public override equals(other: Type): boolean {
return other instanceof IntType
} | https://gitcode.com/iop123123/arkts-static-skills | 8f549b0a9947e2216cea86610c69599fa7010521 | gitcode |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/components/EmptyStateComponent.ets | arkts | build | 构建首页列表空状态占位视图。 | build() {
Column() {
SymbolGlyph($r('sys.symbol.doc_text'))
.fontSize(48)
.fontColor([this.themeState.iconSecondary])
Text(this.text)
.fontSize(15)
.fontColor(this.themeState.fontSecondary)
.margin({ top: 12 })
}
.width('100%')
.height(200)
.just... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
SymbolGlyph($r('sys.symbol.doc_text'))
.fontSize(48)
.fontColor([this.themeState.iconSecondary])
Text(this.text)
.fontSize(15)
.fontColor(this.themeState.fontSecondary)
.margin({ top: 12 })
}
.width('100%')
.height(200)
.just... | https://github.com/ZestBox-18/kitebook-frontend | 0f1a434f22dbc3fbb2adaaa14db92863927ae54f | github |
FinalScave/SweetLine | platform/OHOS/sweetline/src/main/ets/Index.ets | arkts | getLine | Get the text content of a specific line | public getLine(line: number): string {
return lib.Document_GetLine(this.nativeHandle, line);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | public getLine(line: number): string {
return lib.Document_GetLine(this.nativeHandle, line);
} | https://github.com/FinalScave/SweetLine | dde45ce403b0e3149bd1c699b6a680564c5dedbd | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | getContactById | Obtain contact details.
@param {Object} contactId Contact data ID.
@param {Object} callback Contact details | getContactById(contactId: number, callback: Function, context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'Start to query contact by id.');
if (context) {
ContactRepository.getInstance().init(context);
}
ContactRepository.getInstance().findById(contactId, (contact: Contact) => {
co... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getContactById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contactId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A... | getContactById(contactId: number, callback: Function, context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'Start to query contact by id.');
if (context) {
ContactRepository.getInstance().init(context);
}
ContactRepository.getInstance().findById(contactId, (contact: Contact) => {
co... | https://gitee.com/openharmony/applications_contacts.git | cad61cfa0e5ef4242bb5dbc29a955b91c8ab545c | gitee |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionGenerator.ets | arkts | generateFillBlank | 生成填空题
@param difficulty 难度等级
@returns 填空题对象 | static generateFillBlank(difficulty: Difficulty): MathQuestion {
const maxNum = QuestionGenerator.getFillBlankMaxNum(difficulty);
const answer = Math.floor(Math.random() * maxNum) + 1;
const num2 = Math.floor(Math.random() * maxNum) + 1;
const sum = answer + num2;
return {
type: QuestionTyp... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateFillBlank AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | static generateFillBlank(difficulty: Difficulty): MathQuestion {
const maxNum = QuestionGenerator.getFillBlankMaxNum(difficulty);
const answer = Math.floor(Math.random() * maxNum) + 1;
const num2 = Math.floor(Math.random() * maxNum) + 1;
const sum = answer + num2;
return {
type: QuestionTyp... | https://github.com/the-wwyang/kids-learning-app | 53226abaadc85b4c1ed437515af25901bd5b736c | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/OCRRecognition.ets | arkts | matchAmountWithKeyword | 匹配带关键词的金额 | private static matchAmountWithKeyword(text: string): NumberField[] {
const results: NumberField[] = [];
const keywords = ['合计', '总计', '实付', '应付', '金额', '总额', 'Total', 'Amount'];
for (let k = 0; k < keywords.length; k++) {
const keyword = keywords[k];
const idx = text.indexOf(keyword);
i... | 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 matchAmountWithKeyword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST... | private static matchAmountWithKeyword(text: string): NumberField[] {
const results: NumberField[] = [];
const keywords = ['合计', '总计', '实付', '应付', '金额', '总额', 'Total', 'Amount'];
for (let k = 0; k < keywords.length; k++) {
const keyword = keywords[k];
const idx = text.indexOf(keyword);
i... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 365a2b82a6d5d609d743f8f71dba91eeefa8bcad | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets | arkts | forEach | Executes a provided function once per each key/value pair in the TreeMap
@param callbackfn: the function to apply | override forEach(callbackfn: TreeMapForEachCb<K, V>): void {
const entriesIter =
this.mappedIterator<TreeMapEntry<K, V>>((e: TreeMapEntry<K, V>): TreeMapEntry<K, V> => e);
this.iteratorForEach<TreeMapEntry<K, V>>(entriesIter, (e: TreeMapEntry<K, V>): void => {
callbackfn(e.va... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Rig... | override forEach(callbackfn: TreeMapForEachCb<K, V>): void {
const entriesIter =
this.mappedIterator<TreeMapEntry<K, V>>((e: TreeMapEntry<K, V>): TreeMapEntry<K, V> => e);
this.iteratorForEach<TreeMapEntry<K, V>>(entriesIter, (e: TreeMapEntry<K, V>): void => {
callbackfn(e.va... | https://gitcode.com/iop123123/arkts-static-skills | e32323a8ce709bb3833dcb1b587ac3ef53bdf8f4 | gitcode |
2763981847/Accounting-app | entry/src/main/ets/pages/MainPage.ets | arkts | filterAccounts | 过滤账单列表 | filterAccounts() {
let temp = this.accounts;
// 模糊查询
if (this.searchText && this.searchText != '') {
temp = temp.filter(account =>
account.desc.includes(this.searchText) ||
account.typeText.includes(this.searchText) ||
account.amount.toString() === this.searchText
);
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left filterAccounts 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... | filterAccounts() {
let temp = this.accounts;
// 模糊查询
if (this.searchText && this.searchText != '') {
temp = temp.filter(account =>
account.desc.includes(this.searchText) ||
account.typeText.includes(this.searchText) ||
account.amount.toString() === this.searchText
);
}
... | https://github.com/2763981847/Accounting-app | a1acf70bb9f4b6874a24da1cef1894f2ccc9e755 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneCapturer.ets | arkts | start | 启动麦克风捕获 | async start(): Promise<boolean> {
if (this.running) {
console.info(TAG, '麦克风捕获已在运行');
return true;
}
this.state = MicrophoneState.INITIALIZING;
try {
// 配置 AudioCapturer
const audioStreamInfo: audio.AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAM... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async start(): Promise<boolean> {
if (this.running) {
console.info(TAG, '麦克风捕获已在运行');
return true;
}
this.state = MicrophoneState.INITIALIZING;
try {
// 配置 AudioCapturer
const audioStreamInfo: audio.AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAM... | https://github.com/AlkaidLab/moonlight-harmony | ca07a44e992012e74b56d3033b936ac722a2785c | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | saveWebState | Updates web state and save them to disk.
@returns True if succeeded, false if failed. | async saveWebState(sourceInfo: string = 'x') {
if (!this.isActive) {
return false;
}
const startTime = Date.now();
const myTabs = AppStorageV2.connect(meowTabsBunch, `meowTabsBunch_${this.myUi.windowId}`)!;
let state: Uint8Array = new Uint8Array();
const label = this.title || '';
co... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveWebState AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceInfo AST#identifier#Right ... | async saveWebState(sourceInfo: string = 'x') {
if (!this.isActive) {
return false;
}
const startTime = Date.now();
const myTabs = AppStorageV2.connect(meowTabsBunch, `meowTabsBunch_${this.myUi.windowId}`)!;
let state: Uint8Array = new Uint8Array();
const label = this.title || '';
co... | https://github.com/awaLiny2333/LinysBrowser_NEXT | fdfc738589f5d768a9b6520772e1f51828a56d32 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Long.ets | arkts | compareTo | Compares this instance to other Long object
The result is less than 0 if this instance lesser than provided object
0 if they are equal
and greater than 0 otherwise.
@param other Long object to compare with
@returns result of the comparison | public override compareTo(other: Long): int {
return (this.value - other.unboxed()) as int;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public override compareTo(other: Long): int {
return (this.value - other.unboxed()) as int;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a75fb93b99a55355d26f97351fc0299532850b88 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/EventSourcingService.ets | arkts | generateCommandId | 生成命令ID | private static generateCommandId(): string {
const timestamp = Date.now();
const random = Math.floor(Math.random() * 10000);
return `cmd_${timestamp}_${random}`;
} | 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 generateCommandId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private static generateCommandId(): string {
const timestamp = Date.now();
const random = Math.floor(Math.random() * 10000);
return `cmd_${timestamp}_${random}`;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a30971938e841ed225eb288cc33d36d50fad23c8 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/DateUtils.ets | arkts | format | 格式化时间
@param date
@returns | public static format(date: Date | undefined): string {
if (!date) {
return '';
}
return DateUtils.dateFormat.format(date);
} | 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 format AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Rig... | public static format(date: Date | undefined): string {
if (!date) {
return '';
}
return DateUtils.dateFormat.format(date);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/DateUtils.ets#L45-L50 | 17ba737378f0638aa7c042d1f18d7cc5b024397e | github |
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/repository/ResourcesRepository.ets | arkts | toggleCollected | Switches whether a user has collected a resource
@param pageNum
@returns | toggleCollected(resourceId: string, operation: number) {
this.funNetwork.toggleCollected(resourceId, operation);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleCollected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right... | toggleCollected(resourceId: string, operation: number) {
this.funNetwork.toggleCollected(resourceId, operation);
} | https://github.com/who7708/harmonyos-codelabs | 1439dcb0cd165c400014dd2a9afd607a1566970e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportNovelChapters | 导出小说章节表 | private async exportNovelChapters(): Promise<NovelChapterBackup[]> {
try {
const sql = 'SELECT * FROM novel_chapter ORDER BY bookId ASC, chapterIndex ASC';
const results = await this.dbManager.querySql(sql);
const items: NovelChapterBackup[] = [];
for (const record of results) {
c... | 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 exportNovelChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async exportNovelChapters(): Promise<NovelChapterBackup[]> {
try {
const sql = 'SELECT * FROM novel_chapter ORDER BY bookId ASC, chapterIndex ASC';
const results = await this.dbManager.querySql(sql);
const items: NovelChapterBackup[] = [];
for (const record of results) {
c... | https://github.com/DaLongZhuaZi/manxia | e6a83c6afb268bc178893b430b7bb57c78d02af9 | github |
honjow/Next2V | shared/src/main/ets/storage/SyncedKv.ets | arkts | get | Read one value, or null if absent. Reads degrade to null on error so a missing flag never throws. | static async get(
context: common.UIAbilityContext,
namespace: string,
key: string,
): Promise<string | null> {
try {
const store = await LocalDataStore.open(context)
const args: relationalStore.ValueType[] = [SyncedKv.composeKey(namespace, key)]
const resultSet = await store.query... | 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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Righ... | static async get(
context: common.UIAbilityContext,
namespace: string,
key: string,
): Promise<string | null> {
try {
const store = await LocalDataStore.open(context)
const args: relationalStore.ValueType[] = [SyncedKv.composeKey(namespace, key)]
const resultSet = await store.query... | https://github.com/honjow/Next2V | 25c1155fc00d1704db1b62397c6e3e3ef07197bf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | setDuplicateDetectionEnabled | 设置重复检测是否启用 | async setDuplicateDetectionEnabled(enabled: boolean): Promise<void> {
await this.setBoolean(SettingKeys.DUPLICATE_DETECTION_ENABLED, enabled);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setDuplicateDetectionEnabled AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#ident... | async setDuplicateDetectionEnabled(enabled: boolean): Promise<void> {
await this.setBoolean(SettingKeys.DUPLICATE_DETECTION_ENABLED, enabled);
} | https://github.com/DaLongZhuaZi/manxia | 15bfa536f0733150380670ea6d6ad2ddd94337d8 | github |
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, array: BigUint64Array) => boolean): BigUint64Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resL... | 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, array: BigUint64Array) => boolean): BigUint64Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resL... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 9d7faafea91c52c02ff9de8159d1a4348d4c355f | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/pages/SettingsPage.ets | arkts | showLicenseInfo | 显示开源许可信息 | showLicenseInfo(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('确定', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'MIT License',
'MIT License\n\nCopyright (c) 2025 chen yunliang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showLicenseInfo 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_bl... | showLicenseInfo(): void {
const buttons: ButtonOptions[] = [
new ButtonOptions('确定', '#007AFF')
];
UIUtils.showDialog(new DialogOptions(
'MIT License',
'MIT License\n\nCopyright (c) 2025 chen yunliang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this... | https://github.com/pangpang20/antennaPodHM | b50fc7d0fe9a47de3cab6e4a26071ec9c8bd9b64 | github |
LZZLHY/hlib | entry/src/main/ets/utils/PublicDownloadDir.ets | arkts | isSupported | 本设备是否“有办法”保存到公共下载目录(两路都算,恒 true)。 | static isSupported(): boolean {
return true;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isSupported 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#b... | static isSupported(): boolean {
return true;
} | https://github.com/LZZLHY/hlib | a68099b24dea62506522e15aecb7b4a66310967f | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/utils/ToolKits.ets | arkts | showToast | 显示奶油提示。
@param message 提示内容
@param duration 持续时间(单位:毫秒),默认1500 | static showToast(message: string | Resource, duration: number = 1500) {
promptAction.showToast({
message: message,
duration: duration,
// 软键盘弹出时,防止Toast上抬,详见: https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section381324419328
showMode: promptAc... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L... | static showToast(message: string | Resource, duration: number = 1500) {
promptAction.showToast({
message: message,
duration: duration,
// 软键盘弹出时,防止Toast上抬,详见: https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section381324419328
showMode: promptAc... | https://github.com/JackJiang2011/harmonychat | e8a3b069a6400040395623be3eb03e696f9ca9ec | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/ArrayBuffer.ets | arkts | slice | Creates a new ArrayBuffer with copy of bytes in range [begin;end)
@param begin an inclusive index to start copying with
@param end a last exclusive index to stop copying
@returns data taken from current ArrayBuffer with respect to begin and end parameters | public slice(begin: number, end: number): ArrayBuffer {
return this.slice(begin as int, end as double)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number, end: number): ArrayBuffer {
return this.slice(begin as int, end as double)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e9bafedbe35a7aa164b89126d79ee1511b665731 | gitee |
arkui-x/samples | CodeLab/Cases/feature/eraser/src/main/ets/pages/EraserMainPage.ets | arkts | redo | 恢复上一次撤销 | redo() {
if (this.currentImageNode !== null) {
// cacheStack顶部的pixelMap出栈,推入绘制历史记录pixelMapHistory栈中
const pixelMap = this.currentImageNode.cacheStack.pop();
if (pixelMap) {
this.currentImageNode.pixelMapHistory.push(pixelMap);
}
// 节点重新渲染,将此时pixelMapHistory栈顶的pixelMap绘制到画布上
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left if... | redo() {
if (this.currentImageNode !== null) {
// cacheStack顶部的pixelMap出栈,推入绘制历史记录pixelMapHistory栈中
const pixelMap = this.currentImageNode.cacheStack.pop();
if (pixelMap) {
this.currentImageNode.pixelMapHistory.push(pixelMap);
}
// 节点重新渲染,将此时pixelMapHistory栈顶的pixelMap绘制到画布上
... | https://gitcode.com/arkui-x/samples | 9a9588d2335d3725c49d8c54f5431369739ef11e | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test19_original_index.ets | arkts | testStringConcat | --- String concatenation patterns --- | function testStringConcat(): string {
let a: string = 'Hello';
let b: string = ' ';
let c: string = 'World';
let combined: string = a + b + c + '!';
return combined;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringConcat 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... | function testStringConcat(): string {
let a: string = 'Hello';
let b: string = ' ';
let c: string = 'World';
let combined: string = a + b + c + '!';
return combined;
} | https://github.com/miaochiahao/ark-ghidra | 7f021cd443ea37ed108b34b48309a6f637d25f9e | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/SyncService.ets | arkts | loadLastSyncTime | 加载上次同步时间 | private async loadLastSyncTime(): Promise<void> {
try {
const response = await HttpUtil.get<SyncStatus>('/sync/status');
if (response.success && response.data) {
this.lastSyncTime = response.data.lastSyncTime;
}
} catch (error) {
console.error('加载同步状态失败:', error);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadLastSyncTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private async loadLastSyncTime(): Promise<void> {
try {
const response = await HttpUtil.get<SyncStatus>('/sync/status');
if (response.success && response.data) {
this.lastSyncTime = response.data.lastSyncTime;
}
} catch (error) {
console.error('加载同步状态失败:', error);
}
} | https://github.com/LJ666-ui/harmony-health-care | 666e6e7eba8fcd6e43d86038eaec0ac28802845f | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | exp | Return a new Decimal whose value is the natural exponential of `n`, rounded to `precision`
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | static exp(n: Value): Decimal {
return new Decimal(n).exp();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left exp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static exp(n: Value): Decimal {
return new Decimal(n).exp();
} | https://gitcode.com/iop123123/arkts-static-skills | 2b9f1bd7ae7047abb8fc1d5c7914f1923c73a20f | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/DistributedKVService.ets | arkts | close | 关闭KVStore | public static close(): void {
try {
// 取消订阅设备状态变化
if (DistributedKVService.deviceManager) {
DistributedKVService.deviceManager.off('deviceStateChange', DistributedKVService.onDeviceStateChange);
}
// 取消订阅KVStore事件
if (DistributedKVService.kvStore) {
DistributedKVServi... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left close AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right ... | public static close(): void {
try {
// 取消订阅设备状态变化
if (DistributedKVService.deviceManager) {
DistributedKVService.deviceManager.off('deviceStateChange', DistributedKVService.onDeviceStateChange);
}
// 取消订阅KVStore事件
if (DistributedKVService.kvStore) {
DistributedKVServi... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L332-L356 | 16c1e4bd34d3d54d7ea6fac6a1376b10497055cd | github |
1ilI/WebViewJavascriptBridge_harmony | webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets | arkts | objToStrKeyMap | 传入任意 Object 类型,获得 Map<string, Object> 字典类型
@param obj 任意类型数据
@param def 默认值
@returns Map<string, Object> 字典类型 | public static objToStrKeyMap(obj: Object | undefined | null, def?: Map<string, Object>): Map<string, Object> {
let result: Map<string, Object> = def ?? new Map<string, Object>();
// 传入的 obj 为空
if (obj === undefined || obj === null) {
return result;
}
// 是 Map 类型的
if (obj instanceof Map)... | 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 objToStrKeyMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AS... | public static objToStrKeyMap(obj: Object | undefined | null, def?: Map<string, Object>): Map<string, Object> {
let result: Map<string, Object> = def ?? new Map<string, Object>();
// 传入的 obj 为空
if (obj === undefined || obj === null) {
return result;
}
// 是 Map 类型的
if (obj instanceof Map)... | https://github.com/1ilI/WebViewJavascriptBridge_harmony | f385fa25e2e9b5d57c5d99b7617b6d1dcc79bbcb | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | visitRepeatedDouble | 访问 repeated double 字段
JSON: array of number | visitRepeatedDouble(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
// 处理特殊值
const jsonValues = value.map(v => {
if (isNaN(v)) return "NaN"
if (v === Infinity) return "Infinity"
if (v === -Infinity) return "-Infinity"
return v
})
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedDouble 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 numbe... | visitRepeatedDouble(value: number[], fieldNumber: number): void {
const fieldName = this.getFieldName(fieldNumber)
// 处理特殊值
const jsonValues = value.map(v => {
if (isNaN(v)) return "NaN"
if (v === Infinity) return "Infinity"
if (v === -Infinity) return "-Infinity"
return v
})
... | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 46312304172af3b15b7c4cbea6e0388f73306abe | gitcode |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/NoteUtil.ets | arkts | getNoteCount | Get Note Count in folder
@param noteDataArray
@param folderData
@return number - Note Count | getNoteCount(noteDataArray: NoteData[], folderData: FolderData): number {
let count = 0;
const folderTextMap: Record<string, (noteData: NoteData) => void> = {
"sys_def_allNotes_uuid": (noteData: NoteData) => {
noteData.is_deleted == Delete.No ? ++count : count;
},
"sys_def_recentDele... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNoteCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left noteDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Right AST#[#Left [ AST#[#R... | getNoteCount(noteDataArray: NoteData[], folderData: FolderData): number {
let count = 0;
const folderTextMap: Record<string, (noteData: NoteData) => void> = {
"sys_def_allNotes_uuid": (noteData: NoteData) => {
noteData.is_deleted == Delete.No ? ++count : count;
},
"sys_def_recentDele... | https://gitee.com/openharmony/applications_notes.git | fd034e8c455ba7c77f301b904bdeeb0c1c9da40a | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | fill | Fills the Uint8ClampedArray with specified value
@param value new valuy
@returns modified Uint8ClampedArray | public fill(value: number, start: number): Uint8ClampedArray {
return this.fill(value as number, start as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public fill(value: number, start: number): Uint8ClampedArray {
return this.fill(value as number, start as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c39033d64e1aa3b83aa5f8f16583b807e3a4f795 | gitee |
HarmonyOS_Samples/BestPracticeSnippets | HDRVivid/AVCodecVideo/entry/src/main/ets/pages/Recorder.ets | arkts | setColorSpaceBeforeCommitConfig | Set the color space | function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: boolean): void {
let colorSpace: colorSpaceManager.ColorSpace =
isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT;
let colorSpaces: Array<colorSpaceManager.ColorSpace> = getSupportedColor... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left setColorSpaceBeforeCommitConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left session AST#identifier#Right AST#type_annotation#Left ... | function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: boolean): void {
let colorSpace: colorSpaceManager.ColorSpace =
isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT;
let colorSpaces: Array<colorSpaceManager.ColorSpace> = getSupportedColor... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | a7ee66cb33f52d3648cad97fa38cf3ea8d4d50e5 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | getLatestCrashLogPath | 获取最新崩溃日志文件路径 | public async getLatestCrashLogPath(): Promise<string | null> {
try {
const files = await this.getCrashLogFiles();
if (files.length > 0 && this.logDirPath) {
return `${this.logDirPath}/${files[0]}`;
}
} catch (error) {
const err = error as BusinessError;
hilog.error(DOMAIN... | 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 getLatestCrashLogPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | public async getLatestCrashLogPath(): Promise<string | null> {
try {
const files = await this.getCrashLogFiles();
if (files.length > 0 && this.logDirPath) {
return `${this.logDirPath}/${files[0]}`;
}
} catch (error) {
const err = error as BusinessError;
hilog.error(DOMAIN... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L452-L463 | 887b768aac435b05c33e5e7d486f0ac401c59af5 | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/pages/24Points.ets | arkts | submitAnswer | 提交答案 - 新思路实现 | submitAnswer() {
// 玩家提交表达式,表示认为有解
this.playerJudgment = 'solved';
if (!this.inputExpression) {
this.gameMessage = '请输入表达式';
this.showMessage = true;
return;
}
// 使用新的解析方法验证表达式
const result = Game24Points.parseAndEvaluate(this.inputExpression, this.cards);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left submitAnswer 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 ... | submitAnswer() {
// 玩家提交表达式,表示认为有解
this.playerJudgment = 'solved';
if (!this.inputExpression) {
this.gameMessage = '请输入表达式';
this.showMessage = true;
return;
}
// 使用新的解析方法验证表达式
const result = Game24Points.parseAndEvaluate(this.inputExpression, this.cards);
... | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | aae40256ec4dea2dfa476f052966fcf79511ffbc | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Float64Array with respect to length.
@param { number } length - Number of elements
@throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / Float64Array.BYTES_PER_ELEMENT).toInt()) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLength = t... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public constructor(length: number) {
if (length < 0 || length > (Int.MAX_VALUE / Float64Array.BYTES_PER_ELEMENT).toInt()) {
throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer")
}
this.lengthInt = length.toInt()
this.byteLength = t... | https://gitcode.com/iop123123/arkts-static-skills | 906f09775c70c9b5b8f143b6797f8fb9919780b8 | gitcode |
Bistu-OSSDT-2024/16-ArkNotes | database/MemoTable.ets | arkts | insertData | 插入数据的方法,接收单条memo笔记对象,和回调函数 | insertData(memo: MemoModel, callback: Function) {
// 通过工具函数,将单条memo笔记,转化为存储健值对
const valueBucket: relationalStore.ValuesBucket = generateBucket(memo);
// 执行memoTable的插入数据方法,透传回调函数
this.memoTable.insertData(valueBucket, callback);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insertData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left memo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MemoModel AST#identifier#Right... | insertData(memo: MemoModel, callback: Function) {
// 通过工具函数,将单条memo笔记,转化为存储健值对
const valueBucket: relationalStore.ValuesBucket = generateBucket(memo);
// 执行memoTable的插入数据方法,透传回调函数
this.memoTable.insertData(valueBucket, callback);
} | https://github.com/Bistu-OSSDT-2024/16-ArkNotes | c53e3c81fef8cb1e7bc6bc37e1bbe1012d5ee725 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/DetailPageViewModel.ets | arkts | redirectEditPage | Button for redirecting to the details page. | redirectEditPage(name: string, address: string, telephony: string, email: string, remarks: string): void {
let routerParameter: router.RouterOptions = {
url: CommonConstants.ADD_EDIT_URL,
params: {
isEdit: true,
name,
address,
telephony,
email,
remarks
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redirectEditPage 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 ... | redirectEditPage(name: string, address: string, telephony: string, email: string, remarks: string): void {
let routerParameter: router.RouterOptions = {
url: CommonConstants.ADD_EDIT_URL,
params: {
isEdit: true,
name,
address,
telephony,
email,
remarks
... | https://gitee.com/harmonyos/codelabs.git | c5954bdc8eabda03c2f8edcb67fbf868541f8758 | gitee |
HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | entry/src/main/ets/utils/Logger.ets | arkts | info | Outputs info-level logs
@param format format Indicates the log format string
@param args args Indicates the log parameters | info(format: string, ...args: Object[]): void {
hilog.info(this.domain, this.prefix, format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left info AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Ri... | info(format: string, ...args: Object[]): void {
hilog.info(this.domain, this.prefix, format, args);
} | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | 53c888c0166567a8e81b93b72aafe7197986a520 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SettingsManager.ets | arkts | setDuplicateDetectionScope | 设置重复检测范围 | async setDuplicateDetectionScope(scope: string): Promise<void> {
await this.setString(SettingKeys.DUPLICATE_DETECTION_SCOPE, scope);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setDuplicateDetectionScope AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identif... | async setDuplicateDetectionScope(scope: string): Promise<void> {
await this.setString(SettingKeys.DUPLICATE_DETECTION_SCOPE, scope);
} | https://github.com/DaLongZhuaZi/manxia | cb2f5f4e7e61825b0087fc8a6463f17be9fce41c | github |
openharmony/developtools_ace_ets2bundle | arkui-plugins/test/demo/mock/decorators/watch/watch-basic.ets | arkts | build | @Consume @Watch('ConsumeOnChange') providevar: string;
ConsumeOnChange(propName: string) {} | build() {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}#Left } AST#}#Right AST#statem... | build() {} | https://gitee.com/openharmony/developtools_ace_ets2bundle.git | dc903d46ecc2dc27dee62cdfedf3439aeb3155b8 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/GroupManagementDialog.ets | arkts | refreshGroupData | 刷新分组数据 | refreshGroupData(): void {
if (this.callbacks?.onRefresh) {
this.groups = this.callbacks.onRefresh();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left refreshGroupData 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_expressio... | refreshGroupData(): void {
if (this.callbacks?.onRefresh) {
this.groups = this.callbacks.onRefresh();
}
} | https://github.com/DaLongZhuaZi/manxia | 3edca61ca5ab5c64ae788b6958e4de9db85a6ae1 | github |
2763981847/Clock-Alarm | entry/src/main/ets/pages/DetailPage.ets | arkts | onAlarmItemChange | 当 alarmItem 属性变化时触发,用于更新数据 | onAlarmItemChange() {
this.initData();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAlarmItemChange 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#... | onAlarmItemChange() {
this.initData();
} | https://github.com/2763981847/Clock-Alarm | d465b35bc0622996d92bdc80237a7a98033dd15f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Authentication/LoginManager.ets | arkts | buildFormData | 构建表单数据 | private buildFormData(data: Record<string, string>): string {
const parts: string[] = [];
const keys = Object.keys(data);
for (const key of keys) {
const value = data[key];
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
}
return parts.join('&');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_e... | private buildFormData(data: Record<string, string>): string {
const parts: string[] = [];
const keys = Object.keys(data);
for (const key of keys) {
const value = data[key];
parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
}
return parts.join('&');
} | https://github.com/DaLongZhuaZi/manxia | 436850e7c225629be8ed65d0a00318cd3514fe18 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/ShortcutManager.ets | arkts | reorderShortcut | 移动快捷键到新位置 | async reorderShortcut(fromIndex: number, toIndex: number): Promise<void> {
if (fromIndex < 0 || fromIndex >= this.shortcuts.length ||
toIndex < 0 || toIndex >= this.shortcuts.length ||
fromIndex === toIndex) return;
const item = this.shortcuts.splice(fromIndex, 1)[0];
this.shortcuts.s... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reorderShortcut AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fromIndex AST#identifier#Righ... | async reorderShortcut(fromIndex: number, toIndex: number): Promise<void> {
if (fromIndex < 0 || fromIndex >= this.shortcuts.length ||
toIndex < 0 || toIndex >= this.shortcuts.length ||
fromIndex === toIndex) return;
const item = this.shortcuts.splice(fromIndex, 1)[0];
this.shortcuts.s... | https://github.com/AlkaidLab/moonlight-harmony | b2b52a823870d6023ff7e4fd6ec3993a1dd8158c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets | arkts | $_get | Gets a JSON element from an array by index.
@param {int} index - The index to look up
@returns {JsonElement} The JSON element associated with the index
@throws {JsonTypeError} If this element is not an array
@throws {RangeError} If the index is out of range | $_get(index: int): JsonElement {
if (this.jsonType != JsonType.JsonArray) {
throw new JsonTypeError("This value's ValueKind is not Array.")
}
if (this.maybeArrayValues == undefined || index < 0 || index >= this.maybeArrayValues!.length) {
throw... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left $_get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right... | $_get(index: int): JsonElement {
if (this.jsonType != JsonType.JsonArray) {
throw new JsonTypeError("This value's ValueKind is not Array.")
}
if (this.maybeArrayValues == undefined || index < 0 || index >= this.maybeArrayValues!.length) {
throw... | https://gitcode.com/iop123123/arkts-static-skills | 8a925f9256ad82d7e18d8efa23f2d0eaa7228fda | gitcode |
Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageDestroy | Called when the window stage is destroyed | onWindowStageDestroy() {
LifeCycleLog.add('⚠️ onWindowStageDestroy: WindowStage destroyed.');
// Unsubscribe from windowStageEvent to prevent memory leaks
this.windowStage?.off('windowStageEvent');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | onWindowStageDestroy() {
LifeCycleLog.add('⚠️ onWindowStageDestroy: WindowStage destroyed.');
// Unsubscribe from windowStageEvent to prevent memory leaks
this.windowStage?.off('windowStageEvent');
} | https://github.com/Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle | a83bf68d607b80f1a1d17e972c5f6932da888129 | github |
openharmony/applications_app_samples | code/AI/MindSporeLiteCDemoASR/entry/src/main/ets/pages/player.ets | arkts | avPlayerFdSrcDemo | 使用资源管理接口获取音频文件并通过fdSrc属性进行播放。 | async avPlayerFdSrcDemo() {
// 创建avPlayer实例对象。
let avPlayer: media.AVPlayer = await media.createAVPlayer();
// 创建状态机变化回调函数。
this.setAVPlayerCallback(avPlayer);
// 通过UIAbilityContext的resourceManager成员的getRawFd接口获取媒体资源播放地址。
// 返回类型为{fd,offset,length},fd为HAP包fd地址,offset为媒体资源偏移量,length为播放长度。
l... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left avPlayerFdSrcDemo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#co... | async avPlayerFdSrcDemo() {
// 创建avPlayer实例对象。
let avPlayer: media.AVPlayer = await media.createAVPlayer();
// 创建状态机变化回调函数。
this.setAVPlayerCallback(avPlayer);
// 通过UIAbilityContext的resourceManager成员的getRawFd接口获取媒体资源播放地址。
// 返回类型为{fd,offset,length},fd为HAP包fd地址,offset为媒体资源偏移量,length为播放长度。
l... | https://github.com/openharmony/applications_app_samples | 2a80f9a95b35628a172665162ee1b1fe30ab0a98 | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | isNRSupported | 判断当前设备是否支持NR(New Radio)。也就是5G。
@param slotId 卡槽ID,不传默认主卡。 | static isNRSupported(slotId?: number): boolean {
if (slotId) {
return radio.isNRSupported(slotId);
}
return radio.isNRSupported();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNRSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#R... | static isNRSupported(slotId?: number): boolean {
if (slotId) {
return radio.isNRSupported(slotId);
}
return radio.isNRSupported();
} | https://github.com/tdcare/tdwebrtc | 3a08d258a3a9109177230bfd77054c4c8b4fdadd | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/utils/AsrDisplayManager.ets | arkts | removeListener | Remove a listener | removeListener(callback: () => void): void {
this.listeners.delete(callback);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left removeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arg... | removeListener(callback: () => void): void {
this.listeners.delete(callback);
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 324607f268f22e333ad9d8feb07649fe16c3b311 | github |
HarmonyOS_Samples/sample_in_harmonyos | common/src/main/ets/pushservice/PushServiceManager.ets | arkts | requestEnableNotification | Get the notification enable result, if not enabled, invoke notificationManager's requestEnableNotification.
@param context common.UIAbilityContext
@returns Promise | private requestEnableNotification(context: common.UIAbilityContext): Promise<boolean | void> {
try {
const enabled: boolean = notificationManager.isNotificationEnabledSync();
if (!enabled) {
return notificationManager.requestEnableNotification(context).then(() => {
Logger.info(TAG, '... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left requestEnableNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private requestEnableNotification(context: common.UIAbilityContext): Promise<boolean | void> {
try {
const enabled: boolean = notificationManager.isNotificationEnabledSync();
if (!enabled) {
return notificationManager.requestEnableNotification(context).then(() => {
Logger.info(TAG, '... | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 1b89b1e060f2c33667c974818c59707f8432ea9d | gitcode |
openharmony/applications_filepicker | entry/src/main/ets/pages/component/myphone/FilesList.ets | arkts | clickFolder | 点击文件夹 | clickFolder() {
this.direList.push({
title: this.fileItem.fileName,
url: this.fileItem.uri,
fileIterator: this.fileItem.fileIterator
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | clickFolder() {
this.direList.push({
title: this.fileItem.fileName,
url: this.fileItem.uri,
fileIterator: this.fileItem.fileIterator
});
} | https://gitee.com/openharmony/applications_filepicker.git | 12838d3d3f98be3908503e6592800296c5879b9f | gitee |
HarmonyOS_Samples/guide-snippets | Ability/StartOptions/HideSplashScreen/src/main/ets/hidesplashscreenability/HideSplashScreenAbility.ets | arkts | onForeground | [EndExclude startOptions_hidesplash] | onForeground(): void {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
let want: Want = {
deviceId: '', // deviceId为空表示本设备
bundleName: 'com.example.startoptions',
abilityName: 'EntryAbility',
parameters: {
// 自定义信息
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | onForeground(): void {
// Ability has brought to foreground
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
let want: Want = {
deviceId: '', // deviceId为空表示本设备
bundleName: 'com.example.startoptions',
abilityName: 'EntryAbility',
parameters: {
// 自定义信息
... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | f7c7f0e510566dc5391844d8fdf8c581461359b6 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | showChangelog | 显示更新日志 | showChangelog(title: string = '更新日志', content: string, source: ContentSource = ContentSource.INLINE): string {
return this.addTab({
title,
type: ContentPanelType.CHANGELOG,
source,
content,
icon: $r('sys.symbol.doc_text_fill')
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showChangelog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left string AST... | showChangelog(title: string = '更新日志', content: string, source: ContentSource = ContentSource.INLINE): string {
return this.addTab({
title,
type: ContentPanelType.CHANGELOG,
source,
content,
icon: $r('sys.symbol.doc_text_fill')
});
} | https://github.com/DaLongZhuaZi/manxia | 5b73b74c269567994eb885b63ce17267bd6f20ea | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/SearchVM.ets | arkts | describeError | 把异常映射为人类可读文案。CfBlockedError 由调用方单独处理(弹切线路对话框)。
区分 HTTP 状态码与网络错误,给用户具体可执行的提示。 | static describeError(err: Object): string {
// 搜索特殊化:HttpStatusError 400 在搜索语境下通常是关键词/筛选问题
if (err instanceof HttpStatusError) {
const httpErr: HttpStatusError = err as HttpStatusError;
if (httpErr.statusCode === 400) {
return I18n.ts('err_search_400');
}
}
return ErrorHelper... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left describeError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Obj... | static describeError(err: Object): string {
// 搜索特殊化:HttpStatusError 400 在搜索语境下通常是关键词/筛选问题
if (err instanceof HttpStatusError) {
const httpErr: HttpStatusError = err as HttpStatusError;
if (httpErr.statusCode === 400) {
return I18n.ts('err_search_400');
}
}
return ErrorHelper... | https://github.com/LZZLHY/hlib | cfdfd39501608be9fe786e8f9b819b7ccfc867e1 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | getUIEventListener | Get UI event listener | getUIEventListener(): UIEventListener | null {
return this.uiEventListener;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUIEventListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | getUIEventListener(): UIEventListener | null {
return this.uiEventListener;
} | https://github.com/tangwengang-del/freerdp-harmonyos | eb04056fad74eff1cc4441473b33b5429dd03d92 | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/features/learning/src/main/ets/model/LearningModel.ets | arkts | getLearningMap | Get learning path map.
@returns learningMap | getLearningMap(): Map<string, LearningPath> {
if (!this.learningMap) {
let map = new Map<string, LearningPath>();
DEFAULT_PATHS.forEach((item: LearningPath) => {
map.set(item.id, item);
});
this.learningMap = map;
}
return this.learningMap;
} | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLearningMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#... | getLearningMap(): Map<string, LearningPath> {
if (!this.learningMap) {
let map = new Map<string, LearningPath>();
DEFAULT_PATHS.forEach((item: LearningPath) => {
map.set(item.id, item);
});
this.learningMap = map;
}
return this.learningMap;
} | https://gitcode.com/HarmonyOS_Samples/hmosworld | 9716f7cb4531cb4f882096fcf306a31a7ad82a02 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets | arkts | evaluateBound | TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 | evaluateBound(): void {
const xBol = constrainOffsetAndAnimation({
dimensionWH: ImageFitType.TYPE_WIDTH,
imageDefaultSize: this.imageDefaultSize,
imageOffsetInfo: this.imageOffsetInfo,
scaleValue: this.imageScaleInfo.scaleValue,
rotate: this.imageRotateInfo.lastRotate,
TogglePe... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left evaluateBound 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... | evaluateBound(): void {
const xBol = constrainOffsetAndAnimation({
dimensionWH: ImageFitType.TYPE_WIDTH,
imageDefaultSize: this.imageDefaultSize,
imageOffsetInfo: this.imageOffsetInfo,
scaleValue: this.imageScaleInfo.scaleValue,
rotate: this.imageRotateInfo.lastRotate,
TogglePe... | https://gitcode.com/arkui-x/samples | 3a2d893e5d330ee5241782c3fd19f50e8ac26d6f | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WordRepository.ets | arkts | loadFromRawfile | Load and parse `rawfile/data/words_v1.json` (or a caller-provided path)
via the HarmonyOS resource manager. Safe to call more than once; the last
successful load replaces the cache. | async loadFromRawfile(
context: common.UIAbilityContext,
rawfilePath: string = DEFAULT_WORDS_RAWFILE
): Promise<void> {
try {
const bytes: Uint8Array = await context.resourceManager.getRawFileContent(rawfilePath);
const decoder: util.TextDecoder = util.TextDecoder.create('utf-8');
cons... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadFromRawfile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async loadFromRawfile(
context: common.UIAbilityContext,
rawfilePath: string = DEFAULT_WORDS_RAWFILE
): Promise<void> {
try {
const bytes: Uint8Array = await context.resourceManager.getRawFileContent(rawfilePath);
const decoder: util.TextDecoder = util.TextDecoder.create('utf-8');
cons... | https://github.com/terryma2024/happyword | 4db2dfd05fc3cde5ea8cd0e6af87fe4f8ca98863 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/ApiClient.ets | arkts | unfollowUser | 取消关注用户 | async unfollowUser(username: string): Promise<void> {
const trimmed: string = username !== undefined && username !== null ? username.trim() : '';
if (trimmed.length === 0) {
return;
}
const path: string = ApiConstants.followUser(trimmed);
const body: Record<string, Object> = {};
body['st... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unfollowUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async unfollowUser(username: string): Promise<void> {
const trimmed: string = username !== undefined && username !== null ? username.trim() : '';
if (trimmed.length === 0) {
return;
}
const path: string = ApiConstants.followUser(trimmed);
const body: Record<string, Object> = {};
body['st... | https://github.com/Amaz1ny/HarmonyDO-public | 09d8b13ae737ef76025e7e26f73ba99bc374261f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | findElementsByTag | 按标签名查找元素
添加性能保护:限制元素数量和内容大小以避免ANR | private findElementsByTag(content: string, tagName: string, maxElementsHint: number = 0): string[] {
const results: string[] = [];
// 性能保护:使用统一配置
let maxElements = this.getMaxElements(PerformanceConfig.MAX_ELEMENTS);
if (maxElementsHint > 0) {
maxElements = Math.min(maxElements, maxElements... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findElementsByTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | private findElementsByTag(content: string, tagName: string, maxElementsHint: number = 0): string[] {
const results: string[] = [];
// 性能保护:使用统一配置
let maxElements = this.getMaxElements(PerformanceConfig.MAX_ELEMENTS);
if (maxElementsHint > 0) {
maxElements = Math.min(maxElements, maxElements... | https://github.com/DaLongZhuaZi/manxia | cb2eba0c4a4898d05a99d596cb80b9aec650e94e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | loadThresholds | 从配置加载阈值 | private loadThresholds(): void {
// 使用默认阈值,不再依赖配置管理器
logger.debug(PERFORMANCE_ANALYZER_TAG, '使用默认性能阈值');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadThresholds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr... | private loadThresholds(): void {
// 使用默认阈值,不再依赖配置管理器
logger.debug(PERFORMANCE_ANALYZER_TAG, '使用默认性能阈值');
} | https://github.com/DaLongZhuaZi/manxia | 8985e8193b1ea4c64a75adcb93c29c2a6dbc4569 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets | arkts | processPendingTasks | 处理等待中的任务 | private async processPendingTasks(): Promise<void> {
if (!this.isReady || !this.webviewController || this.pendingTasks.length === 0) {
return;
}
const task = this.pendingTasks.shift();
if (!task) {
return;
}
logger.debug(TAG, `开始执行WebView JS任务,剩余队列: ${this.pendingTasks.length}`);... | 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 processPendingTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async processPendingTasks(): Promise<void> {
if (!this.isReady || !this.webviewController || this.pendingTasks.length === 0) {
return;
}
const task = this.pendingTasks.shift();
if (!task) {
return;
}
logger.debug(TAG, `开始执行WebView JS任务,剩余队列: ${this.pendingTasks.length}`);... | https://github.com/DaLongZhuaZi/manxia | 0e5e5a8a9936e1d8a2350c41692ae2906cc680aa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets | arkts | getDirectoryContents | 获取目录内容
使用GET方法获取目录列表(依赖服务器返回HTML或JSON格式) | async getDirectoryContents(remotePath: string): Promise<WebDAVFile[]> {
try {
const url = this.getFullUrl(remotePath);
logger.info(TAG, `获取目录内容: ${url}`);
const result = await this.sendRequest('GET', url);
if (result.statusCode !== 200) {
logger.warn(TAG, `获取目录内容失败: $... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDirectoryContents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Right AST#type_annotation#Left A... | async getDirectoryContents(remotePath: string): Promise<WebDAVFile[]> {
try {
const url = this.getFullUrl(remotePath);
logger.info(TAG, `获取目录内容: ${url}`);
const result = await this.sendRequest('GET', url);
if (result.statusCode !== 200) {
logger.warn(TAG, `获取目录内容失败: $... | https://github.com/DaLongZhuaZi/manxia | ce80b10df7ba5561cc35ef3e9664df047f7612ba | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_short.ets | arkts | main | ---
desc: check postfix decrement for short integer operand
--- | function main(): void {
let value: short = {{v.value}}
let result: short = value--
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: short = {{v.value}}
let result: short = value--
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3c244fabbdb026c313bc8f451e648ff145f01f32 | gitee |
openharmony-sig/fluttertpc_qr_code_scanner | ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets | arkts | setTorchMode | 手电筒开关 | setTorchMode(isOpen: boolean, result: MethodResult): boolean {
let openflag: boolean = false;
if (!this.isTorchSupported()) {
openflag = false;
return openflag;
}
const newMode = isOpen ? camera.TorchMode.ON : camera.TorchMode.OFF;
if (!this.isTorchModeSupported(newMode)) {
openf... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTorchMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isOpen AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#,#Left ,... | setTorchMode(isOpen: boolean, result: MethodResult): boolean {
let openflag: boolean = false;
if (!this.isTorchSupported()) {
openflag = false;
return openflag;
}
const newMode = isOpen ? camera.TorchMode.ON : camera.TorchMode.OFF;
if (!this.isTorchModeSupported(newMode)) {
openf... | https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git | 0116c4c26acc5dce232ebd099f6dedad51bf4c23 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/BillDAO.ets | arkts | getByCategoryId | 按分类ID查询账单
@param userId 用户ID
@param categoryId 分类ID
@param limit 限制数量
@returns 账单列表 | static async getByCategoryId(userId: number, categoryId: number, limit: number = 100): Promise<Bill[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(Bill.tableName);
predicates... | 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 getByCategoryId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left :... | static async getByCategoryId(userId: number, categoryId: number, limit: number = 100): Promise<Bill[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(Bill.tableName);
predicates... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5cbc1702c953632670c61e3546a393cd1611a59e | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/BiometricAccessUtil.ets | arkts | onResult | 返回认证结果 | onResult(result) {
try {
// 如果验证成功/失败
if (result.result === userAuth.UserAuthResultCode.SUCCESS) {
resolve(true)
} else {
resolve(false)
}
} finally {
// 认证结束,取消订阅认... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left result AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expressi... | onResult(result) {
try {
// 如果验证成功/失败
if (result.result === userAuth.UserAuthResultCode.SUCCESS) {
resolve(true)
} else {
resolve(false)
}
} finally {
// 认证结束,取消订阅认... | https://github.com/Yebingiscn/SweetVideo | 1b3a39730d3a25fac86374f3482224e4c8215b23 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | copyEffects | 复制特效配置 | function copyEffects(source: EffectsConfig): EffectsConfig {
return {
enableBlur: source.enableBlur,
blurIntensity: source.blurIntensity,
enableShadow: source.enableShadow,
shadowIntensity: source.shadowIntensity,
enableAnimation: source.enableAnimation,
animationSpeed: source.animationSpeed,
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left copyEffects AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left source AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | function copyEffects(source: EffectsConfig): EffectsConfig {
return {
enableBlur: source.enableBlur,
blurIntensity: source.blurIntensity,
enableShadow: source.enableShadow,
shadowIntensity: source.shadowIntensity,
enableAnimation: source.enableAnimation,
animationSpeed: source.animationSpeed,
... | https://github.com/DaLongZhuaZi/manxia | 09e474f274f2e6bfb272ff2d5980714669ef9978 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GyroAssistService.ets | arkts | startListening | ==================== 传感器管理 ====================
开始监听陀螺仪(作为 DeviceSensorService 的数据消费者)
注意:这里直接启动设备传感器,不依赖主机请求 | private startListening(): void {
if (this.sensorListening) return;
if (!this.sensorService.hasGyroscope()) {
console.warn('[GyroAssist] 设备没有陀螺仪');
return;
}
// 保存并设置数据回调
this.sensorService.setControllerNumber(this.controllerNumber);
this.sensorService.setDataCallback(
(cn: n... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startListening 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#v... | private startListening(): void {
if (this.sensorListening) return;
if (!this.sensorService.hasGyroscope()) {
console.warn('[GyroAssist] 设备没有陀螺仪');
return;
}
// 保存并设置数据回调
this.sensorService.setControllerNumber(this.controllerNumber);
this.sensorService.setDataCallback(
(cn: n... | https://github.com/AlkaidLab/moonlight-harmony | 81ac152e1373a12a262761c266c2b6156f9bcdd5 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | constructor | Creates an BigUint64Array with respect to length.
@param length data initializer | public constructor(length: int)
{
this.length = length
this.byteLength = length * BigUint64Array.BYTES_PER_ELEMENT
this.byteOffset = 0
this.buffer = new ArrayBuffer(this.byteLength)
} | 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#identifier#Left length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public constructor(length: int)
{
this.length = length
this.byteLength = length * BigUint64Array.BYTES_PER_ELEMENT
this.byteOffset = 0
this.buffer = new ArrayBuffer(this.byteLength)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cce5d53b81d07a9e30cc35e87bf562874ec93cdf | gitee |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/VocabularyTracker.ets | arkts | getWordsForReview | 获取需要复习的词汇 (Legacy logic, preferably use DBManager for actual scheduling) | getWordsForReview(): VocabularyRecord[] {
const now = Date.now();
const reviewInterval = 1 * 24 * 60 * 60 * 1000; // 1天 (Simplified)
return this.getAllRecords().filter((record: VocabularyRecord): boolean => {
// Return Review/Relearning words or words overdue
return record.status === WordStat... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWordsForReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left VocabularyReco... | getWordsForReview(): VocabularyRecord[] {
const now = Date.now();
const reviewInterval = 1 * 24 * 60 * 60 * 1000; // 1天 (Simplified)
return this.getAllRecords().filter((record: VocabularyRecord): boolean => {
// Return Review/Relearning words or words overdue
return record.status === WordStat... | https://github.com/CLMC2025/Vignette | 2819d5749d8b0061ebc47796834ac8835d0126f7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | deleteFilesInDirectory | 删除目录中的所有文件并返回删除数量 | private deleteFilesInDirectory(dirPath: string): number {
try {
const files = SafeFileUtils.listFileSync(dirPath);
let deletedCount = 0;
for (const fileName of files) {
const filePath = `${dirPath}/${fileName}`;
try {
SafeFileUtils.unlinkSync(filePath);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deleteFilesInDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | private deleteFilesInDirectory(dirPath: string): number {
try {
const files = SafeFileUtils.listFileSync(dirPath);
let deletedCount = 0;
for (const fileName of files) {
const filePath = `${dirPath}/${fileName}`;
try {
SafeFileUtils.unlinkSync(filePath);
... | https://github.com/DaLongZhuaZi/manxia | 718a15024e3bc5e44e02a834eb23a722cda88c6c | github |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/SocialListSettings.ets | arkts | addBlacklist | ============== Blacklist ============== | addBlacklist(entry: BlacklistEntry): void {
this.ctx.state.blacklist = this.blacklistManager.add(entry)
this.ctx.persist()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addBlacklist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BlacklistEntry AST#identifier#Right AST#)#... | addBlacklist(entry: BlacklistEntry): void {
this.ctx.state.blacklist = this.blacklistManager.add(entry)
this.ctx.persist()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/SocialListSettings.ets#L31-L34 | 3fd0df1808175b63d1a889ea49789daff827899e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets | arkts | hasPrivacyPassword | 检查是否已设置隐私密码 | public hasPrivacyPassword(): boolean {
const savedPasswordHash: string = this.settingsManager.getString('privacy_password_hash', '');
return savedPasswordHash !== '';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasPrivacyPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolea... | public hasPrivacyPassword(): boolean {
const savedPasswordHash: string = this.settingsManager.getString('privacy_password_hash', '');
return savedPasswordHash !== '';
} | https://github.com/DaLongZhuaZi/manxia | 37aaa6bea7df6b13ccb0682bde03e4ba22c03170 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | togglePin | Toggle the pin state of the window. | async togglePin() {
if (this.windowObj) {
await this.windowObj.setWindowTopmost(!this.pin)
.then(() => {
this.pin = !this.pin;
})
.catch((e: BusinessError) => {
meow(`Failed to set window topmost: ${e.message}`, `meowUiHost][${this.windowId}`, meowLevel.ERROR);
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left togglePin AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Righ... | async togglePin() {
if (this.windowObj) {
await this.windowObj.setWindowTopmost(!this.pin)
.then(() => {
this.pin = !this.pin;
})
.catch((e: BusinessError) => {
meow(`Failed to set window topmost: ${e.message}`, `meowUiHost][${this.windowId}`, meowLevel.ERROR);
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | b159e0d0d2b14879b1bd857d4cfd34ebc4b162eb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/NamingConventions.ets | arkts | generateFieldName | 生成标准化的字段名
@param words - 单词数组
@returns 标准化的字段名 | static generateFieldName(words: string[]): string {
if (words.length === 0) return '';
const camelCaseWords = words.map((word, index) => {
const cleanWord = word.toLowerCase().replace(/[^a-z0-9]/g, '');
return index === 0 ? cleanWord : cleanWord.charAt(0).toUpperCase() + cleanWord.slice(1);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateFieldName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left words AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_exp... | static generateFieldName(words: string[]): string {
if (words.length === 0) return '';
const camelCaseWords = words.map((word, index) => {
const cleanWord = word.toLowerCase().replace(/[^a-z0-9]/g, '');
return index === 0 ? cleanWord : cleanWord.charAt(0).toUpperCase() + cleanWord.slice(1);
... | https://github.com/DaLongZhuaZi/manxia | fd25e756e7eeb9e0e99d5235e8ee940ec667382a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | readIntBE | Reads a signed integer from the buffer at the specified offset using big-endian format
@param {int} offset - Number of bytes to skip before reading
@param {int} byteLength - Number of bytes to read (maximum 6)
@returns {int} The read value
@throws {Error} If byteLength is greater than 6 | public readIntBE(offset: int, byteLength: int): long {
let lengthOffset: int = this.length - byteLength;
Buffer.checkOffsetConstraint(offset, lengthOffset);
Buffer.checkByteLengthConstraint(byteLength);
let val = this.readBytes(this.getDataView(), offset, byteLeng... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readIntBE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R... | public readIntBE(offset: int, byteLength: int): long {
let lengthOffset: int = this.length - byteLength;
Buffer.checkOffsetConstraint(offset, lengthOffset);
Buffer.checkByteLengthConstraint(byteLength);
let val = this.readBytes(this.getDataView(), offset, byteLeng... | https://gitcode.com/iop123123/arkts-static-skills | ce1dd178a3e280d4e1b6abfd179b7f864eea1ec5 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/TotpService.ets | arkts | parseUri | 从URI解析TOTP配置
@param uri TOTP URI (otpauth://totp/...)
@returns TOTP配置对象 | public parseUri(uri: string): TotpConfig | null {
try {
// 检查URI格式
if (!uri.startsWith('otpauth://totp/')) {
hilog.error(DOMAIN, TAG, 'Invalid URI format');
return null;
}
// 解析URI
const urlObject = url.URL.parseURL(uri);
// 解析路径部分获取标签(格式可能是 Issuer:AccountName... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left parseUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | public parseUri(uri: string): TotpConfig | null {
try {
// 检查URI格式
if (!uri.startsWith('otpauth://totp/')) {
hilog.error(DOMAIN, TAG, 'Invalid URI format');
return null;
}
// 解析URI
const urlObject = url.URL.parseURL(uri);
// 解析路径部分获取标签(格式可能是 Issuer:AccountName... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L384-L445 | 05571466804f7f137adce5a6e4009ba26f684998 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | formatQQMusicNew | 格式化新版QQ音乐数据 | private formatQQMusicNew(song: QQSongNew): MusicInfo | null {
// 检查必要字段
if (!song.file?.media_mid || !song.name) {
return null
}
const singerNames: string[] = []
if (song.singer && song.singer.length > 0) {
for (let i = 0; i < song.singer.length; i++) {
singerNames.push(song.s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatQQMusicNew AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private formatQQMusicNew(song: QQSongNew): MusicInfo | null {
// 检查必要字段
if (!song.file?.media_mid || !song.name) {
return null
}
const singerNames: string[] = []
if (song.singer && song.singer.length > 0) {
for (let i = 0; i < song.singer.length; i++) {
singerNames.push(song.s... | https://github.com/cpdd5201314/harmonyOS-music-app | 14ec2f506164a759004038f18ee0511dc523d5eb | github |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets | arkts | setSurfaceID | 设置播放surfaceID,播放音频时无需设置 | setSurfaceID(): void {
if (this.avPlayer !== undefined) {
this.avPlayer.surfaceId = this.surfaceID;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSurfaceID AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | setSurfaceID(): void {
if (this.avPlayer !== undefined) {
this.avPlayer.surfaceId = this.surfaceID;
}
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 484597fd0cf3d08f26eaff37ab34351eccf33b70 | gitee |
richshaw2015/nds | ohos/entry/src/test/DependencyRelations.test.ets | arkts | getSettingState | 获取设置项状态
@param key 设置键名
@returns 设置状态 | getSettingState(key: string): SettingState | undefined {
return this.settingStates.get(key);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSettingState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | getSettingState(key: string): SettingState | undefined {
return this.settingStates.get(key);
} | https://github.com/richshaw2015/nds | 755e7d8321b582a5a32ffd37825f38b32e111dd8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getComponentTransparency | 获取组件透明度 | public getComponentTransparency(component: 'navigationBar' | 'tabBar' | 'card' | 'dialog' | 'floatingBall' | 'menu' | 'sidebar'): number {
try {
const profile = UserThemeConfigManager.getInstance().getCurrentProfile();
if (component === 'navigationBar') return profile.transparency.navigationBar;
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentTransparency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left component AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#bi... | public getComponentTransparency(component: 'navigationBar' | 'tabBar' | 'card' | 'dialog' | 'floatingBall' | 'menu' | 'sidebar'): number {
try {
const profile = UserThemeConfigManager.getInstance().getCurrentProfile();
if (component === 'navigationBar') return profile.transparency.navigationBar;
... | https://github.com/DaLongZhuaZi/manxia | f8d84fc370f669802974208bac7114b9a520f3e7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | readTxtFile | ==================== 文件操作 ====================
读取文本文件 | async readTxtFile(path: string): Promise<string> {
try {
const fullPath = this.resolvePath(path);
const file = SafeFileUtils.openSync(fullPath, fileIo.OpenMode.READ_ONLY);
const stat = SafeFileUtils.statSync(fullPath);
const buffer = new ArrayBuffer(stat.size);
SafeFileUtils.readSync... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left readTxtFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async readTxtFile(path: string): Promise<string> {
try {
const fullPath = this.resolvePath(path);
const file = SafeFileUtils.openSync(fullPath, fileIo.OpenMode.READ_ONLY);
const stat = SafeFileUtils.statSync(fullPath);
const buffer = new ArrayBuffer(stat.size);
SafeFileUtils.readSync... | https://github.com/DaLongZhuaZi/manxia | 240b8b9e635dc191883551a6e5122724912f2197 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets | arkts | getOpen | Returns the bodys open value.
@return | public getOpen(): number {
return this.mOpen;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOpen 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#... | public getOpen(): number {
return this.mOpen;
} | https://gitee.com/openharmony/developtools_profiler.git | eb2d5e21ecfed15df67a6988370c889f4ccf7204 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/accessibility/AccessibilityConfig.ets | arkts | removeListener | 移除配置变更监听器
@param listener 监听器函数 | public removeListener(listener: ConfigChangeListener): void {
const index = this.listeners.indexOf(listener);
if (index !== -1) {
this.listeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeListener 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#Le... | public removeListener(listener: ConfigChangeListener): void {
const index = this.listeners.indexOf(listener);
if (index !== -1) {
this.listeners.splice(index, 1);
}
} | https://github.com/LJ666-ui/harmony-health-care | 85065d21e598493886652f2955f86f3a993deb6c | github |
terryma2024/happyword | harmonyos/entry/src/test/MultipartBuilder.test.ets | arkts | indexOfBytes | Naïve substring search over Uint8Array — fine for tiny test inputs. | function indexOfBytes(haystack: Uint8Array, needle: Uint8Array): number {
if (needle.length === 0) {
return 0;
}
for (let i: number = 0; i + needle.length <= haystack.length; i++) {
let match: boolean = true;
for (let j: number = 0; j < needle.length; j++) {
if (haystack[i + j] !== needle[j]) {
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left indexOfBytes AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left haystack AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function indexOfBytes(haystack: Uint8Array, needle: Uint8Array): number {
if (needle.length === 0) {
return 0;
}
for (let i: number = 0; i + needle.length <= haystack.length; i++) {
let match: boolean = true;
for (let j: number = 0; j < needle.length; j++) {
if (haystack[i + j] !== needle[j]) {
... | https://github.com/terryma2024/happyword | 00c47b2b97661c35bc2be67cb6b91ba1112fd0b9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets | arkts | saveSuwayomiCache | ==================== Suwayomi缓存 ====================
保存Suwayomi Tab缓存 | async saveSuwayomiCache(data: SuwayomiCacheData): Promise<void> {
try {
this.suwayomiCache = data;
const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME);
await dataPreferences.put(this.SUWAYOMI_KEY, JSON.stringify(data));
await dataPreferences.flush();
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveSuwayomiCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async saveSuwayomiCache(data: SuwayomiCacheData): Promise<void> {
try {
this.suwayomiCache = data;
const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME);
await dataPreferences.put(this.SUWAYOMI_KEY, JSON.stringify(data));
await dataPreferences.flush();
... | https://github.com/DaLongZhuaZi/manxia | 075422ba99c5c8b189ab3a2616ff9c0ea21c5d25 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets | arkts | exchangeCodeForToken | 使用授权码换取访问令牌 | private async exchangeCodeForToken(code: string): Promise<boolean> {
try {
const httpRequest = http.createHttp();
const requestBody = JSON.stringify({
grant_type: 'authorization_code',
client_id: ANILIST_CLIENT_ID,
code: code
});
const response = await httpR... | 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 exchangeCodeForToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#... | private async exchangeCodeForToken(code: string): Promise<boolean> {
try {
const httpRequest = http.createHttp();
const requestBody = JSON.stringify({
grant_type: 'authorization_code',
client_id: ANILIST_CLIENT_ID,
code: code
});
const response = await httpR... | https://github.com/DaLongZhuaZi/manxia | 0bd8a9b9b56e1b6595120e328c7aa896956dc57a | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets | arkts | isDashedHighlightLineEnabled | Returns true if the dashed-line effect is enabled for highlight lines, false if not.
Default: disabled
@return | public isDashedHighlightLineEnabled(): boolean {
return!this.mHighlightDashPathEffect ? false : true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDashedHighlightLineEnabled 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#L... | public isDashedHighlightLineEnabled(): boolean {
return!this.mHighlightDashPathEffect ? false : true;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ca0730fbd600441b667c8d682f824566c1b61de5 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/DependencyContainer.ets | arkts | getExistingInstance | 获取现有实例 | private getExistingInstance(token: string, scope?: string): object | undefined {
// 确保Maps已初始化
if (!this.dependencies) {
this.dependencies = new Map<string, DependencyDescriptor>();
}
if (!this.singletons) {
this.singletons = new Map<string, object>();
}
if (!this.scoped) {
t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getExistingInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private getExistingInstance(token: string, scope?: string): object | undefined {
// 确保Maps已初始化
if (!this.dependencies) {
this.dependencies = new Map<string, DependencyDescriptor>();
}
if (!this.singletons) {
this.singletons = new Map<string, object>();
}
if (!this.scoped) {
t... | https://github.com/DaLongZhuaZi/manxia | 91d3c81b4b732b725643aa94171f18109692e6ea | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | index | Sets the starting index of the match result.
@param { int } val The index value to be set.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set index(val: int) {
this.index_ = val
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | public set index(val: int) {
this.index_ = val
} | https://gitcode.com/iop123123/arkts-static-skills | 878ec9701916de41048c39b6869f4dab96a06f3f | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.