nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
toLocaleString
Gets a string with a language-sensitive representation of this date with respect to locale. @param { Intl.LocalesArgument } [ locales ] A string with a BCP 47 language tag, or an array of such strings @param { object } [ options ] An object with some or all of the properties of the Intl.DateTimeFormatOptions options @r...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): String { let options_: Intl.DateTimeFormatOptions | undefined = undefined if (options instanceof Intl.DateTimeFormatOptions) { options_ = options as Intl.DateTimeFormatOptions } con...
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 toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Rig...
public override toLocaleString(locales?: Intl.LocalesArgument, options?: object): String { let options_: Intl.DateTimeFormatOptions | undefined = undefined if (options instanceof Intl.DateTimeFormatOptions) { options_ = options as Intl.DateTimeFormatOptions } con...
https://gitcode.com/iop123123/arkts-static-skills
796e525142d255162df99c9e9f2ca27be6fbda91
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
routerMap
获取已经注册的所有路由表 @returns
public static get routerMap(): RouteItem[] { let routerMap = ZRouter.getRouterMgr().routerMap if (routerMap.length === 0) { // 尝试同步获取,正常情况是不会执行到这里,在初始化时会在工作线程中完成 // 兜底操作 const routerMap = loadRouterMapFromRawFileSync(this.context) ZRouter.getRouterMgr().routerMap = routerMap retu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left routerMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#...
public static get routerMap(): RouteItem[] { let routerMap = ZRouter.getRouterMgr().routerMap if (routerMap.length === 0) { // 尝试同步获取,正常情况是不会执行到这里,在初始化时会在工作线程中完成 // 兜底操作 const routerMap = loadRouterMapFromRawFileSync(this.context) ZRouter.getRouterMgr().routerMap = routerMap retu...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L66-L76
874ab8121ae576d4e6f78610724a174e99f1aef5
github
openharmony-tpc/openharmony_tpc_samples
dialogs/library/src/main/ets/components/progress/base/LVBase.ets
arkts
setPadding
设置内间距,有的组件不生效
setPadding(padding:number) { this.padding = padding; return this; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left padding AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#L...
setPadding(padding:number) { this.padding = padding; return this; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
cafc41f3350681efbb3471c6bd3e481331a07149
gitee
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/CityDataService.ets
arkts
findCity
根据城市名称查找
static findCity(cityName: string): CityModel | null { CityDataService.initCities(); const found = CityDataService.cities.find((c: CityModel) => c.city === cityName); return found ? found : null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left findCity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right...
static findCity(cityName: string): CityModel | null { CityDataService.initCities(); const found = CityDataService.cities.find((c: CityModel) => c.city === cityName); return found ? found : null; }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
80138f2af035ce1e5a40a524c87c1c9234d94751
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/HistoryViewModel.ets
arkts
fetchData
拉取历史记录
async fetchData() { try { if (this.isNovelMode()) { this.allList = await this.getNovelDB().queryAll(); } else { this.allList = await this.getIllustDB().queryAllByAccessTimeDesc(); } this.filter(); } catch (e) { logger.error('fetchData Error', e); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchData 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 fetchData() { try { if (this.isNovelMode()) { this.allList = await this.getNovelDB().queryAll(); } else { this.allList = await this.getIllustDB().queryAllByAccessTimeDesc(); } this.filter(); } catch (e) { logger.error('fetchData Error', e); } }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/HistoryViewModel.ets#L52-L63
413f9108a742df350411621516e3faa98511d12c
github
openharmony/applications_app_samples
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
wifiStateObserve
WI-FI状态监听
wifiStateObserve() { // 注册WLAN状态改变事件 // 0,未激活;1,已激活;2,激活中;3:去激活中 wifiManager.on('wifiStateChange', (result: number) => { logger.info('NetUtils', 'wifiStateChange: ' + result); this.postEvent(NetworkEventName.WifiStateChange, result); }); // 注册WLAN连接状态改变事件 // 0,已断开;1,已连接 wifiMan...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left wifiStateObserve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
wifiStateObserve() { // 注册WLAN状态改变事件 // 0,未激活;1,已激活;2,激活中;3:去激活中 wifiManager.on('wifiStateChange', (result: number) => { logger.info('NetUtils', 'wifiStateChange: ' + result); this.postEvent(NetworkEventName.WifiStateChange, result); }); // 注册WLAN连接状态改变事件 // 0,已断开;1,已连接 wifiMan...
https://github.com/openharmony/applications_app_samples
34c498d438942ef0c28794c3e1f0944b473e25f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
isPositiveNumber
检查值是否为正数 @param value - 要检查的值 @returns 是否为正数
static isPositiveNumber(value: Object): boolean { if (!TypeGuards.isNumber(value)) { return false; } const numValue = value as number; return numValue > 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isPositiveNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static isPositiveNumber(value: Object): boolean { if (!TypeGuards.isNumber(value)) { return false; } const numValue = value as number; return numValue > 0; }
https://github.com/DaLongZhuaZi/manxia
7d48a3b036af8bee89151e44d8b984e214d1b674
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderCommentViewModel.ets
arkts
updateCommentContent
更新评论内容 @param {string} value - 评论内容 @returns {void} 无返回值
updateCommentContent(value: string): void { this.commentContent = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateCommentContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#...
updateCommentContent(value: string): void { this.commentContent = value; }
https://github.com/Joker-x-dev/CoolMallArkTS
ad7e09e2f9481021d7d2d84777204b5ca3523a98
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/EnhancedRAGRetriever.ets
arkts
retrieve
检索相关知识(增强版) @param query 查询文本 @param topK 返回结果数量 @returns 知识上下文
async retrieve( query: string, topK?: number ): Promise<KnowledgeContext> { console.info('[EnhancedRAGRetriever] 开始检索:', query); try { // 1. 使用混合检索器检索 const results = await this.hybridRetriever.retrieve(query); console.info('[EnhancedRAGRetriever] 混合检索完成:', results.length); ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left retrieve AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async retrieve( query: string, topK?: number ): Promise<KnowledgeContext> { console.info('[EnhancedRAGRetriever] 开始检索:', query); try { // 1. 使用混合检索器检索 const results = await this.hybridRetriever.retrieve(query); console.info('[EnhancedRAGRetriever] 混合检索完成:', results.length); ...
https://github.com/LJ666-ui/harmony-health-care
30018a52d26ba1ace2b2a6665c9d8f8c3694be89
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/components/parts/Bookmarks/BookmarksColumn.ets
arkts
build
Called when this column folder is selected. For select mode only.
build() { Column({ space: standardSpacing }) { Stack({ alignContent: Alignment.Bottom }) { this.BookmarksList(); if (this.somethingDraggingAboveMe) { Text($r('app.string.Bookmarks_drop')).attributeModifier(new MooTextModifier(mooTextType.TITLE)) .width('100%').height('1...
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({ space: standardSpacing }) { Stack({ alignContent: Alignment.Bottom }) { this.BookmarksList(); if (this.somethingDraggingAboveMe) { Text($r('app.string.Bookmarks_drop')).attributeModifier(new MooTextModifier(mooTextType.TITLE)) .width('100%').height('1...
https://github.com/awaLiny2333/LinysBrowser_NEXT
0f7aef1ae0f2e371908ff1c999ccac4e597d1e92
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseDataSet.ets
arkts
getIndexInEntries
###### ###### DATA RELATED METHODS ###### ######
public getIndexInEntries(xIndex: number): number { for (let i = 0; i < this.getEntryCount(); i++) { let dataArray: T | null = this.getEntryForIndex(i); if (dataArray) { if (xIndex == dataArray.getX()) { return i; } else { return -1; } } } retu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getIndexInEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xIndex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public getIndexInEntries(xIndex: number): number { for (let i = 0; i < this.getEntryCount(); i++) { let dataArray: T | null = this.getEntryForIndex(i); if (dataArray) { if (xIndex == dataArray.getX()) { return i; } else { return -1; } } } retu...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
7a342ebe2542fa1316d2f2c1428e03f54edf2658
gitee
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets
arkts
encrypt
Encrypted @param content Encrypted content. @returns Promise object with ciphertext.
async encrypt(content: string): Promise<User> { // Initialize Encryption Operating Environment: Start Encryption let mode = cryptoFramework.CryptoMode.ENCRYPT_MODE; let gcmParams = await this.genGcmParamsSpec(); await this.globalCipher.init(mode, this.globalKey, gcmParams); let plainTextBlob: cryp...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left encrypt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async encrypt(content: string): Promise<User> { // Initialize Encryption Operating Environment: Start Encryption let mode = cryptoFramework.CryptoMode.ENCRYPT_MODE; let gcmParams = await this.genGcmParamsSpec(); await this.globalCipher.init(mode, this.globalKey, gcmParams); let plainTextBlob: cryp...
https://gitee.com/openharmony/codelabs.git
91426e7ae7ee05a480f88d2049d13eb1d677cc5c
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets
arkts
clearAllTokens
清除所有OAuth2令牌
public async clearAllTokens(): Promise<void> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { await this.preferences.clear(); await this.preferences.flush(); hilog.info(DOMAIN, TAG, 'All OAuth2 tokens cleared'); }...
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 clearAllTokens AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async clearAllTokens(): Promise<void> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { await this.preferences.clear(); await this.preferences.flush(); hilog.info(DOMAIN, TAG, 'All OAuth2 tokens cleared'); }...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets#L218-L231
e816781f9e093995d459972a27ee0d2486f42fce
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/SettingsManager.ets
arkts
reload
重新加载设置(导入后刷新用)
async reload(): Promise<void> { const preferencesService = getPreferencesService() this.currentThemeMode = await preferencesService.getThemeMode() this.currentLanguage = await preferencesService.getLanguage() this.notificationEnabled = await preferencesService.getNotifyEnabled() this.notifyOnCompl...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reload AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#...
async reload(): Promise<void> { const preferencesService = getPreferencesService() this.currentThemeMode = await preferencesService.getThemeMode() this.currentLanguage = await preferencesService.getLanguage() this.notificationEnabled = await preferencesService.getNotifyEnabled() this.notifyOnCompl...
https://github.com/LongLiveY96/chatcube
29402bb04a299468a2b3dfc9ca5418b4b30cefe0
github
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/utils/WeatherIconHelper.ets
arkts
getWeatherColor
Get weather condition specific color
getWeatherColor(condition?: WeatherCondition): string { if (!condition) { return '#FFFFFF'; } switch (condition) { case WeatherCondition.SUNNY: return '#FFD700'; // Gold case WeatherCondition.PARTLY_CLOUDY: return '#87CEEB'; // Sky blue case Weath...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWeatherColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left condition AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WeatherCon...
getWeatherColor(condition?: WeatherCondition): string { if (!condition) { return '#FFFFFF'; } switch (condition) { case WeatherCondition.SUNNY: return '#FFD700'; // Gold case WeatherCondition.PARTLY_CLOUDY: return '#87CEEB'; // Sky blue case Weath...
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
020b8b622efa34046dd95aab1a1d44ac41d4f70b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
waitForPageLoad
等待页面加载完成
private async waitForPageLoad(timeout: number = 30000): Promise<void> { return new Promise<void>((resolve, reject) => { let isResolved = false; const timeoutId = setTimeout(() => { if (!isResolved) { isResolved = true; reject(new MangaSourceError( MangaSourceEr...
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 waitForPageLoad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeout AST#identifier#Right AST#:#Le...
private async waitForPageLoad(timeout: number = 30000): Promise<void> { return new Promise<void>((resolve, reject) => { let isResolved = false; const timeoutId = setTimeout(() => { if (!isResolved) { isResolved = true; reject(new MangaSourceError( MangaSourceEr...
https://github.com/DaLongZhuaZi/manxia
06e84e9ac7a1fcf4d3f766dea4cee080e00a3501
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Node.ets
arkts
nextSibling
获取后一个兄弟节点
get nextSibling(): Node | null { if (!this.parentNode) return null; const siblings = this.parentNode.childNodes; const index = siblings.indexOf(this); return index >= 0 && index < siblings.length - 1 ? siblings[index + 1] : null; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left nextSibling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifi...
get nextSibling(): Node | null { if (!this.parentNode) return null; const siblings = this.parentNode.childNodes; const index = siblings.indexOf(this); return index >= 0 && index < siblings.length - 1 ? siblings[index + 1] : null; }
https://github.com/DaLongZhuaZi/manxia
a35433d23e091a53543c7749ea07752c10c538fd
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGCircle.ets
arkts
getCY
获取圆心y坐标
public getCY(): number{ return this._cy; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getCY AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public getCY(): number{ return this._cy; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
057f898df2247dab6758509ab8f50ca14da853a2
gitee
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
getHeaderMapParameters
Get header map parameters metadata
static getHeaderMapParameters(target: Object, propertyKey?: string | symbol): number[] | null { return this.getMetadata('retrofit:headerMapParams', target, propertyKey) || null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getHeaderMapParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
static getHeaderMapParameters(target: Object, propertyKey?: string | symbol): number[] | null { return this.getMetadata('retrofit:headerMapParams', target, propertyKey) || null; }
https://github.com/killetom/ktretrofit
70c248090160a978f7a73ff5b3d2f7f2f9f65e1f
github
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
getSelectCount
Obtains the quantity of a batch. @param list Contact list data.
getSelectCount(list: Array<ListItemData>): number { if (CheckEmptyUtils.isEmptyArr(list)) { Logger.info(TAG, '[PageViewModel][getSelectCount] list is empty.'); Logger.error(TAG, `CheckEmptyUtils.isEmptyArr(list): ${JSON.stringify(CheckEmptyUtils.isEmptyArr(list))}`); return 0; } let resu...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Array A...
getSelectCount(list: Array<ListItemData>): number { if (CheckEmptyUtils.isEmptyArr(list)) { Logger.info(TAG, '[PageViewModel][getSelectCount] list is empty.'); Logger.error(TAG, `CheckEmptyUtils.isEmptyArr(list): ${JSON.stringify(CheckEmptyUtils.isEmptyArr(list))}`); return 0; } let resu...
https://gitee.com/harmonyos/codelabs.git
fc483927ce395e54eeb4a7d5ae9f3fc31509abca
gitee
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGXMLChecker.ets
arkts
_readAttributeValue
读取属性值 @see https://www.w3.org/TR/xml/ 2.3节 [10] AttValue @return {string|false} 返回去掉引号的属性值,没读取到则返回false,空字符表示读取到了,但为空
private _readAttributeValue(): boolean|string{ let _svgStringReader=this._svgStringReader!; let quote = _svgStringReader.peek(); if (quote !== XMLConstants.XML_DOUBLE_QUOTATION_MARK && quote !== XMLConstants.XML_SINGLE_QUOTATION_MARK) { return false; } _svgStringReader.moveNext(); let ch...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readAttributeValue 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 _readAttributeValue(): boolean|string{ let _svgStringReader=this._svgStringReader!; let quote = _svgStringReader.peek(); if (quote !== XMLConstants.XML_DOUBLE_QUOTATION_MARK && quote !== XMLConstants.XML_SINGLE_QUOTATION_MARK) { return false; } _svgStringReader.moveNext(); let ch...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
a3fa4b39dfc4faf498be40b53fb2a0c63e72ffe9
gitee
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
sendRtcpPli
v28: 发送 RTCP PLI(Picture Loss Indication)请求关键帧 当解码器检测到花屏或丢包时,通过此方法通知发送端立即发送关键帧 @param trackId 轨道 ID @return 是否成功发送
public sendRtcpPli(trackId: string): boolean { if (!this.client) { LogUtil.warn('[WebRTC] sendRtcpPli: 客户端未初始化'); return false; } LogUtil.info(`[WebRTC] 发送 PLI: trackId=${trackId}`); return this.client.sendRtcpPli(trackId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendRtcpPli AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left trackId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
public sendRtcpPli(trackId: string): boolean { if (!this.client) { LogUtil.warn('[WebRTC] sendRtcpPli: 客户端未初始化'); return false; } LogUtil.info(`[WebRTC] 发送 PLI: trackId=${trackId}`); return this.client.sendRtcpPli(trackId); }
https://github.com/tdcare/tdwebrtc
e25d3c2e53292737846ae99acc5a39ea387118e4
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/permission/PermissionUtils.ets
arkts
requestPermissionsEasy
申请权限,拒绝后并二次向用户申请授权 @param {Array<Permissions>} permissions 目标权限 @returns {Promise<boolean>} 是否已授权
private async requestPermissionsEasy(permissions: Array<Permissions>): Promise<boolean> { try { // 第一次请求权限 let request: PermissionRequestResult = await this.atManager.requestPermissionsFromUser(this.context, permissions); let isGranted = request.authResults.every(status => status === abilityAcce...
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 requestPermissionsEasy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left permissions...
private async requestPermissionsEasy(permissions: Array<Permissions>): Promise<boolean> { try { // 第一次请求权限 let request: PermissionRequestResult = await this.atManager.requestPermissionsFromUser(this.context, permissions); let isGranted = request.authResults.every(status => status === abilityAcce...
https://github.com/Joker-x-dev/CoolMallArkTS
166cea341cb8335f61348af48b0fef2e97817e1d
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test5_original_index.ets
arkts
testDateOps
=== Date Operations ===
function testDateOps(): string { let now: Date = new Date(); let year: number = now.getFullYear(); let month: number = now.getMonth(); let day: number = now.getDate(); let hours: number = now.getHours(); let minutes: number = now.getMinutes(); let timestamp: number = now.getTime(); return String(year) +...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testDateOps 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...
function testDateOps(): string { let now: Date = new Date(); let year: number = now.getFullYear(); let month: number = now.getMonth(); let day: number = now.getDate(); let hours: number = now.getHours(); let minutes: number = now.getMinutes(); let timestamp: number = now.getTime(); return String(year) +...
https://github.com/miaochiahao/ark-ghidra
2f56eb613bb9ce01749cf30454dc6fbff54e0c0d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setSpaceMin
Sets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum`
public setSpaceMin(mSpaceMin: number): void { this.mSpaceMin = mSpaceMin; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSpaceMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mSpaceMin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R...
public setSpaceMin(mSpaceMin: number): void { this.mSpaceMin = mSpaceMin; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9b20caf5eea84f18c7cc9a3d275d46ffc1b281f0
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets
arkts
convertToPageInfo
将旧的PageInfo转换为新的PageInfo类型
static convertToPageInfo(legacy: LegacyPageInfo): PageInfo { return { id: legacy.id, chapterId: legacy.chapterId, pageNumber: legacy.pageNumber, imageUrl: legacy.imageUrl, localPath: legacy.localPath, width: legacy.width, height: legacy.height }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToPageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left legacy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static convertToPageInfo(legacy: LegacyPageInfo): PageInfo { return { id: legacy.id, chapterId: legacy.chapterId, pageNumber: legacy.pageNumber, imageUrl: legacy.imageUrl, localPath: legacy.localPath, width: legacy.width, height: legacy.height }; }
https://github.com/DaLongZhuaZi/manxia
6e103ecef98ac01a5994cef23fa319d3fc9e1808
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
setFirmwareStopCallback
设置固件关机回调 当 DS 固件执行关机操作 (PowerOff) 时回调
static setFirmwareStopCallback(callback: ((reason: number) => void) | null): boolean { return MelonDSNative.native.setFirmwareStopCallback(callback); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setFirmwareStopCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Rig...
static setFirmwareStopCallback(callback: ((reason: number) => void) | null): boolean { return MelonDSNative.native.setFirmwareStopCallback(callback); }
https://github.com/richshaw2015/nds
8bedeb90365e684bd00257b513628f0241519fb6
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentDataViewModel.ets
arkts
jumpComponentDetail
跳转组件详情 @param cardComponentContentModel CardComponentContentModel
protected jumpComponentDetail(cardComponentContentModel: CardComponentContentModel) { const pageContext: PageContextManager = this.globalInfoModel.currentBreakpoint === BreakpointTypeEnum.XL ? AppStorage.get(StorageKeyEnum.DESIGNPATTERN_PAGE_CONTEXT)! : AppStorage.get(StorageKeyEnum.HOME_PAGE_CONTEXT)! ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left jumpComponentDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cardComponentContentModel AST#identifier#Right AST#:#Left : AST#:#Right AS...
protected jumpComponentDetail(cardComponentContentModel: CardComponentContentModel) { const pageContext: PageContextManager = this.globalInfoModel.currentBreakpoint === BreakpointTypeEnum.XL ? AppStorage.get(StorageKeyEnum.DESIGNPATTERN_PAGE_CONTEXT)! : AppStorage.get(StorageKeyEnum.HOME_PAGE_CONTEXT)! ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
dd41d64ced8eb75fe65d0c15813472eaf5d784d4
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
from
Creates an array from an array of the same type. @param { Uint32Array } arr - An array to convert to a new array. @returns { Uint32Array } - A new Uint32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Uint32Array): Uint32Array { let result = new Uint32Array(arr.length) result.set(arr) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: Uint32Array): Uint32Array { let result = new Uint32Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
4746bca9c0134a0b1fa1e2bcd2c761736ddae67c
gitcode
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/components/MeasurementComponent.ets
arkts
asMeasurementHandler
Convenience method: returns a MeasurementHandler bound to this, can be passed directly to register().
asMeasurementHandler(): MeasurementHandler { return this.measure.bind(this); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left asMeasurementHandler AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left MeasurementHandler AST#identifier#Right A...
asMeasurementHandler(): MeasurementHandler { return this.measure.bind(this); }
https://github.com/AGenUI/AGenUI
6f08225a993c4f33b53cf98526cfb332b58d0c18
github
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
getReConnectCount
Get connect retry count @return
public getReConnectCount(): number { return this.reConnectCount; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getReConnectCount 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 A...
public getReConnectCount(): number { return this.reConnectCount; }
https://gitee.com/openharmony-sig/FastBle.git
85111d3f2c78dcccd15004b09b4aa687f5a42221
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
request
网络请求封装 - 带重试机制 @param config 请求配置 @returns Promise<ApiResponse>
static async request<T>(config: RequestConfig, retryCount: number = 0): Promise<ApiResponse<T>> { // 检查网络状态 if (!HttpUtil.checkNetworkStatus()) { prompt.showToast({ message: '网络连接不可用,请检查网络设置', duration: 3000 }); throw new Error('网络不可用'); } const httpRequest = http.cr...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left request AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#...
static async request<T>(config: RequestConfig, retryCount: number = 0): Promise<ApiResponse<T>> { // 检查网络状态 if (!HttpUtil.checkNetworkStatus()) { prompt.showToast({ message: '网络连接不可用,请检查网络设置', duration: 3000 }); throw new Error('网络不可用'); } const httpRequest = http.cr...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
a17b7bf538767b37f3d41eb2743544e90429a3df
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/StoragePaths.ets
arkts
getFilesDir
从 Context 获取实际的 filesDir(推荐使用)
static getFilesDir(context: common.Context): string { return context.filesDir }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFilesDir 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#member_expression...
static getFilesDir(context: common.Context): string { return context.filesDir }
https://github.com/AetheriumSimulator/qemu-hmos
373e3a1af326b9fada55a580565bc00660939031
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
equals
equals @param {Type} other type to be checked against @returns {boolean} @throws {Error} - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override equals(other: Type): boolean { return other instanceof CharType }
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 CharType }
https://gitcode.com/iop123123/arkts-static-skills
6406e67223ddaac0e1d1d2c97e8052532618ad5f
gitcode
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets
arkts
Test012
E2E_012: AnimatedDrawableDescriptor release() -> release() 不崩溃
Test012() { const id = 'E2E_012' try { let drawable = this.CreateAnimatedDrawable() drawable.release() drawable.release() // 第二次调用不应崩溃 if (drawable.isReleased()) { this.Pass(id) } else { this.Fail(id, '第二次 release 后 isReleased 为 false') } } catch (e) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Test012 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#lexical_declaration#Left AST#...
Test012() { const id = 'E2E_012' try { let drawable = this.CreateAnimatedDrawable() drawable.release() drawable.release() // 第二次调用不应崩溃 if (drawable.isReleased()) { this.Pass(id) } else { this.Fail(id, '第二次 release 后 isReleased 为 false') } } catch (e) { ...
https://gitcode.com/openharmony/arkui_ace_engine
b55539421564e06d902589205e4300178bfe0e04
gitcode
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/form-page-template.ets
arkts
validateField
==================== 表单校验 ====================
validateField(field: keyof FormErrors): boolean { switch (field) { case 'name': if (!this.form.name.trim()) { this.errors.name = '请输入姓名'; return false; } if (this.form.name.trim().length < 2) { this.errors.name = '姓名至少2个字符'; return false; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validateField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#keyof#Left keyof AST#keyof#Right AST#ERROR#Right AST#identifier#Left Form...
validateField(field: keyof FormErrors): boolean { switch (field) { case 'name': if (!this.form.name.trim()) { this.errors.name = '请输入姓名'; return false; } if (this.form.name.trim().length < 2) { this.errors.name = '姓名至少2个字符'; return false; ...
https://github.com/Goway-Hui/harmonyos-next-dev
25a739dbfbe7901b0cb4aaaa120a72890fb9ebc1
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test49_original_index.ets
arkts
simpleHash
--- String hash function ---
function simpleHash(s: string): number { let hash: number = 0; for (let i: number = 0; i < s.length; i++) { let ch: number = s.charCodeAt(i); hash = ((hash << 5) - hash) + ch; hash = hash & hash; // Convert to 32-bit int } if (hash < 0) { hash = -hash; } return hash; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left simpleHash AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function simpleHash(s: string): number { let hash: number = 0; for (let i: number = 0; i < s.length; i++) { let ch: number = s.charCodeAt(i); hash = ((hash << 5) - hash) + ch; hash = hash & hash; // Convert to 32-bit int } if (hash < 0) { hash = -hash; } return hash; }
https://github.com/miaochiahao/ark-ghidra
b16e5e48b2285f6e76ca36a03ef078696d45d9df
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getStringByXPath
通过XPath获取字符串 完整实现,支持多种XPath语法
private getStringByXPath(xpath: string): string { const results = this.getStringListByXPath(xpath); return results.length > 0 ? results.join('\n') : ''; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringByXPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xpath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private getStringByXPath(xpath: string): string { const results = this.getStringListByXPath(xpath); return results.length > 0 ? results.join('\n') : ''; }
https://github.com/DaLongZhuaZi/manxia
46e0c3a666df47c2b919d6328fa12806e46b20f6
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/pages/DietPage.ets
arkts
guessMealTime
3. 【新增】原 FoodSelectorDialog 里的猜测逻辑移到这里
guessMealTime(): MealTime { const hour = new Date().getHours(); if (hour >= 5 && hour < 10) { return MealTime.BREAKFAST; } if (hour >= 10 && hour < 15) { return MealTime.LUNCH; } if (hour >= 15 && hour < 20) { return MealTime.DINNER; } return MealTime.SNACK; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left guessMealTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left MealTime AST#identifier#Right AST#ERROR#Right AS...
guessMealTime(): MealTime { const hour = new Date().getHours(); if (hour >= 5 && hour < 10) { return MealTime.BREAKFAST; } if (hour >= 10 && hour < 15) { return MealTime.LUNCH; } if (hour >= 15 && hour < 20) { return MealTime.DINNER; } return MealTime.SNACK; }
https://gitcode.com/openharmony/codelabs
51075379e19f618b00451f7632ba2f2054c441ba
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
buildChaptersFromExtraction
根据智能提取器的章节信息构建章节列表
private buildChaptersFromExtraction(content: string, chapterInfos: import('./TxtMetadataExtractor').TxtChapterInfo[], bookId: string): EBookChapter[] { const chapters: EBookChapter[] = []; const now = Date.now(); for (let i = 0; i < chapterInfos.length; i++) { const info = chapterInfos[i]; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildChaptersFromExtraction 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 st...
private buildChaptersFromExtraction(content: string, chapterInfos: import('./TxtMetadataExtractor').TxtChapterInfo[], bookId: string): EBookChapter[] { const chapters: EBookChapter[] = []; const now = Date.now(); for (let i = 0; i < chapterInfos.length; i++) { const info = chapterInfos[i]; ...
https://github.com/DaLongZhuaZi/manxia
8229e5ca956ccb0585220f0efcab267907cdc1c0
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/interop/js/ESError.ets
arkts
name
Retrieves the name of the error from the ESValue. If the property does not exist, returns "UnknownError".
override get name(): string { return this.err_.hasProperty("name") ? this.err_.getProperty("name").toString() : "UnknownError"; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#identifier#Left name AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS...
override get name(): string { return this.err_.hasProperty("name") ? this.err_.getProperty("name").toString() : "UnknownError"; }
https://gitcode.com/iop123123/arkts-static-skills
047431e552482b4893c0b5d610e3bf288e576646
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/Preferences/entry/src/main/ets/common/utils/Logger.ets
arkts
info
Outputs info-level logs. @param args Indicates the log parameters.
info(...args: string[]) { hilog.info(this.domain, this.prefix, this.format, args); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left info AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
info(...args: string[]) { hilog.info(this.domain, this.prefix, this.format, args); }
https://gitee.com/harmonyos/codelabs.git
dae0b4b75b993ad4fb8f45b10c37b03158d3ebd6
gitee
Vincent-Leon/zotero-harmony
entry/src/main/ets/data/ItemRepository.ets
arkts
upsertCollections
---- collections ----
async upsertCollections(cols: ZoteroCollection[]): Promise<void> { if (cols.length === 0) { return; } const buckets: relationalStore.ValuesBucket[] = []; const cachedAt: number = Date.now(); for (const col of cols) { buckets.push(collectionToBucket(col, cachedAt)); } try { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left upsertCollections AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cols AST#identifier#Right A...
async upsertCollections(cols: ZoteroCollection[]): Promise<void> { if (cols.length === 0) { return; } const buckets: relationalStore.ValuesBucket[] = []; const cachedAt: number = Date.now(); for (const col of cols) { buckets.push(collectionToBucket(col, cachedAt)); } try { ...
https://github.com/Vincent-Leon/zotero-harmony
684431e575754b05db2a903f94c132ad57adfc7d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findLast
Finds the last element in the Int16Array that satisfies the condition @param fn condition @returns the last element that satisfies fn
public findLast(fn: (val: short) => boolean): short { let newF: (val: short, index: int, array: Int16Array) => boolean = (val: short, index: int, array: Int16Array): boolean => { return fn(val) } return this.findLast(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast 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#:...
public findLast(fn: (val: short) => boolean): short { let newF: (val: short, index: int, array: Int16Array) => boolean = (val: short, index: int, array: Int16Array): boolean => { return fn(val) } return this.findLast(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eef079f6c4c4ed6fab485304d9f34e1caebd8446
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array of the same type. @param { Float32Array } arr - An array to convert to a new array. @returns { Float32Array } - A new Float32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Float32Array): Float32Array { let result = new Float32Array(arr.length) result.set(arr) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: Float32Array): Float32Array { let result = new Float32Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
ac2d86200bfb9dd65a64e775f49fa08c9da52679
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/LearningRecorder.ets
arkts
recentWrongIds
Return the most-recent `limit` wordIds whose latest outcome was wrong. De-duplicated and ordered most-recent-first so the review pool surfaces the word the learner just missed.
recentWrongIds(limit: number): string[] { if (limit <= 0) { return []; } const candidates: WordStat[] = this.snapshot.stats .filter((s: WordStat): boolean => s.wrongCount > 0) .slice(); candidates.sort((a: WordStat, b: WordStat): number => { if (b.lastAnsweredMs !== a.lastAnswe...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left recentWrongIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Rig...
recentWrongIds(limit: number): string[] { if (limit <= 0) { return []; } const candidates: WordStat[] = this.snapshot.stats .filter((s: WordStat): boolean => s.wrongCount > 0) .slice(); candidates.sort((a: WordStat, b: WordStat): number => { if (b.lastAnsweredMs !== a.lastAnswe...
https://github.com/terryma2024/happyword
81fac1efc2bef1e7a7d348639d34669a65e21ae8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets
arkts
startAnimation
开始动画 @param onComplete 动画完成回调
public startAnimation(onComplete?: () => void): void { if (this.isAnimating) { logger.warn(TAG, '动画已在进行中'); return; } if (this.animatingSnapshots.length === 0) { logger.warn(TAG, '没有需要动画的条目'); onComplete?.(); return; } this.isAnimating = true; this.anima...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left startAnimation AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left onComplete AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#argum...
public startAnimation(onComplete?: () => void): void { if (this.isAnimating) { logger.warn(TAG, '动画已在进行中'); return; } if (this.animatingSnapshots.length === 0) { logger.warn(TAG, '没有需要动画的条目'); onComplete?.(); return; } this.isAnimating = true; this.anima...
https://github.com/DaLongZhuaZi/manxia
91bba33552e008e8cf1c38880a9c20027f2de54d
github
seagazer/cclyric
lib/src/main/ets/extensions/ColorHelper.ets
arkts
hex2String
hex, argb, string
private static hex2String(hex: number): string { let hexString = hex.toString(16) if (hexString.length < 6) { let size = 6 - hexString.length let fill = "" for (let i = 0; i < size; i++) { fill += 0 } return "#" + fill + hex...
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 hex2String AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST...
private static hex2String(hex: number): string { let hexString = hex.toString(16) if (hexString.length < 6) { let size = 6 - hexString.length let fill = "" for (let i = 0; i < size; i++) { fill += 0 } return "#" + fill + hex...
https://github.com/seagazer/cclyric
48486045e6ec681fdbc80233f6b41cb1af77565b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
deviceAdded
USB 设备添加
deviceAdded(controller: AbstractController): void { const controllerId = controller.getControllerId(); const vendorId = controller.getVendorId(); const productId = controller.getProductId(); const deviceKey = controller.getDeviceKey(); // 混合模式:GCK 处理设备管理和输入,USB 驱动只提供震动/附加功能 // 不注册设备、不分配槽位...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deviceAdded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left controller AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AbstractController AST#identifier#Righ...
deviceAdded(controller: AbstractController): void { const controllerId = controller.getControllerId(); const vendorId = controller.getVendorId(); const productId = controller.getProductId(); const deviceKey = controller.getDeviceKey(); // 混合模式:GCK 处理设备管理和输入,USB 驱动只提供震动/附加功能 // 不注册设备、不分配槽位...
https://github.com/AlkaidLab/moonlight-harmony
33d0e6b79c055d6fbcbe37a7729d732e0111942c
github
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
scaledSize
==================== 缩放工具 ==================== 按屏幕尺寸计算比例值 用法:WearScreenUtil.scaledSize(200) — 在 standard 屏返回 200vp 在 small 屏自动缩小,在 large 屏自动放大 ⚠️ 设计说明: - 基准 466vp 取自 Watch GT 4(圆形 standard 屏),对圆形屏更友好 - 方形小屏(320×320)下比例 ~0.687,受 70% 下限保护 - 该函数仅用于 Canvas 等需要精确 vp 值的场景(如转盘绘制) - 一般布局尺寸优先使用百分比 Token(mainImageWidth 等),不依赖此函数
static scaledSize(standardValue: number): number { const scale = WearScreenUtil.screenWidth / 466; // 以 466vp(Watch GT 4 圆形屏)为基准 return Math.max(standardValue * scale, standardValue * 0.7); // 最小缩到 70% }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left scaledSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left standardValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
static scaledSize(standardValue: number): number { const scale = WearScreenUtil.screenWidth / 466; // 以 466vp(Watch GT 4 圆形屏)为基准 return Math.max(standardValue * scale, standardValue * 0.7); // 最小缩到 70% }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
10245758d3750c663f66011f53c5cc29ece64de9
github
robotzzh/AgricultureApp
entry/src/main/ets/DB/relationDB.ets
arkts
insertDatas
向数据库中插入数据
async insertDatas(tableName: string, valueBucket) { if (store != undefined) { (store as relationalStore.RdbStore).insert(tableName, valueBucket, (err, rowId: number) => { if (err) { console.error(`Failed to insert data. Code:${err.code}, message:${err.message}`); return; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertDatas AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AS...
async insertDatas(tableName: string, valueBucket) { if (store != undefined) { (store as relationalStore.RdbStore).insert(tableName, valueBucket, (err, rowId: number) => { if (err) { console.error(`Failed to insert data. Code:${err.code}, message:${err.message}`); return; ...
https://github.com/robotzzh/AgricultureApp
6e535f0465fbe38f62e1a143197e0d6e5dba7d76
github
erosTeam/NextE
shared/src/main/ets/utils/EhUrlRouter.ets
arkts
canHandle
True if the URL is an EH gallery or image-page link this router can route.
static canHandle(url: string): boolean { return EhUrlRouter.GALLERY_RE.test(url) || EhUrlRouter.IMAGE_RE.test(url) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left canHandle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static canHandle(url: string): boolean { return EhUrlRouter.GALLERY_RE.test(url) || EhUrlRouter.IMAGE_RE.test(url) }
https://github.com/erosTeam/NextE
1ec9a4f82e22c06eba1590f77835b3b3d68e58b2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelReplaceRuleManager.ets
arkts
importRules
导入规则(JSON格式)
async importRules(json: string): Promise<ReplaceRuleImportResult> { const result: ReplaceRuleImportResult = { total: 0, success: 0, failed: 0, errors: [] }; try { const data: Object = SafeUtils.parseObj(json); const rules: Object[] = Array.isArray(data) ? data as Objec...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importRules AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async importRules(json: string): Promise<ReplaceRuleImportResult> { const result: ReplaceRuleImportResult = { total: 0, success: 0, failed: 0, errors: [] }; try { const data: Object = SafeUtils.parseObj(json); const rules: Object[] = Array.isArray(data) ? data as Objec...
https://github.com/DaLongZhuaZi/manxia
f26b1b0c2b420bfdaaf066591f53e351410c374e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getFirstRight
Returns the first DataSet from the datasets-array that has it's dependency on the right axis. Returns null if no DataSet with right dependency could be found. @return
public getFirstRight(sets: JArrayList<T>): T | null { for (let dataSet of sets.dataSource) { if (dataSet.getAxisDependency() == AxisDependency.RIGHT) return dataSet; } return null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFirstRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sets AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
public getFirstRight(sets: JArrayList<T>): T | null { for (let dataSet of sets.dataSource) { if (dataSet.getAxisDependency() == AxisDependency.RIGHT) return dataSet; } return null; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
679b80845bea10cd6a1254d27c5534712c1cb006
gitee
arkui-x/samples
CodeLab/Cases/feature/applicationexception/src/main/ets/model/PreferencesManager.ets
arkts
putFaultMessage
存储数据异常信息 @param faultMessage 异常信息集合
public static async putFaultMessage(faultMessage: Array<string>): Promise<void> { logger.info(TAG, `putFaultMessage start`); try { dataPreferencesManager.setValue('faultMessage', JSON.stringify(faultMessage)) } catch (err) { const code = (err as BusinessError).code; const message = (err ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left putFaultMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST...
public static async putFaultMessage(faultMessage: Array<string>): Promise<void> { logger.info(TAG, `putFaultMessage start`); try { dataPreferencesManager.setValue('faultMessage', JSON.stringify(faultMessage)) } catch (err) { const code = (err as BusinessError).code; const message = (err ...
https://gitcode.com/arkui-x/samples
18ff115029feb87f3a5d5ce7a74f8e75a2b21ca0
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
setOnMediaFrameReceived
设置媒体帧接收回调(Rust 层 RTP 解包 + 帧重组后的完整帧)
public setOnMediaFrameReceived(callback: (frame: NapiMediaFrame) => void): void { this.onMediaFrameReceived = callback; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setOnMediaFrameReceived 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#(#Le...
public setOnMediaFrameReceived(callback: (frame: NapiMediaFrame) => void): void { this.onMediaFrameReceived = callback; }
https://github.com/tdcare/tdwebrtc
ed977cad188d2d050d505a10e9e71967319b3136
github
HarmonyOS_Samples/guide-snippets
ArkGraphics3D/entry/src/main/ets/material/pbr_clearcoat.ets
arkts
build
[End pbr_clearcoat_setClearcoatRoughness]
build() { Column() { if (this.sceneOpt) { // Present 3D scenes through Component3D Component3D(this.sceneOpt) .onTouch((event: TouchEvent) => { // Handle touch input for orbit camera rotation this.orbitCamera.HandleTouchEvent(event); if (this.cam...
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() { if (this.sceneOpt) { // Present 3D scenes through Component3D Component3D(this.sceneOpt) .onTouch((event: TouchEvent) => { // Handle touch input for orbit camera rotation this.orbitCamera.HandleTouchEvent(event); if (this.cam...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
9c4aabd293a3cb38c92e89a173a091a1f8830a81
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
getFavoriteComics
获取收藏列表
public async getFavoriteComics(): Promise<ComicInfo[]> { try { const favorites = await this.dataManager.getUserFavorites(this.currentUserId); const comicIds = favorites.map(fav => fav.comicId); const comics: ComicInfo[] = []; for (const comicId of comicIds) { const comic = a...
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 getFavoriteComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public async getFavoriteComics(): Promise<ComicInfo[]> { try { const favorites = await this.dataManager.getUserFavorites(this.currentUserId); const comicIds = favorites.map(fav => fav.comicId); const comics: ComicInfo[] = []; for (const comicId of comicIds) { const comic = a...
https://github.com/DaLongZhuaZi/manxia
d4e9e379fc94061db1aa62d1b30fc3b3c0f88379
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets
arkts
setPrivacyPassword
设置隐私密码
public async setPrivacyPassword(password: string): Promise<void> { const passwordHash = this.hashPassword(password); await this.settingsManager.setString('privacy_password_hash', passwordHash); logger.info(TAG, '隐私密码已设置'); }
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 setPrivacyPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#L...
public async setPrivacyPassword(password: string): Promise<void> { const passwordHash = this.hashPassword(password); await this.settingsManager.setString('privacy_password_hash', passwordHash); logger.info(TAG, '隐私密码已设置'); }
https://github.com/DaLongZhuaZi/manxia
f0f72405c762b3056913ce011c442a0380e1eefa
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
with
Creates a copy with replaced value on index @param index @param value @returns an Float64Array with replaced value on index
public with(index: number, value: number): Float64Array { return this.with(index as int, value as double as int as double) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: number, value: number): Float64Array { return this.with(index as int, value as double as int as double) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
447d0ee3241a0af4f68247bd35989bbe7d44ebe9
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
cleanOldestTempCache
清理最旧的临时缓存
private async cleanOldestTempCache(dirPath: string, sizeToFree: number): Promise<void> { try { // 收集所有文件及其修改时间 const files: Array<FileInfo> = []; await this.collectFiles(dirPath, files); // 按修改时间排序(最旧的在前) files.sort((a, b) => a.mtime - b.mtime); let freedSize = 0;...
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 cleanOldestTempCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST...
private async cleanOldestTempCache(dirPath: string, sizeToFree: number): Promise<void> { try { // 收集所有文件及其修改时间 const files: Array<FileInfo> = []; await this.collectFiles(dirPath, files); // 按修改时间排序(最旧的在前) files.sort((a, b) => a.mtime - b.mtime); let freedSize = 0;...
https://github.com/DaLongZhuaZi/manxia
b1902f3e2a15722205eb9220b2b7127719b94f41
github
openharmony/applications_filepicker
audiopicker/src/main/ets/pages/viewmodel/AudioPickerViewModel.ets
arkts
queryAudioPickerList
查询音频详情基类,子类需要重载 @returns
public queryAudioPickerList(pageNo: number, context: Context): Promise<boolean> { return new Promise<boolean>((resolve) => { try { this.localResourceManager.getLocalAudioResource(pageNo * Constants.PICKER_PAGE_SIZE, Constants.PICKER_PAGE_SIZE, context).then((value) => { this.audi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryAudioPickerList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageNo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public queryAudioPickerList(pageNo: number, context: Context): Promise<boolean> { return new Promise<boolean>((resolve) => { try { this.localResourceManager.getLocalAudioResource(pageNo * Constants.PICKER_PAGE_SIZE, Constants.PICKER_PAGE_SIZE, context).then((value) => { this.audi...
https://gitee.com/openharmony/applications_filepicker.git
4081197b790d93d1c155d4212a2d955112a01d53
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/security/HashUtils.ets
arkts
md5Hex
组件功能简介: - 计算字符串 MD5 摘要。 可传入项: - `value`: 待计算的原始字符串。 返回行为: - 返回 MD5 十六进制字符串;异常时返回空字符串。 副作用: - 会分配临时字节数组并调用底层加密实现。
static async md5Hex(value: string): Promise<string> { try { const md = cryptoFramework.createMd('MD5'); await md.update({ data: new Uint8Array(buffer.from(value, 'utf-8').buffer) }); const digest = await md.digest(); return HashUtils.bytesToHex(digest.data); } catch (_err...
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 md5Hex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Rig...
static async md5Hex(value: string): Promise<string> { try { const md = cryptoFramework.createMd('MD5'); await md.update({ data: new Uint8Array(buffer.from(value, 'utf-8').buffer) }); const digest = await md.digest(); return HashUtils.bytesToHex(digest.data); } catch (_err...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/security/HashUtils.ets#L31-L42
0713b40753788256adba00ac37c37576d8b0fd64
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/chatsetting/pages/GroupChatSetting.ets
arkts
<arrow>
onDismiss
() => { console.log('[GroupSettingPage] User cancelled add member operation'); },
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#=>#Left => AST#=>#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left...
() => { console.log('[GroupSettingPage] User cancelled add member operation'); },
https://github.com/Tencent-RTC/TUIKit_Harmony
6a775665c065f2ec077f5541829bcd5560a82f7e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/FinancialHealth.ets
arkts
calculateBudgetAdherenceFromBills
从账单和预算计算预算执行评分 @param bills 账单列表 @param budgets 预算列表 @param userId 用户ID @param month 指定月份(YYYY-MM格式)
static calculateBudgetAdherenceFromBills( bills: Bill[], budgets: Budget[], userId: number, month: string ): DimensionScore { // 计算总预算 let totalBudgeted = 0; for (let i = 0; i < budgets.length; i++) { const budget = budgets[i]; if (budget.userId === userId && budget.isDeleted...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateBudgetAdherenceFromBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
static calculateBudgetAdherenceFromBills( bills: Bill[], budgets: Budget[], userId: number, month: string ): DimensionScore { // 计算总预算 let totalBudgeted = 0; for (let i = 0; i < budgets.length; i++) { const budget = budgets[i]; if (budget.userId === userId && budget.isDeleted...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
0998a0086fcec8ba6204aa645ec917e91e6528e9
github
aimilin6688/KeePassHO
entry/src/main/ets/entryability/EntryAbility.ets
arkts
openPage
打开页面 @param page
private openPage(page: string): void { if (this.windowStage) { this.windowStage.loadContent(page, (err, data) => { this.loadContentCallback(err, data) }); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
private openPage(page: string): void { if (this.windowStage) { this.windowStage.loadContent(page, (err, data) => { this.loadContentCallback(err, data) }); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/entryability/EntryAbility.ets#L175-L181
c31f222704f4acc7a93242cc2696a8f8485cde95
github
HarmonyCandies/extended_text
extended_text/src/main/ets/builder/SpecialTextSpanBuilder.ets
arkts
build
构建包含特殊文本的 TextSpan
build(data: string, context: Context, textStyle?: text.TextStyle,): TextSpan { if (data === '') { return new TextSpan({ text: '', style: textStyle }); } const inlineList: InlineSpan[] = []; if (data.length > 0) { let specialText: SpecialText | null = null; let textStack = ''; ...
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#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig...
build(data: string, context: Context, textStyle?: text.TextStyle,): TextSpan { if (data === '') { return new TextSpan({ text: '', style: textStyle }); } const inlineList: InlineSpan[] = []; if (data.length > 0) { let specialText: SpecialText | null = null; let textStack = ''; ...
https://github.com/HarmonyCandies/extended_text
37373c87cc7128000f546980bd1ec666a257b3f2
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/ThreadPaginationManager.ets
arkts
reset
重置到初始分页状态。 hasMore 复位为 true:reset 后乐观假设还有更多页,避免 UI 立即判定无可加载内容; 这与 {@link PaginationManager.applyState} 根据实际响应(page < totalPages)设置 hasMore 的语义不同——后者反映服务端事实,前者只是 reset 的安全默认值。
reset(): void { this.posts = [] this.pageOfIndex = [] this.loadedLouSet.clear() this.loadedPageStart = 1 this.currentPage = 1 this.totalPages = 0 // 乐观假设还有更多页,待首次加载响应到达后由 applyState 按实际页数修正 this.hasMore = true this.clearPrefetchedPages() this.prefetchedPrevPosts = [] this.p...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.posts = [] this.pageOfIndex = [] this.loadedLouSet.clear() this.loadedPageStart = 1 this.currentPage = 1 this.totalPages = 0 // 乐观假设还有更多页,待首次加载响应到达后由 applyState 按实际页数修正 this.hasMore = true this.clearPrefetchedPages() this.prefetchedPrevPosts = [] this.p...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L34-L47
639ece91e2e189742fe8de6d5b095c2122242737
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
updateReview
更新复习记录
updateReview(rating: number, isCorrect: boolean): void { this.lastReviewed = Date.now(); this.reviewCount++; if (isCorrect) { this.correctCount++; } else { this.incorrectCount++; } // 更新平均评分 this.avgRating = (this.avgRating * (this.reviewCount - 1) + rating) / this.review...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rating AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ...
updateReview(rating: number, isCorrect: boolean): void { this.lastReviewed = Date.now(); this.reviewCount++; if (isCorrect) { this.correctCount++; } else { this.incorrectCount++; } // 更新平均评分 this.avgRating = (this.avgRating * (this.reviewCount - 1) + rating) / this.review...
https://github.com/CLMC2025/Vignette
753c7ecd493a0331b4b81ccac19961012d3cdca8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseTypes.ets
arkts
createComicSourceRecord
创建漫画源数据库记录
static createComicSourceRecord(): ComicSourceDatabaseRecord { return { id: '', name: '', baseUrl: '', pluginId: '', isEnabled: true, priority: 0, lastUpdateTime: 0, configJson: '{}', addTime: 0 }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createComicSourceRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Lef...
static createComicSourceRecord(): ComicSourceDatabaseRecord { return { id: '', name: '', baseUrl: '', pluginId: '', isEnabled: true, priority: 0, lastUpdateTime: 0, configJson: '{}', addTime: 0 }; }
https://github.com/DaLongZhuaZi/manxia
85431f52ddfb2a4963a4fb35427c5f4d78248fac
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Creates a slice of current Uint8ClampedArray using range [begin, end) @param begin start index to be taken into slice @param end last index to be taken into slice @returns a new Uint8ClampedArray with elements of current Uint8ClampedArray[begin;end) where end index is excluded @link https://developer.mozilla.org/en-US/...
/* public */ internal slice(begin: int, end: int): Uint8ClampedArray { if (begin < -this.length) { begin = 0 } if (begin < 0) { begin = this.length + begin } if (begin >= this.length) { return new Uint8ClampedArray(new ArrayBuffer(0)) ...
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Ri...
/* public */ internal slice(begin: int, end: int): Uint8ClampedArray { if (begin < -this.length) { begin = 0 } if (begin < 0) { begin = this.length + begin } if (begin >= this.length) { return new Uint8ClampedArray(new ArrayBuffer(0)) ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e231b4af1e32d634d75588d6b6e6dcb588024dd2
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int8Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { number } byteOffset - byte offset from begin of the buf @throws { RangeError } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(buf: ArrayBuffer, byteOffset: number) { this(buf, new Number(byteOffset), undefined) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: number) { this(buf, new Number(byteOffset), undefined) }
https://gitcode.com/iop123123/arkts-static-skills
d571c6cdf3aa5404974d9b82e250d453b178f082
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
toSorted
Creates a sorted copy @returns { Uint16Array } - a sorted copy @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toSorted(): Uint16Array { return new Uint16Array(this).sort() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Uint16Array A...
public toSorted(): Uint16Array { return new Uint16Array(this).sort() }
https://gitcode.com/iop123123/arkts-static-skills
4a5fdb60f8a4dbfc39853fe2b9b80f204030c892
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { number } value - value to set @returns { Int32Array } - an Int32Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStage...
public with(index: int, value: number): Int32Array { let res = new Int32Array(this) res.set(index, value.toInt()) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: number): Int32Array { let res = new Int32Array(this) res.set(index, value.toInt()) return res }
https://gitcode.com/iop123123/arkts-static-skills
238617f2479773ebbccba66521263de819375be8
gitcode
the-wwyang/kids-learning-app
src/main/ets/storage/AppStorageManager.ets
arkts
saveCurrentUserData
保存当前用户数据
private async saveCurrentUserData(): Promise<boolean> { if (this.dataPreferences === null || this.currentUserData === null) { return false; } try { const dataRecord: Record<string, string | number> = { 'username': this.currentUserData.username, 'nickname': this.currentUserData...
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 saveCurrentUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async saveCurrentUserData(): Promise<boolean> { if (this.dataPreferences === null || this.currentUserData === null) { return false; } try { const dataRecord: Record<string, string | number> = { 'username': this.currentUserData.username, 'nickname': this.currentUserData...
https://github.com/the-wwyang/kids-learning-app
cffcd752cb307afe3ca6f8ec1879999c8aa850f9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
mergeComics
合并两部漫画的数据
async mergeComics(targetId: string, sourceId: string): Promise<void> { try { logger.info(TAG, `开始合并漫画: ${sourceId} -> ${targetId}`); // 1. 更新章节的comicId const updateChaptersSql = `UPDATE chapter SET comicId = ? WHERE comicId = ?`; await this.databaseManager.executeSql(updateChaptersS...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left mergeComics AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left targetId AST#identifier#Right AST#type_annotation#Left AST...
async mergeComics(targetId: string, sourceId: string): Promise<void> { try { logger.info(TAG, `开始合并漫画: ${sourceId} -> ${targetId}`); // 1. 更新章节的comicId const updateChaptersSql = `UPDATE chapter SET comicId = ? WHERE comicId = ?`; await this.databaseManager.executeSql(updateChaptersS...
https://github.com/DaLongZhuaZi/manxia
0e9eb641cc1651d379832aa1474c331ca5750c30
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets
arkts
getParam
获取系统参数 @param {string} key - 参数键 @returns {Promise<NetworkResponse<string>>} 参数值
async getParam(key: string): Promise<NetworkResponse<string>> { const resp: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.get("base/comm/param", { params: { key } }); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getParam AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
async getParam(key: string): Promise<NetworkResponse<string>> { const resp: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.get("base/comm/param", { params: { key } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
1d5130d8c872144ffb5384406f1c62d0aa1780b9
github
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets
arkts
nativeGetPermissionAuthorizeResult
Check if the user has granted access to a device resource or information that requires authorization. @param permission - Permission name. @param result - Return status code. @param onAuthorized - Triggered when the permission is authorized. @param onUnauthorized - Triggered when the permission is unauthorized.
public static nativeGetPermissionAuthorizeResult(permission: string, result: number, onAuthorized: ESObject, onUnauthorized: ESObject): void { tuanjie.nativeGetPermissionAuthorizeResult(permission, result, onAuthorized, onUnauthorized); }
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 nativeGetPermissionAuthorizeResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left permission AST#identifier#Right AST...
public static nativeGetPermissionAuthorizeResult(permission: string, result: number, onAuthorized: ESObject, onUnauthorized: ESObject): void { tuanjie.nativeGetPermissionAuthorizeResult(permission, result, onAuthorized, onUnauthorized); }
https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
e2be5a4ee6dcab60ee2e682f4747efa5cddc51ec
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/button/ToggleDemo.ets
arkts
applyContent
返回指定的自定义 Switch
applyContent() : WrappedBuilder<[ToggleConfiguration]> { return wrapBuilder(buildSwitch) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#instantiation_expre...
applyContent() : WrappedBuilder<[ToggleConfiguration]> { return wrapBuilder(buildSwitch) }
https://github.com/webabcd/HarmonyDemo
5db866f443e04bcb0393b77903ded036a4098eb3
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/IndoorLocator.ets
arkts
setMockPosition
模拟设置位置(用于测试) @param position 位置
public setMockPosition(position: Position3D): void { this.currentPosition = position; this.lastUpdateTime = Date.now(); this.signalStrength = SignalStrength.GOOD; if (this.positionUpdateCallback) { this.positionUpdateCallback(position); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMockPosition 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#L...
public setMockPosition(position: Position3D): void { this.currentPosition = position; this.lastUpdateTime = Date.now(); this.signalStrength = SignalStrength.GOOD; if (this.positionUpdateCallback) { this.positionUpdateCallback(position); } }
https://github.com/LJ666-ui/harmony-health-care
4e743faed66a1405a8f4f2b61a21114f7c67b6a9
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/AchievementService.ets
arkts
calculateProgress
计算成就进度
private async calculateProgress(achievement: Achievement): Promise<void> { const records = await this.historyService.getSportRecords(); const statistics = await this.statisticsService.calculateUserStatistics(); let currentValue = 0; let targetValue = achievement.targetValue; switch (achievement....
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 calculateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left achievement AST#identifier#Right AS...
private async calculateProgress(achievement: Achievement): Promise<void> { const records = await this.historyService.getSportRecords(); const statistics = await this.statisticsService.calculateUserStatistics(); let currentValue = 0; let targetValue = achievement.targetValue; switch (achievement....
https://gitcode.com/openharmony/codelabs
9237931c28245edc9c51a325d83d8b032363ab86
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/ExperimentService.ets
arkts
preloadDirect
===== 预加载实验数据(供 EhallService.preloadAllData 调用)=====
async preloadDirect(): Promise<number> { console.info(TAG, 'preloadDirect: start'); try { const r0: HttpResponse = await this.http.get( SYSJ_BASE + '/xidian/schedule/myScheduleInfoAjax?termId=' + TERM_ID + '&week=1' ); let allItems: Record<string, string>[] = []; if (r0.isOk ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left preloadDirect 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 A...
async preloadDirect(): Promise<number> { console.info(TAG, 'preloadDirect: start'); try { const r0: HttpResponse = await this.http.get( SYSJ_BASE + '/xidian/schedule/myScheduleInfoAjax?termId=' + TERM_ID + '&week=1' ); let allItems: Record<string, string>[] = []; if (r0.isOk ...
https://github.com/PollenWang6/HiXD
6d48c3a2e5cc410e21c04aaa0e8dd86434bda030
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
ecmaMakeTime
@see ECMA-262, 21.4.1.14 @param hr @param min @param sec @param ms @returns Constructed time in milliseconds.
function ecmaMakeTime(hr: long, min: long, sec: long, ms: long): long { return hr * msPerHour + min * msPerMinute + sec * msPerSecond + ms; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaMakeTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left hr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function ecmaMakeTime(hr: long, min: long, sec: long, ms: long): long { return hr * msPerHour + min * msPerMinute + sec * msPerSecond + ms; }
https://gitcode.com/iop123123/arkts-static-skills
5fabdb87a2e499f070692a9b22cad4fa54c42afb
gitcode
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/common/database/tables/SelfInfoApi.ets
arkts
query
Query selfInfo. @param callback
query(callback: Function): void { let predicates = new relationalStore.RdbPredicates(Const.SELF_INFO.tableName ? Const.SELF_INFO.tableName : ''); console.info("SelfInfoTable type:" + Const.SELF_INFO.tableName ? Const.SELF_INFO.tableName : '') predicates.equalTo('id', 0); RdbUtils.query(predicates).the...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Function AST#identifier#Right AST#)#Left ) AST...
query(callback: Function): void { let predicates = new relationalStore.RdbPredicates(Const.SELF_INFO.tableName ? Const.SELF_INFO.tableName : ''); console.info("SelfInfoTable type:" + Const.SELF_INFO.tableName ? Const.SELF_INFO.tableName : '') predicates.equalTo('id', 0); RdbUtils.query(predicates).the...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
64d3135d7c429fa23a10c2317b8239d86eb54fca
github
PollenWang6/HiXD
entry/src/main/ets/services/DormWaterService.ets
arkts
sendSmsCode
===== 发送短信验证码 =====
async sendSmsCode(phone: string, imageCode: string): Promise<string> { const headers: Record<string, string> = {}; for (const key of Object.keys(COMMON_HEADERS)) { headers[key] = COMMON_HEADERS[key]; } headers['content-type'] = 'application/json'; headers['User-Agent'] = USER_AGENT; const body: s...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendSmsCode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left phone AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async sendSmsCode(phone: string, imageCode: string): Promise<string> { const headers: Record<string, string> = {}; for (const key of Object.keys(COMMON_HEADERS)) { headers[key] = COMMON_HEADERS[key]; } headers['content-type'] = 'application/json'; headers['User-Agent'] = USER_AGENT; const body: s...
https://github.com/PollenWang6/HiXD
dd0311dc60b3ceb0cda4025948d45d45c153fd7d
github
Countly/countly-sdk-hos
library/src/main/ets/internal/RequestQueue.ets
arkts
clear
Drop every queued request without sending. Used by `flushQueues()` so both the event queue and the request queue can be wiped in one shot. Started timed events (ModuleEvents.timed) are NOT affected per dev guide.
public async clear(): Promise<void> { // INFO + timestamp + size so a UCM revoke investigation can see // exactly when the wipe ran and how many entries it dropped. The // individual entries are NOT logged here (queues can hold hundreds // of entries, each up to 2KB+); the matching REQUEST ENQUEUED lo...
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 clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
public async clear(): Promise<void> { // INFO + timestamp + size so a UCM revoke investigation can see // exactly when the wipe ran and how many entries it dropped. The // individual entries are NOT logged here (queues can hold hundreds // of entries, each up to 2KB+); the matching REQUEST ENQUEUED lo...
https://github.com/Countly/countly-sdk-hos
2401ce91f0bf036024c96ee8702c41e56ca62078
github
the-wwyang/kids-learning-app
src/main/ets/storage/AppStorageManager.ets
arkts
getYesterdayString
获取昨天的日期字符串
private getYesterdayString(): string { const date = new Date(); date.setDate(date.getDate() - 1); const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${day}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getYesterdayString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left stri...
private getYesterdayString(): string { const date = new Date(); date.setDate(date.getDate() - 1); const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${day}`; }
https://github.com/the-wwyang/kids-learning-app
07849601cf5ceff96a037fe768026d9cb32def59
github
Zhiyilang074811/enterprise-ai-assistant
harmony_app/entry/src/main/ets/pages/Chat.ets
arkts
onRecommendedQuestion
点击推荐问题
onRecommendedQuestion(question: string): void { this.inputText = question; this.sendMessage(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRecommendedQuestion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left question AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left...
onRecommendedQuestion(question: string): void { this.inputText = question; this.sendMessage(); }
https://github.com/Zhiyilang074811/enterprise-ai-assistant
e6bc4d729a212fceaffcfc13f44a27dcdd6d1b52
github
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
drawCodewords
Draws the given sequence of 8-bit codewords (data and error correction) onto the entire data area of this QR Code. Function modules need to be marked off before this is called.
private drawCodewords(data: Array<byte>): void { if (data.length != Math.floor(QrCode.getNumRawDataModules(this.version) / 8)) throw new Error("Invalid argument"); let i: int = 0; // Bit index into the data // Do the funny zigzag scan for (let right = this.size - 1; right >= 1; right -...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawCodewords 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 drawCodewords(data: Array<byte>): void { if (data.length != Math.floor(QrCode.getNumRawDataModules(this.version) / 8)) throw new Error("Invalid argument"); let i: int = 0; // Bit index into the data // Do the funny zigzag scan for (let right = this.size - 1; right >= 1; right -...
https://gitee.com/openharmony-sig/qr-code-generator.git
c0be8a91b3d58e5664f039fefa35d7471de1ba97
gitee
xblLab/HarmonyProjectTemplate
components/module_feedback/src/main/ets/common/CommonUtils.ets
arkts
handleDateTime
格式化时间,2020.02.12 周三 12:00:00 @param dateTime
public static handleDateTime(dateTime: number) { const date = new Date(dateTime); const dateStr = `${date.getFullYear()}.${CommonUtils.padStart(date.getMonth() + 1)}.${CommonUtils.padStart(date.getDate())}`; const weekStr = CommonUtils.weekFormat.format(date); const timeStr = `${CommonUtil...
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 handleDateTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateTime AST#identifier#Right AST#ERROR#Left AST#:#Left...
public static handleDateTime(dateTime: number) { const date = new Date(dateTime); const dateStr = `${date.getFullYear()}.${CommonUtils.padStart(date.getMonth() + 1)}.${CommonUtils.padStart(date.getDate())}`; const weekStr = CommonUtils.weekFormat.format(date); const timeStr = `${CommonUtil...
https://github.com/xblLab/HarmonyProjectTemplate
c4a98a7481c2169fe622128fa7302cf71d1c9586
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WishlistStore.ets
arkts
markConfirmed
V0.3.9: idempotent Idle → Confirmed transition. The caller has already cleared the parent PIN and invoked `CoinAccount.redeem`, so this method does *not* touch coin balance — it only flips state and stamps the confirmation timestamp. Returns false when the wish is unknown or already non-Idle (so callers can skip the Gi...
markConfirmed(wishId: string, nowMs: number): boolean { const w: MagicWish | undefined = this.findWish(wishId); if (w === undefined) { return false; } if (w.state !== WishState.Idle) { return false; } w.state = WishState.Confirmed; w.confirmedAt = nowMs; this.scheduleSave()...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markConfirmed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wishId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,...
markConfirmed(wishId: string, nowMs: number): boolean { const w: MagicWish | undefined = this.findWish(wishId); if (w === undefined) { return false; } if (w.state !== WishState.Idle) { return false; } w.state = WishState.Confirmed; w.confirmedAt = nowMs; this.scheduleSave()...
https://github.com/terryma2024/happyword
bbcdda047fec2b4e1c30c3e1c34351bb5464c702
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
getAbsoluteURL
获取绝对URL
getAbsoluteURL(baseUrl: string, relativeUrl: string): string { if (!relativeUrl) return baseUrl || ''; if (relativeUrl.startsWith('http://') || relativeUrl.startsWith('https://')) { return relativeUrl; } if (relativeUrl.startsWith('//')) { return 'https:' + relativeUrl; } if (!base...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAbsoluteURL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,...
getAbsoluteURL(baseUrl: string, relativeUrl: string): string { if (!relativeUrl) return baseUrl || ''; if (relativeUrl.startsWith('http://') || relativeUrl.startsWith('https://')) { return relativeUrl; } if (relativeUrl.startsWith('//')) { return 'https:' + relativeUrl; } if (!base...
https://github.com/DaLongZhuaZi/manxia
30055d2f2e0c9f2725d624829940ee9b68e17643
github
openharmony/applications_app_samples
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewIndex.ets
arkts
decodeMsg
解析收到的消息数据
decodeMsg(): void { Logger.info(TAG, `decodeMsg aray buffer begin:${this.receiveMsg}`); if (this.receiveMsg === '' || this.receiveMsg === 'clear') { Logger.info(TAG, `decodeMsg receiveMsg null:${this.receiveMsg}`); return; } Logger.info(TAG, `decodeMsg aray buffer:${this.receiveMsg}`); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decodeMsg 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#Le...
decodeMsg(): void { Logger.info(TAG, `decodeMsg aray buffer begin:${this.receiveMsg}`); if (this.receiveMsg === '' || this.receiveMsg === 'clear') { Logger.info(TAG, `decodeMsg receiveMsg null:${this.receiveMsg}`); return; } Logger.info(TAG, `decodeMsg aray buffer:${this.receiveMsg}`); ...
https://github.com/openharmony/applications_app_samples
05cfd45b2edd1111a8bb7917246615625f4511b8
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
fill
Fills the BigInt64Array with specified value @param value new valuy @returns modified BigInt64Array
public fill(value: BigInt, start: number, end: number): BigInt64Array { return this.fill(value.getLong(), start as int, end 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: BigInt, start: number, end: number): BigInt64Array { return this.fill(value.getLong(), start as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1c8b4f65069d026d5a5b21fb114b23fa21e0097c
gitee
HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-ttsdemo
entry/src/main/ets/pages/Index.ets
arkts
onError
Error callback. This callback is triggered when an error occurs during playback. Error code 1002300007 is returned when the speak method is invoked when no engine is created, indicating that synthesis and playback fail. Invoke speak twice consecutively. If speak is invoked for the second time, the error code 1002300006...
onError(requestId: string, errorCode: number, errorMessage: string) { if (errorCode === 1002300007) { engineCreated = false } console.error(`onError, requestId: ${requestId} errorCode: ${errorCode} errorMessage: ${errorMessage}`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Le...
onError(requestId: string, errorCode: number, errorMessage: string) { if (errorCode === 1002300007) { engineCreated = false } console.error(`onError, requestId: ${requestId} errorCode: ${errorCode} errorMessage: ${errorMessage}`); }
https://gitcode.com/HarmonyOS_Samples/core-speech-kit-sample-code-ark-ts-kit-ttsdemo
806dca3362c9fed866e5ab957cce16f1a22293f6
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/NetworkBoostService.ets
arkts
addListener
UI / 自适应码率注册 QoS 监听
addListener(listener: SystemNetQosListener): void { this.listeners.add(listener); if (this.latestQos) { try { listener(this.latestQos); } catch (err) { console.warn(`[NetworkBoost] listener 异常: ${(err as Error).message}`); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SystemNetQosListener AST#identifier#Righ...
addListener(listener: SystemNetQosListener): void { this.listeners.add(listener); if (this.latestQos) { try { listener(this.latestQos); } catch (err) { console.warn(`[NetworkBoost] listener 异常: ${(err as Error).message}`); } } }
https://github.com/AlkaidLab/moonlight-harmony
fda744c8884cf2874bd4485be1a96e12def7f3db
github
arkui-x/samples
CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets
arkts
updateOrCreateParams
更新key为'content'的变量值 @param { SubWindowParams } params - 页面显示的值
updateOrCreateParams(params: SubWindowParams): void { this.Storage.setOrCreate("content", params.sum); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateOrCreateParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SubWindowParams AST#identifier#Ri...
updateOrCreateParams(params: SubWindowParams): void { this.Storage.setOrCreate("content", params.sum); }
https://gitcode.com/arkui-x/samples
fcba3b032836918be401034f0fdfedefeaa2fe7b
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
transformConfig
转换配置为类型化对象
private transformConfig(rawConfig: Record<string, Object>, warnings: string[]): MangaSourceConfig { const defaultSettings: DefaultSettings = { timeout: 30000, retryCount: 3, enableJavaScript: true, enableImages: true, enableCookies: true, bypassCloudflare: false, userAgen...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left transformConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left rawConfig AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
private transformConfig(rawConfig: Record<string, Object>, warnings: string[]): MangaSourceConfig { const defaultSettings: DefaultSettings = { timeout: 30000, retryCount: 3, enableJavaScript: true, enableImages: true, enableCookies: true, bypassCloudflare: false, userAgen...
https://github.com/DaLongZhuaZi/manxia
8bbc4f1c9a4345c4c47724107eed753711a20410
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test31_original_index.ets
arkts
testArrayDestructure
=== Round 31: Destructuring (manual), finally block, void operator, multi-level super calls, string padding, array from + fill, number parsing edge cases, conditional chaining with ternary, localeCompare === --- Manual array destructuring ---
function testArrayDestructure(): string { let arr: number[] = [10, 20, 30, 40, 50]; let first: number = arr[0]; let second: number = arr[1]; let third: number = arr[2]; return String(first + second + third); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayDestructure 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#predef...
function testArrayDestructure(): string { let arr: number[] = [10, 20, 30, 40, 50]; let first: number = arr[0]; let second: number = arr[1]; let third: number = arr[2]; return String(first + second + third); }
https://github.com/miaochiahao/ark-ghidra
5384dc14cd5512dd4ffdeffb976ddd6ae988730f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
setLevel
设置日志系统的输出级别 @param level - 您想显示的最低日志级别 @example // 在生产环境中,只显示警告和错误 Logger.setLevel(LogLevel.WARN);
public setLevel(level: LogLevel): void { this.currentLevel = level; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LogLev...
public setLevel(level: LogLevel): void { this.currentLevel = level; }
https://github.com/DaLongZhuaZi/manxia
aa4d7fc7f860a869e58fcb7618e84796667b46b8
github