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 |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | isSFWModeEnabled | 获取SFW模式状态 | public isSFWModeEnabled(): boolean {
return this.sfwModeEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSFWModeEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean ... | public isSFWModeEnabled(): boolean {
return this.sfwModeEnabled;
} | https://github.com/DaLongZhuaZi/manxia | 10defe5551e9dac58fa8739e8b7cde1704ecba55 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/NotificationService.ets | arkts | markAllAsRead | 标记所有通知已读 | async markAllAsRead(): Promise<boolean> {
try {
const response = await HttpUtil.post('/notifications/read-all', {
userId: this.currentUserId
});
if (response.success) {
this.notifications.forEach((notification: Notification) => {
notification.status = 'READ';
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left markAllAsRead AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi... | async markAllAsRead(): Promise<boolean> {
try {
const response = await HttpUtil.post('/notifications/read-all', {
userId: this.currentUserId
});
if (response.success) {
this.notifications.forEach((notification: Notification) => {
notification.status = 'READ';
... | https://github.com/LJ666-ui/harmony-health-care | 95327fad9b6e9b48c60bc3e0029125a2be260aba | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/TypeShelfManager.ets | arkts | moveItemToShelf | 将内容移动到书架 | async moveItemToShelf(itemId: string, contentType: ContentType, shelfId: string): Promise<void> {
// 检查书架是否存在且支持该内容类型
const shelf = this.getShelf(shelfId);
if (!shelf) {
logger.warn(TAG, `书架不存在: ${shelfId}`);
return;
}
// 检查内容类型是否匹配
const shelfContentType = this.contentTypeToS... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left moveItemToShelf AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left itemId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async moveItemToShelf(itemId: string, contentType: ContentType, shelfId: string): Promise<void> {
// 检查书架是否存在且支持该内容类型
const shelf = this.getShelf(shelfId);
if (!shelf) {
logger.warn(TAG, `书架不存在: ${shelfId}`);
return;
}
// 检查内容类型是否匹配
const shelfContentType = this.contentTypeToS... | https://github.com/DaLongZhuaZi/manxia | cbae44149ab5c890d5a50c9146a7d6d4b2b92efa | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets | arkts | onExecutionSucceeded | Register a callback and call it when the task successfully executed
@param { CallbackFunction } callback Callback to be registered and executed when the task successfully executed
@throws Error if task is executed. It does not support the registration of listeners | onExecutionSucceeded(callback: CallbackFunction): void {
this.throwIfCallbackCannotBeAdded();
InternalTask.of(this).onSuccessCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onExecutionSucceeded 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 CallbackFunction AST#identifier... | onExecutionSucceeded(callback: CallbackFunction): void {
this.throwIfCallbackCannotBeAdded();
InternalTask.of(this).onSuccessCallback = callback;
} | https://gitcode.com/iop123123/arkts-static-skills | fcadf0392f432fc2d5e425f004444fec110d243f | gitcode |
HarmonyOS_Samples/sample_in_harmonyos | products/pc/src/main/ets/uiextensionability/pages/Index.ets | arkts | setAnimeInterval | [End of aboutToAppear] | private setAnimeInterval(interval: number) {
if (this.fluffyAnimateIntervalId) {
return;
}
this.fluffyAnimateIntervalId = setInterval(() => {
this.switchFluffyToNextFrame()
}, interval);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setAnimeInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left interval AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | private setAnimeInterval(interval: number) {
if (this.fluffyAnimateIntervalId) {
return;
}
this.fluffyAnimateIntervalId = setInterval(() => {
this.switchFluffyToNextFrame()
}, interval);
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 32e56a3ab6ed5a31af692caba369550bebd3ab83 | gitcode |
Cool_foolisher1/ArkTSRepository | MultiCalculator/features/calculator/src/main/ets/utils/CalculateUtil.ets | arkts | numberToScientificNotation | 结果转换为科学符号 | numberToScientificNotation(result: number) {
if (result === Number.NEGATIVE_INFINITY || result === Number.POSITIVE_INFINITY) {
return 'NaN'
}
let resultStr = JSON.stringify(result)
if (this.containScientificNotation(resultStr)) {
return resultStr
}
let prefixNumber = (resultStr.ind... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left numberToScientificNotation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#i... | numberToScientificNotation(result: number) {
if (result === Number.NEGATIVE_INFINITY || result === Number.POSITIVE_INFINITY) {
return 'NaN'
}
let resultStr = JSON.stringify(result)
if (this.containScientificNotation(resultStr)) {
return resultStr
}
let prefixNumber = (resultStr.ind... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 1d2bd19d2d0a911d8caea0d8498eb4a9c1cd7c80 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | hotKey | 搜索热词
https://www.wanandroid.com//hotkey/json
@returns | public hotKey(): Promise<AxiosResponse<IWanCommonResponse<Array<IHotKey>>>> {
return this.getRequest("/hotkey/json")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hotKey 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_stat... | public hotKey(): Promise<AxiosResponse<IWanCommonResponse<Array<IHotKey>>>> {
return this.getRequest("/hotkey/json")
} | https://github.com/RedRackham-R/WanAndroidHarmoney | 5d3196a1b19726e9015ca8c1a1ace2ab55c6d6b4 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | mul | Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
digits using rounding mode `rounding`.
@param { Value } x {double | string | Decimal}
@param { Value } y {double | string | Decimal}
@returns { Decimal } the Decimal type | static mul(x: Value, y: Value): Decimal {
return new Decimal(x).mul(y);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static mul(x: Value, y: Value): Decimal {
return new Decimal(x).mul(y);
} | https://gitcode.com/iop123123/arkts-static-skills | 53675e80942a41229e5b5b588f6a36600bf8b04a | gitcode |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | getInstance | 新增:清空数据监听器
单例模式 | static getInstance(): ItemStore {
if (!ItemStore.instance) {
ItemStore.instance = new ItemStore();
}
return ItemStore.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ItemStore ... | static getInstance(): ItemStore {
if (!ItemStore.instance) {
ItemStore.instance = new ItemStore();
}
return ItemStore.instance;
} | https://gitcode.com/openharmony/codelabs | d7b3fce1f42e650a3ce15a169ee34084517394e9 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | set | Sets the float value wrapped in this FloatBox.
@param { float } value - The new float value to set
@returns { float } The newly set float value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public set(value: float): float {
return (this.value = value);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(value: float): float {
return (this.value = value);
} | https://gitcode.com/iop123123/arkts-static-skills | 4b7233a8582df26cac90a927bb08571719e18efe | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CacheConfigManager.ets | arkts | getMemoryCacheConfig | 获取内存缓存配置 | public getMemoryCacheConfig(): MemoryCacheConfig {
const result: MemoryCacheConfig = {
maxCount: this.config.memoryCache.maxCount,
maxSize: this.config.memoryCache.maxSize,
enabled: this.config.memoryCache.enabled
};
return result;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMemoryCacheConfig 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 M... | public getMemoryCacheConfig(): MemoryCacheConfig {
const result: MemoryCacheConfig = {
maxCount: this.config.memoryCache.maxCount,
maxSize: this.config.memoryCache.maxSize,
enabled: this.config.memoryCache.enabled
};
return result;
} | https://github.com/DaLongZhuaZi/manxia | e2cdb0473ca6ae2c4c0cd79e890392def93ccf52 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineDataSet.ets | arkts | setFillFormatter | Sets a custom IFillFormatter to the chart that handles the position of the
filled-line for each DataSet. Set this to null to use the default logic.
@param formatter | public setFillFormatter(formatter: IFillFormatter): void {
if (!formatter) {
this.mFillFormatter = new DefaultFillFormatter();
} else {
this.mFillFormatter = formatter;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFillFormatter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formatter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public setFillFormatter(formatter: IFillFormatter): void {
if (!formatter) {
this.mFillFormatter = new DefaultFillFormatter();
} else {
this.mFillFormatter = formatter;
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f79bd00d06ddf4f9f60f7e776ff04761681b6eb8 | gitee |
LZZLHY/hlib | entry/src/main/ets/utils/AppRouter.ets | arkts | clear | 清空整个栈,常用于退登。 | static clear(): void {
const s: NavPathStack | null = AppRouter.stack;
if (s === null) {
return;
}
try {
s.clear();
} catch (e) {
Logger.w(TAG, `clear failed: ${(e as Error).message}`);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear 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... | static clear(): void {
const s: NavPathStack | null = AppRouter.stack;
if (s === null) {
return;
}
try {
s.clear();
} catch (e) {
Logger.w(TAG, `clear failed: ${(e as Error).message}`);
}
} | https://github.com/LZZLHY/hlib | 589c3f55a6df502c4e96e8025b7daea066bf2b9d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets | arkts | getLoginUrl | 获取登录URL | public getLoginUrl(): string {
if (!ANILIST_CLIENT_ID) {
this.logError('AniList Client ID 未配置');
return '';
}
const params = new Map<string, string>();
params.set('client_id', ANILIST_CLIENT_ID);
params.set('response_type', 'code');
const queryString = Array.from(params.e... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLoginUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public getLoginUrl(): string {
if (!ANILIST_CLIENT_ID) {
this.logError('AniList Client ID 未配置');
return '';
}
const params = new Map<string, string>();
params.set('client_id', ANILIST_CLIENT_ID);
params.set('response_type', 'code');
const queryString = Array.from(params.e... | https://github.com/DaLongZhuaZi/manxia | 5a79a369b3ab642ca38ce15871c9e9ff9739413d | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | getStatistics | 获取账单统计信息 | static async getStatistics(ledgerId: number): Promise<SharedBillStatistics> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
COUNT(*) as total_bills,
SUM(CASE WHEN approval_status = 'approved' THEN amount ELSE 0 END) as total_approved_amount,
... | 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 getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left :... | static async getStatistics(ledgerId: number): Promise<SharedBillStatistics> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT
COUNT(*) as total_bills,
SUM(CASE WHEN approval_status = 'approved' THEN amount ELSE 0 END) as total_approved_amount,
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6b3b155726faee3f236d2a40adf784124a47646c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/base/BaseChart.ets | arkts | setConfig | 更新配置
@param newConfig 部分新配置 | public setConfig(newConfig: Partial<BaseChartConfig>): void {
this.config = { ...this.config, ...newConfig };
this.notifyConfigChange();
this.refresh();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left newConfig AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST... | public setConfig(newConfig: Partial<BaseChartConfig>): void {
this.config = { ...this.config, ...newConfig };
this.notifyConfigChange();
this.refresh();
} | https://github.com/LJ666-ui/harmony-health-care | 8a703a5c3620602354021ec0ad9aa9c617d6ec6a | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/LayoutConfigManager.ets | arkts | buildDefaultLandscapeLayout | 生成默认横屏布局
对齐 Android buildDefaultLandscapeLayout:
- 上屏 66% 宽度,下屏 34% 宽度
- L/R 在顶部两角,动作按钮居中顶部
- DPad/ABXY 在底部两角,SELECT/START 底部居中 | buildDefaultLandscapeLayout(width: number, height: number): PositionedLayoutComponent[] {
const large = 140;
const lr = 50;
const small = 40;
const sp = 4;
let topScreenW = Math.round(width * 0.66);
let topScreenH = Math.round(topScreenW / NDS_ASPECT);
if (topScreenH > height) {
top... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildDefaultLandscapeLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#i... | buildDefaultLandscapeLayout(width: number, height: number): PositionedLayoutComponent[] {
const large = 140;
const lr = 50;
const small = 40;
const sp = 4;
let topScreenW = Math.round(width * 0.66);
let topScreenH = Math.round(topScreenW / NDS_ASPECT);
if (topScreenH > height) {
top... | https://github.com/richshaw2015/nds | 5ba3dc81525b8ddf1edb0fc099b4f28eb858becf | github |
HarmonyOS_Samples/MultiPictureBeautification | multipicturecommon/src/main/ets/utils/WindowUtil.ets | arkts | removeWindowSizeMonitor | Unregister window size change listener | removeWindowSizeMonitor(addFunction: (windowSize: window.Size) => void): void {
if (!this.mainWindow) {
return;
}
try {
this.mainWindow.off('windowSizeChange', addFunction);
} catch (err) {
Logger.error(LogConstants.LOG_TAG_WINDOW_UTIL, 'Failed to remove window size monitor. Cause: %... | AST#program#Left AST#ERROR#Left AST#identifier#Left removeWindowSizeMonitor AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Le... | removeWindowSizeMonitor(addFunction: (windowSize: window.Size) => void): void {
if (!this.mainWindow) {
return;
}
try {
this.mainWindow.off('windowSizeChange', addFunction);
} catch (err) {
Logger.error(LogConstants.LOG_TAG_WINDOW_UTIL, 'Failed to remove window size monitor. Cause: %... | https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification | 5e39d927514fbdb50582f3e7c2196e4669368d71 | gitcode |
azhu0001/localsend-harmony | serve/src/main/ets/http/ContentType.ets | arkts | constructor | @param contentTypeHeader 请求体的Content-type | constructor(contentTypeHeader: string) {
this.contentTypeHeader = contentTypeHeader;
const isContentType = Boolean(contentTypeHeader);
this.contentType = isContentType ? this.getDetailFromContentHeader(contentTypeHeader,
this.contentRegex, '', NUM_ONE) : '';
let encodingString = this.getDetailFr... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentTypeHeader AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Ri... | constructor(contentTypeHeader: string) {
this.contentTypeHeader = contentTypeHeader;
const isContentType = Boolean(contentTypeHeader);
this.contentType = isContentType ? this.getDetailFromContentHeader(contentTypeHeader,
this.contentRegex, '', NUM_ONE) : '';
let encodingString = this.getDetailFr... | https://gitcode.com/azhu0001/localsend-harmony | 64f2bb367d430b9d2328193d118cdf2de8a1715a | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationManager.ets | arkts | replace | 替换当前页面
@param url 目标页面路径
@returns Promise<void> | public async replace(url: string): Promise<void> {
const startTime = Date.now();
try {
// 验证路由路径
if (!this.validateRoute(url)) {
throw NavigationErrorHandler.createRouteNotFoundError(url);
}
this.logNavigation('REPLACE', url);
// 使用 router.replaceUrl() 替换当前页面
awa... | 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 replace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Righ... | public async replace(url: string): Promise<void> {
const startTime = Date.now();
try {
// 验证路由路径
if (!this.validateRoute(url)) {
throw NavigationErrorHandler.createRouteNotFoundError(url);
}
this.logNavigation('REPLACE', url);
// 使用 router.replaceUrl() 替换当前页面
awa... | https://github.com/LJ666-ui/harmony-health-care | 6938ad3454a8ff991c0c7786c94ebb95d8239318 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | isInteger | Checks if float is similar to an integer value
@param v the float to test
@returns true if the argument is similar to an integer value | public static isInteger(v: float): boolean {
// In the language % works as C fmod that differs with IEEE-754 % definition
return Float.compare(v % 1.0f, 0.0f);
} | 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 isInteger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Rig... | public static isInteger(v: float): boolean {
// In the language % works as C fmod that differs with IEEE-754 % definition
return Float.compare(v % 1.0f, 0.0f);
} | https://gitcode.com/iop123123/arkts-static-skills | a41f277d79c87b8568c472dda2233bf95f7ad04e | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | encryptAes | aes 加密
本例演示的 ecb 模式,cbc 模式和 gcm 模式请参见文档 | public static encryptAes(plainData: Uint8Array, keyData: Uint8Array): Uint8Array {
let plainBlob: cryptoFramework.DataBlob = { data: plainData };
let symKey = CryptoHelper.getAes128SymKey(keyData)
let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7');
cipher.initSync(cryptoFramework.CryptoMod... | 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 encryptAes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left plainData AST#identifier#Right AST#:#Left : ... | public static encryptAes(plainData: Uint8Array, keyData: Uint8Array): Uint8Array {
let plainBlob: cryptoFramework.DataBlob = { data: plainData };
let symKey = CryptoHelper.getAes128SymKey(keyData)
let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7');
cipher.initSync(cryptoFramework.CryptoMod... | https://github.com/webabcd/HarmonyDemo | 5f3b2ea1e31597feb2c8c7aa4e4f2ef2a19606d5 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/AccessibilityUtils.ets | arkts | blendColors | 混合两个颜色
@param color1 颜色1
@param color2 颜色2
@param weight 权重(0-1,0为color1,1为color2)
@returns 混合后的颜色 | public static blendColors(color1: string, color2: string, weight: number): string {
const rgb1 = this.parseColor(color1);
const rgb2 = this.parseColor(color2);
const r = Math.round(rgb1.r * (1 - weight) + rgb2.r * weight);
const g = Math.round(rgb1.g * (1 - weight) + rgb2.g * weight);
const b... | 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 blendColors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color1 AST#identifier#Right AST#:#Left : AS... | public static blendColors(color1: string, color2: string, weight: number): string {
const rgb1 = this.parseColor(color1);
const rgb2 = this.parseColor(color2);
const r = Math.round(rgb1.r * (1 - weight) + rgb2.r * weight);
const g = Math.round(rgb1.g * (1 - weight) + rgb2.g * weight);
const b... | https://github.com/LJ666-ui/harmony-health-care | 8d029cbe6ec3b985d187e8d9581e07e73dc5665b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getRegexListWithSplitRules | 使用分割规则获取正则字符串列表 | private getRegexListWithSplitRules(rules: string[], splitType: string): string[] {
const allResults: string[][] = [];
for (const rule of rules) {
const results = this.getStringListByRegexSingle(rule);
if (results.length > 0) {
allResults.push(results);
if (splitType === '||') ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getRegexListWithSplitRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rules AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#s... | private getRegexListWithSplitRules(rules: string[], splitType: string): string[] {
const allResults: string[][] = [];
for (const rule of rules) {
const results = this.getStringListByRegexSingle(rule);
if (results.length > 0) {
allResults.push(results);
if (splitType === '||') ... | https://github.com/DaLongZhuaZi/manxia | 9f79c4d8c3584ce9b987c2c25b890bd636d6b41f | github |
openharmony/applications_mms | entry/src/main/ets/service/ContractService.ets | arkts | dealContractParams | Process contact parameters
@param contactObjects | dealContractParams(contactObjects): LooseObject {
let contractParams: LooseObject = {};
if (contactObjects && contactObjects != common.string.EMPTY_STR) {
let params: Array<LooseObject> = [];
try {
params = JSON.parse(contactObjects);
} catch (Erro... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dealContractParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contactObjects AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ide... | dealContractParams(contactObjects): LooseObject {
let contractParams: LooseObject = {};
if (contactObjects && contactObjects != common.string.EMPTY_STR) {
let params: Array<LooseObject> = [];
try {
params = JSON.parse(contactObjects);
} catch (Erro... | https://gitee.com/openharmony/applications_mms.git | 38ad5658b085d42271afe5ebbdf5d8078cdde42c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | saveImageToLocal | ==================== 文件操作 ====================
保存图片到本地 | public async saveImageToLocal(imageUrl: string, fileName: string, directory: 'covers' | 'chapters'): Promise<string> {
try {
// 使用图片缓存管理器加载图片
const pixelMap = await this.imageCacheManager.loadImage(imageUrl);
if (!pixelMap) {
throw new Error('加载图片失败');
}
// 生成本地文件路径
c... | 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 saveImageToLocal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left imageUrl AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async saveImageToLocal(imageUrl: string, fileName: string, directory: 'covers' | 'chapters'): Promise<string> {
try {
// 使用图片缓存管理器加载图片
const pixelMap = await this.imageCacheManager.loadImage(imageUrl);
if (!pixelMap) {
throw new Error('加载图片失败');
}
// 生成本地文件路径
c... | https://github.com/DaLongZhuaZi/manxia | cddd0ae0e90d6149ca1bca8a2317fd80bf799fb5 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/HistoryViewModel.ets | arkts | addIllustHistory | 添加插画浏览记录 | async addIllustHistory(pid: string, title: string, coverUrl: string) {
try {
const item = new IllustHistoryInfo(pid, title);
item.coverUrl = coverUrl;
item.accessTime = Date.now(); // 更新为当前访问时间
await this.getIllustDB().addHistory(item);
} catch (e) {
logger.error('addIllustHistor... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addIllustHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pid AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async addIllustHistory(pid: string, title: string, coverUrl: string) {
try {
const item = new IllustHistoryInfo(pid, title);
item.coverUrl = coverUrl;
item.accessTime = Date.now(); // 更新为当前访问时间
await this.getIllustDB().addHistory(item);
} catch (e) {
logger.error('addIllustHistor... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/HistoryViewModel.ets#L68-L77 | 6a571f93ea9bad4c0ba72085ba5a1d3da0fad36f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/DeviceSensorService.ets | arkts | getLastAccelValues | 获取最后一次加速度计数据(用于测试/调试UI展示) | getLastAccelValues(): number[] {
return [...this.lastAccelValues];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastAccelValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERRO... | getLastAccelValues(): number[] {
return [...this.lastAccelValues];
} | https://github.com/AlkaidLab/moonlight-harmony | 10812753de1a36ac39daf164c498f19ecee5700d | github |
wuba/omni-ui | omni_component/src/main/ets/components/filterbar/util/OmniFilterUtil.ets | arkts | getCurrentListIndex | / 确定当前 Item 在第几层级 | static getCurrentListIndex(currentItem: OmniFilterItemBean): number {
let listIndex = -1;
if (currentItem != null) {
listIndex = 0;
let parent = currentItem.parent;
while (parent != null) {
listIndex++;
parent = parent.parent;
}
}
return listIndex;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentListIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left currentItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | static getCurrentListIndex(currentItem: OmniFilterItemBean): number {
let listIndex = -1;
if (currentItem != null) {
listIndex = 0;
let parent = currentItem.parent;
while (parent != null) {
listIndex++;
parent = parent.parent;
}
}
return listIndex;
} | https://github.com/wuba/omni-ui | dc7ef23d05266db8e8ec15f0159e0f9765843fa5 | github |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/view/home/TaskCardComponent.ets | arkts | aboutToAppear | 实例化之后 build之前 | aboutToAppear() {
this.taskInfo = JSON.parse(this.taskInfoStr);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.taskInfo = JSON.parse(this.taskInfoStr);
} | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | c4ae05fbaffbbdf591e6230f425e2f1523a0343e | github |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getNetworkSelectionMode | 获取当前选网模式。使用Promise异步回调。
@param slotId 卡槽ID,如果不指定slotId,默认主卡。
@returns | static async getNetworkSelectionMode(slotId?: number): Promise<radio.NetworkSelectionMode> {
slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号
return radio.getNetworkSelectionMode(slotId);
} | 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 getNetworkSelectionMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#... | static async getNetworkSelectionMode(slotId?: number): Promise<radio.NetworkSelectionMode> {
slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号
return radio.getNetworkSelectionMode(slotId);
} | https://github.com/tdcare/tdwebrtc | fe9d82f3b8e10f436afda0c114efd61883e27514 | github |
picklerick422/zju-learning-assistant-OH | entry/src/main/ets/services/FileService.ets | arkts | copyText | 复制文本到剪贴板(“复制路径”兜底,必定可用)。 | static copyText(text: string): void {
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
pasteboard.getSystemPasteboard().setData(data);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left copyText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ... | static copyText(text: string): void {
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text);
pasteboard.getSystemPasteboard().setData(data);
} | https://github.com/picklerick422/zju-learning-assistant-OH | e3bebd13a225d06208f0349123b062e4e2fcb5c0 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/LibFreeRDP.ets | arkts | initCallbacks | Initialize native callbacks | function initCallbacks(nativeModule: FreerdpNative): void {
nativeModule.setOnConnectionSuccess((instance: number) => {
console.info(`[LibFreeRDP] OnConnectionSuccess: instance=${instance}`);
instanceState.set(instance, true);
if (eventListener) {
eventListener.OnConnectionSuccess(instance);
}
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left initCallbacks AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nativeModule AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | function initCallbacks(nativeModule: FreerdpNative): void {
nativeModule.setOnConnectionSuccess((instance: number) => {
console.info(`[LibFreeRDP] OnConnectionSuccess: instance=${instance}`);
instanceState.set(instance, true);
if (eventListener) {
eventListener.OnConnectionSuccess(instance);
}
... | https://github.com/tangwengang-del/freerdp-harmonyos | dde8cf84a330500933fcbaba8e089cd3381235e9 | github |
Tianpei-Shi/MusicDash | src/services/UserService.ets | arkts | getUserPlayHistory | 获取用户播放历史
@param userId 用户ID | async getUserPlayHistory(userId: number): Promise<PlayHistory[]> {
try {
const historyData = await this.cloudDBService.getUserPlayHistory(userId);
return historyData.map(data => PlayHistory.fromCloudObject(data));
} catch (error) {
console.error('获取播放历史失败:', error);
return [];
}
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserPlayHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async getUserPlayHistory(userId: number): Promise<PlayHistory[]> {
try {
const historyData = await this.cloudDBService.getUserPlayHistory(userId);
return historyData.map(data => PlayHistory.fromCloudObject(data));
} catch (error) {
console.error('获取播放历史失败:', error);
return [];
}
... | https://github.com/Tianpei-Shi/MusicDash | 8c844f690b1e04b400ddbea70835cb9b2421fd53 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | getPositionRect | ==================== Position Coordinate Query ==================== | getPositionRect(line: number, column: number): CursorRect {
const arr = native.editorGetPositionRect(this.handle, line, column);
return { x: arr[0], y: arr[1], height: arr[2] };
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPositionRect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left ,... | getPositionRect(line: number, column: number): CursorRect {
const arr = native.editorGetPositionRect(this.handle, line, column);
return { x: arr[0], y: arr[1], height: arr[2] };
} | https://github.com/FinalScave/SweetEditor | a95630f8b0fd68736f627f973fc164e58ad3fb16 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/ToolRegistry.ets | arkts | getToolDefinition | 获取工具定义(用于 API 请求) | getToolDefinition(toolId: string): ToolDefinition | undefined {
const tool = this.tools.get(toolId)
if (tool !== undefined) {
return tool.definition
}
return undefined
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getToolDefinition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toolId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | getToolDefinition(toolId: string): ToolDefinition | undefined {
const tool = this.tools.get(toolId)
if (tool !== undefined) {
return tool.definition
}
return undefined
} | https://github.com/LongLiveY96/chatcube | 12bce4de7ca1714c6e2e6f3723c39ae5cf82916b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets | arkts | parseHtmlListing | 解析HTML目录列表 | private parseHtmlListing(html: string, basePath: string): WebDAVFile[] {
const files: WebDAVFile[] = [];
const linkRegex = /<a\s+href="([^"]+)"[^>]*>([^<]*)<\/a>/gi;
let match: RegExpExecArray | null;
while ((match = linkRegex.exec(html)) !== null) {
const href = match[1];
const ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseHtmlListing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private parseHtmlListing(html: string, basePath: string): WebDAVFile[] {
const files: WebDAVFile[] = [];
const linkRegex = /<a\s+href="([^"]+)"[^>]*>([^<]*)<\/a>/gi;
let match: RegExpExecArray | null;
while ((match = linkRegex.exec(html)) !== null) {
const href = match[1];
const ... | https://github.com/DaLongZhuaZi/manxia | 777e616313041ddb02f4f4f3774715c0ecce904d | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | fromHeight | Creates a Size with infinite width | static fromHeight(height: number): Size {
return new Size(Infinity, height);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left height AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static fromHeight(height: number): Size {
return new Size(Infinity, height);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L188-L190 | b950fd03df1bcef447cd75909e9c877f8f26041c | github |
Joker-x-dev/HarmonyKit | core/data/src/main/ets/repository/DemoRepository.ets | arkts | getById | 根据主键查询单条 Demo 记录
@param {number} id - 记录主键
@returns {Promise<DemoEntity | undefined>} 匹配到的记录或 undefined | async getById(id: number): Promise<DemoEntity | undefined> {
return this.demoLocalDataSource.getItemById(id);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | async getById(id: number): Promise<DemoEntity | undefined> {
return this.demoLocalDataSource.getItemById(id);
} | https://github.com/Joker-x-dev/HarmonyKit | 26dc23508da5b6946ba9dd2e68a28d35ed8e28de | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setUseAutoScaleMaxRestriction | Sets autoscale restriction for axis max value as enabled/disabled
@Deprecated | public setUseAutoScaleMaxRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMax = isEnabled;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUseAutoScaleMaxRestriction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isEnabled AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left ... | public setUseAutoScaleMaxRestriction(isEnabled: boolean): void {
this.mUseAutoScaleRestrictionMax = isEnabled;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | bc34855bc3d31c7eb66bd35312cc80fb5013a3ce | gitee |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | buildRenderModel | ==================== Rendering ==================== | buildRenderModel(): EditorRenderModel {
const payload = native.buildEditorRenderModel(this.handle);
return CoreProtocol.decodeEditorRenderModel(payload);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildRenderModel 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 EditorRenderModel AST#identifier#Right AST#ER... | buildRenderModel(): EditorRenderModel {
const payload = native.buildEditorRenderModel(this.handle);
return CoreProtocol.decodeEditorRenderModel(payload);
} | https://github.com/FinalScave/SweetEditor | 9922709d847e77d67a71bece9e30b849fb6e8dea | github |
openharmony/applications_contacts | feature/call/src/main/ets/missedcall/MissedCallService.ets | arkts | updateAllMissedCallNotifications | updateAllMissedCallNotifications | public async updateAllMissedCallNotifications() {
HiLog.i(TAG, 'updateMissedCallNotifications');
MissedCallNotifier.getInstance().cancelAllNotification();
this.sendMissedCallNotify();
} | 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 updateAllMissedCallNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expr... | public async updateAllMissedCallNotifications() {
HiLog.i(TAG, 'updateMissedCallNotifications');
MissedCallNotifier.getInstance().cancelAllNotification();
this.sendMissedCallNotify();
} | https://gitee.com/openharmony/applications_contacts.git | aad20972d0b49ce4c4dac98625c33181a9761eaf | gitee |
EmptyEmeraldTablet/AIChatDemo-HarmonyOSNext | entry/src/main/ets/pages/Index.ets | arkts | changeScrollHeight | 改变输入框的Scroll容器的高度 | changeScrollHeight() {
console.log('zxxcxf--', this.TextAreaController.getTextContentLineCount())
let line = this.TextAreaController.getTextContentLineCount()
if (line === 0 || line == 1) {
this.scrollHeight = 50
return
}
if (line > 4) {
this.scrollHeight = 100
} else {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeScrollHeight 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... | changeScrollHeight() {
console.log('zxxcxf--', this.TextAreaController.getTextContentLineCount())
let line = this.TextAreaController.getTextContentLineCount()
if (line === 0 || line == 1) {
this.scrollHeight = 50
return
}
if (line > 4) {
this.scrollHeight = 100
} else {
... | https://github.com/EmptyEmeraldTablet/AIChatDemo-HarmonyOSNext | 77fd7006c779eb090bc506110df1a967fb7a499a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets | arkts | getGuideConfig | 获取引导配置 | public getGuideConfig(): GuideConfig {
return {
currentStep: this.currentStep,
completed: this.guideCompleted,
skipped: this.guideSkipped,
lastShowTime: Date.now()
};
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGuideConfig 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 GuideCo... | public getGuideConfig(): GuideConfig {
return {
currentStep: this.currentStep,
completed: this.guideCompleted,
skipped: this.guideSkipped,
lastShowTime: Date.now()
};
} | https://github.com/DaLongZhuaZi/manxia | 51bae8c67e68980a03137ade37596e7d888a6141 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | whereLike | 添加 LIKE 条件
@param column 列名或属性名
@param pattern 匹配模式
@returns 当前实例(支持链式调用) | whereLike(column: string, pattern: string): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.like(resolvedColumn, patte... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereLike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | whereLike(column: string, pattern: string): QueryBuilder {
const resolvedColumn = this.getResolvedColumnName(column)
if (resolvedColumn === null) {
throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`)
}
const condition = WhereCondition.like(resolvedColumn, patte... | https://github.com/offlinecat-dev/OCNetORM | 65d0ef52161866efa9011ae84559cf7db72d2731 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoSourceParser.ets | arkts | parseBookInfoRule | 解析书籍详情规则 | private parseBookInfoRule(obj: ESObject): LegadoBookInfoRule | undefined {
if (!obj) {
return undefined;
}
return {
init: obj.init ? String(obj.init) : undefined,
name: obj.name ? String(obj.name) : undefined,
author: obj.author ? String(obj.author) : undefined,
intro: obj.i... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseBookInfoRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private parseBookInfoRule(obj: ESObject): LegadoBookInfoRule | undefined {
if (!obj) {
return undefined;
}
return {
init: obj.init ? String(obj.init) : undefined,
name: obj.name ? String(obj.name) : undefined,
author: obj.author ? String(obj.author) : undefined,
intro: obj.i... | https://github.com/DaLongZhuaZi/manxia | ecc82662a25cb3cba876e2360af5a7c10671c9e0 | github |
openharmony/codelabs | Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets | arkts | switchPlayOrPause | Switching Between Video Play and Pause. | switchPlayOrPause() {
if (this.avPlayer === null) {
return;
}
if (this.status === CommonConstants.STATUS_START) {
this.avPlayer.pause();
} else {
this.avPlayer.play();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switchPlayOrPause 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#... | switchPlayOrPause() {
if (this.avPlayer === null) {
return;
}
if (this.status === CommonConstants.STATUS_START) {
this.avPlayer.pause();
} else {
this.avPlayer.play();
}
} | https://gitee.com/openharmony/codelabs.git | 7e36f4f812fa58925554bb9bfd84bc2f66b3078a | gitee |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/services/MusicImportService.ets | arkts | importFromPicker | 对外唯一入口:从系统文件选择器导入音乐 | static async importFromPicker(
context: common.UIAbilityContext,
globalMusic: GlobalMusic
): Promise<void> {
try {
const audioPicker = new picker.AudioViewPicker()
// 允许选择多个音频文件
const uris = await audioPicker.select(new picker.AudioSelectOptions())
if (!uris || uris.length === 0... | 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 importFromPicker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left... | static async importFromPicker(
context: common.UIAbilityContext,
globalMusic: GlobalMusic
): Promise<void> {
try {
const audioPicker = new picker.AudioViewPicker()
// 允许选择多个音频文件
const uris = await audioPicker.select(new picker.AudioSelectOptions())
if (!uris || uris.length === 0... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/services/MusicImportService.ets#L21-L75 | ec63bd4b3c7ea21b97a491f09e7062f3af761451 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildSearchByTagActions | 构建标签/分类搜索操作序列
@param config 图源配置
@param tagId 标签ID或标签名称
@returns 操作序列,如果工作流不存在则返回空数组 | buildSearchByTagActions(config: MangaSourceConfig, tagId: string): Action[] {
const workflow = this.getWorkflow(config, 'searchByTag');
if (!workflow) {
logger.info(TAG, 'searchByTag工作流不存在,返回空数组');
return [];
}
return this.processActions(workflow, { tagId } as Partial<WorkflowContext>);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildSearchByTagActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConf... | buildSearchByTagActions(config: MangaSourceConfig, tagId: string): Action[] {
const workflow = this.getWorkflow(config, 'searchByTag');
if (!workflow) {
logger.info(TAG, 'searchByTag工作流不存在,返回空数组');
return [];
}
return this.processActions(workflow, { tagId } as Partial<WorkflowContext>);
... | https://github.com/DaLongZhuaZi/manxia | 262da6a9806b09ff444e1760be9ae30050bd7c93 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/StatisticsDAO.ets | arkts | bulkInsertCategory | 批量插入分类统计 - 使用 DAOHelper 统一事务处理 | static async bulkInsertCategory(stats: CategoryStatistics[]) {
await DAOHelper.transaction(async () => {
for (const s of stats) await StatisticsDAO.insertCategory(s);
}, '[StatisticsDAO] 批量插入分类统计');
} | 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 bulkInsertCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stats AST#identifier#Right AST#:#Left... | static async bulkInsertCategory(stats: CategoryStatistics[]) {
await DAOHelper.transaction(async () => {
for (const s of stats) await StatisticsDAO.insertCategory(s);
}, '[StatisticsDAO] 批量插入分类统计');
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | dedf784f6aa5c29fd7c084da4445e8d17ddddd0b | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/download/FileValidator.ets | arkts | validateSync | 校验文件首字节是否匹配预期格式。
同步方法,便于在 requestInStream callback 中直接使用。 | static validateSync(path: string, ext: string, bytesWritten: number): boolean {
if (bytesWritten < 100) {
return false; // 任何正常书文件不会小于 100 字节
}
try {
const file: fileIo.File = fileIo.openSync(path, fileIo.OpenMode.READ_ONLY);
try {
const buf: ArrayBuffer = new ArrayBuffer(16);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | static validateSync(path: string, ext: string, bytesWritten: number): boolean {
if (bytesWritten < 100) {
return false; // 任何正常书文件不会小于 100 字节
}
try {
const file: fileIo.File = fileIo.openSync(path, fileIo.OpenMode.READ_ONLY);
try {
const buf: ArrayBuffer = new ArrayBuffer(16);
... | https://github.com/LZZLHY/hlib | a76c148f138874166db0bdf8843eb3c7cca3803f | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/AnimationUtil.ets | arkts | animNormalApp | 普通动画参数,根据软件选择参数 | public animNormalApp(time: number, d: number, curve?: string | Curve | ICurve) {
const animationUtils: AnimateParam = {
duration: time,
curve: curve, // Curve.EaseOut,
iterations: 1,
playMode: PlayMode.Normal,
delay:d
}
return animationUtils
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animNormalApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public animNormalApp(time: number, d: number, curve?: string | Curve | ICurve) {
const animationUtils: AnimateParam = {
duration: time,
curve: curve, // Curve.EaseOut,
iterations: 1,
playMode: PlayMode.Normal,
delay:d
}
return animationUtils
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/AnimationUtil.ets#L34-L43 | 499e16868ef7e96556548e35d08942ddeafa56fd | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets | arkts | isEmpty | Checks if the LightWeightSet is empty
@returns true if the LightWeightSet is empty, false otherwise | isEmpty(): boolean {
return this.buckets.isEmpty();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b... | isEmpty(): boolean {
return this.buckets.isEmpty();
} | https://gitcode.com/iop123123/arkts-static-skills | 26e298c0cc62ce86d1f2d5bef773152b067c3ad6 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsBackupService.ets | arkts | readFileText | 读取文本文件内容,失败返回 undefined | private static readFileText(path: string): string | undefined {
try {
if (!fileIo.accessSync(path)) return undefined;
const file = fileIo.openSync(path, fileIo.OpenMode.READ_ONLY);
const stat = fileIo.statSync(path);
const buf = new ArrayBuffer(stat.size);
fileIo.readSync(file.fd, bu... | 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 readFileText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : ... | private static readFileText(path: string): string | undefined {
try {
if (!fileIo.accessSync(path)) return undefined;
const file = fileIo.openSync(path, fileIo.OpenMode.READ_ONLY);
const stat = fileIo.statSync(path);
const buf = new ArrayBuffer(stat.size);
fileIo.readSync(file.fd, bu... | https://github.com/AlkaidLab/moonlight-harmony | 7a27f5b2e5bc4d3fe2bf6e304f1d4febfa9c6ba0 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | setGranularity | Set a minimum interval for the axis when zooming in. The axis is not allowed to go below
that limit. This can be used to avoid label duplicating when zooming in.
@param granularity | public setGranularity(granularity: number): void {
this.mGranularity = granularity;
// set this to true if it was disabled, as it makes no sense to call this method with granularity disabled
this.mGranularityEnabled = true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setGranularity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left granularity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | public setGranularity(granularity: number): void {
this.mGranularity = granularity;
// set this to true if it was disabled, as it makes no sense to call this method with granularity disabled
this.mGranularityEnabled = true;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 0a5195f2c4cab11b02ecd47e85fae77ccf4ddc1e | gitee |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/services/EventHubManager.ets | arkts | emitStorageWarning | 发送存储空间警告信号(简化版) | public emitStorageWarning(freePercentage: number): void {
if (EventHubManager.ctx) {
EventHubManager.ctx.eventHub.emit(EventHubManager.EVENT_LOW_STORAGE, freePercentage);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left emitStorageWarning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left freePercentage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ... | public emitStorageWarning(freePercentage: number): void {
if (EventHubManager.ctx) {
EventHubManager.ctx.eventHub.emit(EventHubManager.EVENT_LOW_STORAGE, freePercentage);
}
} | https://gitcode.com/openharmony/codelabs | 875d43533588e01f233a11cab5183347b160b5b6 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | getHorizontalAlignment | returns the horizontal alignment of the legend
@return | public getHorizontalAlignment(): LegendHorizontalAlignment {
return this.mHorizontalAlignment;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHorizontalAlignment 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... | public getHorizontalAlignment(): LegendHorizontalAlignment {
return this.mHorizontalAlignment;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 183f6b6502060b4b18e820f06ab0649248e6e5c2 | gitee |
erosTeam/NextE | feature/reader/src/main/ets/viewmodel/ReaderViewModel.ets | arkts | ensureLoaded | Ensure image-page links are loaded through `index`. The near case (sequential reading) extends one
preview page at a time; a FAR target (slider drop / resumed deep page) fetches every missing preview
page CONCURRENTLY once perPage is known, so a far jump pipelines its GETs instead of waiting for each
round-trip in turn... | private async ensureLoaded(index: number, reason: string): Promise<void> {
DiagnosticLogger.info(
'reader',
'ensure_loaded_begin',
`reason ${reason} index ${index} current ${this.currentIndex} hasPreview ${this.hasPreviewAt(index)} total ${this.totalPages()} images ${this.images.length} previewP... | 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 ensureLoaded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : ... | private async ensureLoaded(index: number, reason: string): Promise<void> {
DiagnosticLogger.info(
'reader',
'ensure_loaded_begin',
`reason ${reason} index ${index} current ${this.currentIndex} hasPreview ${this.hasPreviewAt(index)} total ${this.totalPages()} images ${this.images.length} previewP... | https://github.com/erosTeam/NextE | 94410d2ee45ce6ff7c57d6f73450ab6a75fc0e5a | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/Wrapper.ets | arkts | orderByAsc | 对某字段排序-升序。可以调用多次,按顺序拼接SQL
@param field 字段
@returns Wrapper | orderByAsc(field: string, condition: boolean = true): Wrapper {
if (condition) {
this.orderList.push(`${field} asc`)
}
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left orderByAsc 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#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | orderByAsc(field: string, condition: boolean = true): Wrapper {
if (condition) {
this.orderList.push(`${field} asc`)
}
return this
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L239-L244 | 744a88b4864a7b9c357e269c1ab25c78470fe613 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | formatHttpError | 将 HTTP 错误对象格式化为用户友好的中文提示 | static formatHttpError(error: object): string {
let code = 0
let message = ''
try {
const errorStr = JSON.stringify(error)
const parsed = JSON.parse(errorStr) as Record<string, Object>
if (parsed.code !== undefined) {
code = parsed.code as number
}
if (parsed.message ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatHttpError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static formatHttpError(error: object): string {
let code = 0
let message = ''
try {
const errorStr = JSON.stringify(error)
const parsed = JSON.parse(errorStr) as Record<string, Object>
if (parsed.code !== undefined) {
code = parsed.code as number
}
if (parsed.message ... | https://github.com/LongLiveY96/chatcube | fc7ce137e4156de53edfb5c0d82e93322428bfde | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getScaledAppFontSize | 获取缩放后的APP界面字号 | public static getScaledAppFontSize(scale?: number): number {
const s = scale ?? FontAwareHelper.globalState.fontScale;
return Math.round(FontAwareHelper.globalState.appFontSize * s);
} | 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 getScaledAppFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scale AST#identifier#Right AST#?#L... | public static getScaledAppFontSize(scale?: number): number {
const s = scale ?? FontAwareHelper.globalState.fontScale;
return Math.round(FontAwareHelper.globalState.appFontSize * s);
} | https://github.com/DaLongZhuaZi/manxia | 3346b7d0630c51ba55ffdcadaef5d0f8f12fdb9e | github |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_union/user/main.ets | arkts | test_mix5_return1 | 5 组合所有类型 return | function test_mix5_return1() {
let instance: UnionTest1.MyInterface = UnionTest1.getInterface();
instance.funcUnionMix5Return("s");
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_mix5_return1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_d... | function test_mix5_return1() {
let instance: UnionTest1.MyInterface = UnionTest1.getInterface();
instance.funcUnionMix5Return("s");
} | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | 55e818dfda5332349ce06db9c5afbde99e13d2f3 | gitcode |
somnio-software/my-bot-pal | entry/src/main/ets/utils/LocationService.ets | arkts | getCurrentLocation | Gets the current location of the device with high accuracy or fast response
@param highAccuracy If true, prioritizes accuracy over speed
@param timeoutMs Maximum time to wait for location (in milliseconds)
@returns Promise with the location data | public async getCurrentLocation(highAccuracy: boolean = false, timeoutMs: number = 10000): Promise<LocationData> {
const request: geoLocationManager.SingleLocationRequest = {
locatingPriority: highAccuracy ?
geoLocationManager.LocatingPriority.PRIORITY_ACCURACY :
geoLocationManager.LocatingPrior... | 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 getCurrentLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left highAccuracy AST#identifier#Right AST... | public async getCurrentLocation(highAccuracy: boolean = false, timeoutMs: number = 10000): Promise<LocationData> {
const request: geoLocationManager.SingleLocationRequest = {
locatingPriority: highAccuracy ?
geoLocationManager.LocatingPriority.PRIORITY_ACCURACY :
geoLocationManager.LocatingPrior... | https://github.com/somnio-software/my-bot-pal | 0dd6d46c21af676c99c7a1f03c5b395affcfefcf | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | getFloat32 | === Float32 ===
Read bytes as they represent given type
@param { int } byteOffset zero index to read
@returns { int } return byteOffset's Float32 value
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getFloat32(byteOffset: int): number {
return this.getFloat32Big(byteOffset)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFloat32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identif... | public getFloat32(byteOffset: int): number {
return this.getFloat32Big(byteOffset)
} | https://gitcode.com/iop123123/arkts-static-skills | 2d6bf2fa519492af4e2c0a36a4ff74549bf26773 | gitcode |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | getItem | GET /users/{uid}/items/{key}. Single item, including its child items
(notes/attachments) reachable via the response's `meta.numChildren`. | async getItem(itemKey: string): Promise<ZoteroItem> {
if (itemKey.length === 0) {
throw new ZoteroApiError(0, 'getItem: itemKey must not be empty');
}
const uid = this.requireUserId();
const raw = await this.send(`/users/${uid}/items/${itemKey}`, undefined);
return parseItemEnvelope(parseJso... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getItem AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left itemKey AST#identifier#Right AST#type... | async getItem(itemKey: string): Promise<ZoteroItem> {
if (itemKey.length === 0) {
throw new ZoteroApiError(0, 'getItem: itemKey must not be empty');
}
const uid = this.requireUserId();
const raw = await this.send(`/users/${uid}/items/${itemKey}`, undefined);
return parseItemEnvelope(parseJso... | https://github.com/Vincent-Leon/zotero-harmony | 99e41f8842eb9dd048c521ab4accf884701440a1 | github |
LZZLHY/hlib | entry/src/main/ets/utils/QrLoginParser.ets | arkts | fromKv | 解析任意 "k=v[&; ,]k=v" 形式。 | private static fromKv(text: string): QrCredential | null {
const map: Record<string, string> = {};
const parts: string[] = text.split(/[&;,\s]+/);
for (let i = 0; i < parts.length; i++) {
const seg: string = parts[i];
const eq: number = seg.indexOf('=');
if (eq <= 0) continue;
cons... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left fromKv AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right A... | private static fromKv(text: string): QrCredential | null {
const map: Record<string, string> = {};
const parts: string[] = text.split(/[&;,\s]+/);
for (let i = 0; i < parts.length; i++) {
const seg: string = parts[i];
const eq: number = seg.indexOf('=');
if (eq <= 0) continue;
cons... | https://github.com/LZZLHY/hlib | 10c3d1dbe3cc465f414ca966b5e065135c952dd4 | github |
IoTAccessControl/ArkTSAnalysis | TestApps/AccountKit-QuickLogin/entry/src/main/ets/pages/PrepareLoginPage.ets | arkts | getQuickLoginAnonymousPhone | Obtain the anonymous mobile number. | getQuickLoginAnonymousPhone() {
// Create an authorization request.
const authRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
// User information requested by the app.
authRequest.scopes = ['quickLoginAnonymousPhone'];
// In the one-tap sign-in scenario, f... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getQuickLoginAnonymousPhone 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#statem... | getQuickLoginAnonymousPhone() {
// Create an authorization request.
const authRequest = new authentication.HuaweiIDProvider().createAuthorizationWithHuaweiIDRequest();
// User information requested by the app.
authRequest.scopes = ['quickLoginAnonymousPhone'];
// In the one-tap sign-in scenario, f... | https://github.com/IoTAccessControl/ArkTSAnalysis | 5d245e647905bbf67adf713ef60fc3ab8cc5a9b0 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | hasReachedLimitedSnoozeTimes | Has the nap limit been reached
@return true if reached the upper limit | async hasReachedLimitedSnoozeTimes(alarmInfo: AlarmInfo): Promise<boolean> {
const hasSnoozedTimes = await SnoozeManager.getSnoozedTimes(alarmInfo.id as string);
return hasSnoozedTimes >= alarmInfo.snoozeTimes;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left hasReachedLimitedSnoozeTimes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#type_annotation... | async hasReachedLimitedSnoozeTimes(alarmInfo: AlarmInfo): Promise<boolean> {
const hasSnoozedTimes = await SnoozeManager.getSnoozedTimes(alarmInfo.id as string);
return hasSnoozedTimes >= alarmInfo.snoozeTimes;
} | https://gitee.com/openharmony-sig/applications_clock.git | 39c5d4caf9f78cefdc824f41ffc85768a73a8862 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | clearCoverCache | 清除所有封面缓存 | public clearCoverCache(): boolean {
try {
const coverDir = this.getCoverCacheDir();
const files = SafeFileUtils.listFileSync(coverDir);
for (const file of files) {
try {
SafeFileUtils.unlinkSync(`${coverDir}/${file}`);
} catch (e) {
// ignore
}
}... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearCoverCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | public clearCoverCache(): boolean {
try {
const coverDir = this.getCoverCacheDir();
const files = SafeFileUtils.listFileSync(coverDir);
for (const file of files) {
try {
SafeFileUtils.unlinkSync(`${coverDir}/${file}`);
} catch (e) {
// ignore
}
}... | https://github.com/DaLongZhuaZi/manxia | ac2ef180d21cf21084be0e55faeec81cab304a80 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/UserLibraryApi.ets | arkts | getLatestMedia | Gets latest media.
@summary Gets latest media.
@param {UserLibraryApiGetLatestMediaRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof UserLibraryApi | public async getLatestMedia(requestParameters: UserLibraryApiGetLatestMediaRequest = {}): Promise<Array<BaseItemDto>> {
return this.apiClient.get({path: "/Items/Latest", parameters: requestParameters})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getLatestMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AS... | public async getLatestMedia(requestParameters: UserLibraryApiGetLatestMediaRequest = {}): Promise<Array<BaseItemDto>> {
return this.apiClient.get({path: "/Items/Latest", parameters: requestParameters})
} | https://github.com/OHPG/FinSdk | 685478f69bd7d919431180b5cf1c5d0c630ada1c | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/components/msg_view/NormalMsgView.ets | arkts | messageBubbleOutsideStyle | 消息气泡外层父布局的样式设置 | @Extend(Column)
function messageBubbleOutsideStyle(isOutgoing: boolean) {
.layoutWeight(1)
.alignItems(isOutgoing ? HorizontalAlign.End : HorizontalAlign.Start)
// 气泡末端距离手机两侧的间距,目的是让消息气泡的末端要空出一个头像+头像两边间距的空白距离,ui上好看一点
.margin(isOutgoing ? { left: 40 + 8 + 8 } : { right: 40 + 8 + 8 })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Column AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | @Extend(Column)
function messageBubbleOutsideStyle(isOutgoing: boolean) {
.layoutWeight(1)
.alignItems(isOutgoing ? HorizontalAlign.End : HorizontalAlign.Start)
// 气泡末端距离手机两侧的间距,目的是让消息气泡的末端要空出一个头像+头像两边间距的空白距离,ui上好看一点
.margin(isOutgoing ? { left: 40 + 8 + 8 } : { right: 40 + 8 + 8 })
} | https://github.com/JackJiang2011/harmonychat | 5c8142d4096385cc4643e8e5a8e7bd6fc4f9db68 | github |
the-wwyang/kids-learning-app | src/main/ets/services/LearningRecordService.ets | arkts | analyzeLearningPattern | 分析学习模式
@param records 答题记录列表
@returns 学习模式分析结果 | static analyzeLearningPattern(records: AnswerRecord[]): LearningPatternAnalysis {
const peakHour = LearningRecordService.getPeakLearningHour(records);
// 计算平均会话长度(假设相隔超过1小时算不同会话)
const sessions: AnswerRecord[][] = [];
let currentSession: AnswerRecord[] = [];
const sortedRecords = [...records].sor... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left analyzeLearningPattern AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr... | static analyzeLearningPattern(records: AnswerRecord[]): LearningPatternAnalysis {
const peakHour = LearningRecordService.getPeakLearningHour(records);
// 计算平均会话长度(假设相隔超过1小时算不同会话)
const sessions: AnswerRecord[][] = [];
let currentSession: AnswerRecord[] = [];
const sortedRecords = [...records].sor... | https://github.com/the-wwyang/kids-learning-app | 77359372c2636b1381a2cbf055a64841440380f4 | github |
SMAT-Lab/HapRepair | arkts_files/152.ets | arkts | constructor | 设置初始值为 false | constructor(lazyItem: LazyItem<UserFileDataItem>, pageName?: string, isSelectUpperLimited?: boolean) {
super()
// 使用 defaults 处理可选参数
this.lazyItem = lazyItem;
this.mediaItem = lazyItem.item; // 从 lazyItem 初始化 mediaItem
// 如果提供了,才使用来自参数的 pageName 和 isSelectUpperLimited
if (pageName) {
thi... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lazyItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identif... | constructor(lazyItem: LazyItem<UserFileDataItem>, pageName?: string, isSelectUpperLimited?: boolean) {
super()
// 使用 defaults 处理可选参数
this.lazyItem = lazyItem;
this.mediaItem = lazyItem.item; // 从 lazyItem 初始化 mediaItem
// 如果提供了,才使用来自参数的 pageName 和 isSelectUpperLimited
if (pageName) {
thi... | https://github.com/SMAT-Lab/HapRepair | 901300e439dc7e85223e5066df5bd5574f5f9e81 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieEntry.ets | arkts | getValue | This is the same as getY(). Returns the value of the PieEntry.
@return | public getValue(): number {
return super.getY();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public getValue(): number {
return super.getY();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 84d0b0d25b221bf7e17256ee8172cb04ee7a95b5 | gitee |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/pages/application-tertiary.ets | arkts | aboutToAppear | Lifecycle function, executed when the page is initialized | aboutToAppear() {
this.selected = this.status;
this.getMediaDocList();
this.getReason();
try {
bundleManager.getBundleInfo(this.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
.then(res => {
this.version = res.versionName;
accessTokenId = res.a... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.selected = this.status;
this.getMediaDocList();
this.getReason();
try {
bundleManager.getBundleInfo(this.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION)
.then(res => {
this.version = res.versionName;
accessTokenId = res.a... | https://gitee.com/openharmony/applications_permission_manager.git | c8bd6483d447705e3c672debdcbcffe1d7a285b2 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies elements from an ArrayLike object to the Int32Array.
@param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy.
@param { int } [offset] - Optional. The offset into the target array at which to begin
writing values from the source array. The default value is 0.
@throws { RangeError ... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | https://gitcode.com/iop123123/arkts-static-skills | ddca1953baa5bbde973e557cba40fe6f4b7184ab | gitcode |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/HomePage.ets | arkts | goToProfile | 方法名称: goToProfile
功能描述: 跳转到个人中心页面。
逻辑:
使用 router.pushUrl 方法将 'pages/ProfilePage' 压入页面栈顶。
这种方式允许用户在个人中心页面通过点击“返回”按钮回到当前的主页。
跳转到个人中心 | goToProfile() {
router.pushUrl({
url: 'pages/ProfilePage'
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left goToProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | goToProfile() {
router.pushUrl({
url: 'pages/ProfilePage'
});
} | https://gitcode.com/openharmony/codelabs | 41d52060e048275934022efec5d930aa5d3711c6 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets | arkts | closeKVStore | This command is used to shut down the specified KVStore database by package name. | closeKVStore(): void {
try {
this.kvManager?.closeKVStore(this.context.abilityInfo.bundleName, CommonConstants.DB_STORE_ID,
(err: BusinessError) => {
if (err !== undefined) {
console.error(TAG, `Failed to close KVStore, error message is ${JSON.stringify(err)}`);
ret... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeKVStore 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... | closeKVStore(): void {
try {
this.kvManager?.closeKVStore(this.context.abilityInfo.bundleName, CommonConstants.DB_STORE_ID,
(err: BusinessError) => {
if (err !== undefined) {
console.error(TAG, `Failed to close KVStore, error message is ${JSON.stringify(err)}`);
ret... | https://gitee.com/harmonyos/codelabs.git | 749fa4f4fd51c073efe1b8d85917462e0af11721 | gitee |
OnceWeWere/Weather_HarmonyOS | entry/src/main/ets/pages/StartPage.ets | arkts | aboutToDisappear | 良好的编程习惯:页面即将销毁(兜底保险) | aboutToDisappear(): void {
clearTimeout(this.timeOut_StatPage)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
clearTimeout(this.timeOut_StatPage)
} | https://github.com/OnceWeWere/Weather_HarmonyOS | fa448efe33bb9b0911827b9b14484dce201e354a | github |
heeh02/superconnect | harmony/entry/src/main/ets/input/GestureController.ets | arkts | spread | Inter-finger distance; falls back to last value if a finger is momentarily absent. | private spread(ts: TouchObject[]): number {
const p: TouchObject[] = this.twoPts(ts);
if (p.length < 2) { return this.spreadLast; }
return this.dist({ x: p[0].x, y: p[0].y }, { x: p[1].x, y: p[1].y });
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left spread AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | private spread(ts: TouchObject[]): number {
const p: TouchObject[] = this.twoPts(ts);
if (p.length < 2) { return this.spreadLast; }
return this.dist({ x: p[0].x, y: p[0].y }, { x: p[1].x, y: p[1].y });
} | https://github.com/heeh02/superconnect | 20c55f6c3e6c8777ae1f22ba5a0a7c2e79526d9d | github |
the-wwyang/kids-learning-app | src/main/ets/common/SecurityUtils.ets | arkts | verifyPassword | 验证密码
@param inputPassword 用户输入的密码
@param storedPassword 存储的加密密码
@returns 是否匹配 | static verifyPassword(inputPassword: string, storedPassword: string): boolean {
const encryptedInput = SecurityUtils.encryptPassword(inputPassword);
return encryptedInput === storedPassword;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left verifyPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputPassword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | static verifyPassword(inputPassword: string, storedPassword: string): boolean {
const encryptedInput = SecurityUtils.encryptPassword(inputPassword);
return encryptedInput === storedPassword;
} | https://github.com/the-wwyang/kids-learning-app | 5e7ba499dc45142e585cc7072bd4cb109e43e9c6 | github |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | equals | Equality operator. | equals(other: ESObject): boolean {
if (!(other instanceof OffsetBase)) {
return false;
}
return other._dx === this._dx && other._dy === this._dy;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ESObject AST#identifier#Right AST#)#Left ) AST#)... | equals(other: ESObject): boolean {
if (!(other instanceof OffsetBase)) {
return false;
}
return other._dx === this._dx && other._dy === this._dy;
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L48-L53 | 1e2c8021f143d7e222f87936b7e1f4668091ee89 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/HttpService.ets | arkts | putBinary | 二进制 PUT 请求(用于上传文件,带发送进度回调) | async putBinary(
url: string,
body: ArrayBuffer,
headers: Record<string, string>,
onProgress?: BinaryProgressCallback,
runtime?: HttpRequestRuntimeOptions
): Promise<HttpResponse> {
const httpRequest = http.createHttp()
let requestId = ''
const controller = runtime?.controller
i... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left putBinary AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | async putBinary(
url: string,
body: ArrayBuffer,
headers: Record<string, string>,
onProgress?: BinaryProgressCallback,
runtime?: HttpRequestRuntimeOptions
): Promise<HttpResponse> {
const httpRequest = http.createHttp()
let requestId = ''
const controller = runtime?.controller
i... | https://github.com/LongLiveY96/chatcube | 8300c34cfa8f61292f6282833bca14e220f7f5c9 | github |
openharmony-sig/online_event | solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/repo/PullRequestViewModel.ets | arkts | onPullRequest | 点击单个pr的方法 | onPullRequest() {
console.info('PullRequestViewModel: onPullRequest')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPullRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | onPullRequest() {
console.info('PullRequestViewModel: onPullRequest')
} | https://gitee.com/openharmony-sig/online_event.git | dc3e5271fe6ce647d7d72006246b1b6b2307dfa8 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnStickyViewModel.ets | arkts | handleStickyChange | 处理吸顶状态变化
@param fixed 是否吸顶 | handleStickyChange(fixed: boolean): void {
this.isFixed = fixed;
this.changeLog = fixed ? "已吸顶" : "已脱离吸顶";
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleStickyChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fixed AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#L... | handleStickyChange(fixed: boolean): void {
this.isFixed = fixed;
this.changeLog = fixed ? "已吸顶" : "已脱离吸顶";
} | https://github.com/codelably/tuniao-ui | 7239888874c2e65c59d338acdd456d8123d6a88a | github |
HarmonyOS_Samples/BestPracticeSnippets | AppDataSecurity/entry/src/main/ets/pages/Index.ets | arkts | getEl1Path | [End get_el2_path]
[Start get_el1_path] | getEl1Path(): void {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
context.area = contextConstant.AreaMode.EL1;
let filePath = context.filesDir + '/health_data.txt';
this.message = filePath;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEl1Path 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#L... | getEl1Path(): void {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
context.area = contextConstant.AreaMode.EL1;
let filePath = context.filesDir + '/health_data.txt';
this.message = filePath;
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 670c5b8826ff005cdf1df3d6aa570a43ffccf4c5 | gitcode |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets | arkts | getCurrentTime | 获取当前播放时间函数 | getCurrentTime(): number {
return this.avPlayer?.currentTime ? this.avPlayer?.currentTime : 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme... | getCurrentTime(): number {
return this.avPlayer?.currentTime ? this.avPlayer?.currentTime : 0;
} | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 07dc0994e8390a7f5087a0e43f30e2480abe9240 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets | arkts | parseDifferentialPatch | 解析差分补丁 | private async parseDifferentialPatch(patchData: ArrayBuffer): Promise<DifferentialPatch> {
// 模拟解析差分补丁的逻辑
return {
patchId: 'mock_patch',
sourceVersion: '1.0.0',
targetVersion: '1.1.0',
patchSize: patchData.byteLength,
patchData: patchData,
operations: []
};
} | 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 parseDifferentialPatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left patchData AST#identifier#Right... | private async parseDifferentialPatch(patchData: ArrayBuffer): Promise<DifferentialPatch> {
// 模拟解析差分补丁的逻辑
return {
patchId: 'mock_patch',
sourceVersion: '1.0.0',
targetVersion: '1.1.0',
patchSize: patchData.byteLength,
patchData: patchData,
operations: []
};
} | https://github.com/DaLongZhuaZi/manxia | 5f93e1ae72195992eb32709e24dd1a18b5a39507 | github |
SMAT-Lab/ArkAnalyzer-HapRay | test_hap/test_suite/src/main/ets/testcases/imageknife/pages/ImageCacheUtil.ets | arkts | getCacheSize | 获取缓存大小(字节) | static async getCacheSize(): Promise<number> {
try {
if (!ImageCacheUtil.initialized || !fileIO.accessSync(ImageCacheUtil.cacheDir)) {
return 0;
}
let totalSize = 0;
const files = fileIO.listFileSync(ImageCacheUtil.cacheDir);
for (let file of files) {
const filePath =... | 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 getCacheSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | static async getCacheSize(): Promise<number> {
try {
if (!ImageCacheUtil.initialized || !fileIO.accessSync(ImageCacheUtil.cacheDir)) {
return 0;
}
let totalSize = 0;
const files = fileIO.listFileSync(ImageCacheUtil.cacheDir);
for (let file of files) {
const filePath =... | https://github.com/SMAT-Lab/ArkAnalyzer-HapRay | 0051e7c7d68e41c1c7c1612999be87e261ada328 | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/image/image-viewer.ets | arkts | calcFitScaleRatio | 根据图片大小和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率(以短边显示为最佳)
@returns:缩放倍率 | calcFitScaleRatio(): number {
let ratio: number = 1.0
const winWidth = WuGlobalData.screenWidth
const winHeight = WuGlobalData.screenHeight
if (winWidth > this.imageFitSize.width) {
ratio = winWidth / this.imageFitSize.width
} else {
ratio = winHeight / this.imageFitSize.height
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calcFitScaleRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stat... | calcFitScaleRatio(): number {
let ratio: number = 1.0
const winWidth = WuGlobalData.screenWidth
const winHeight = WuGlobalData.screenHeight
if (winWidth > this.imageFitSize.width) {
ratio = winWidth / this.imageFitSize.width
} else {
ratio = winHeight / this.imageFitSize.height
}
... | https://github.com/itrainhub/wu-ui | 12192d0dc227cbe9c443e0ffb1669ddb02d65730 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setMinutes | Sets the minutes for a specified date according to local time.
@param value new minutes | public setMinutes(value: byte): void {
assert value >= 0 && value < 60;
let min = ecmaMinFromTime(this.ms - this.TZOffset * 60 * msPerSecond);
this.ms -= min * msPerMinute;
this.ms += value * msPerMinute;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left byte AST#identifier#... | public setMinutes(value: byte): void {
assert value >= 0 && value < 60;
let min = ecmaMinFromTime(this.ms - this.TZOffset * 60 * msPerSecond);
this.ms -= min * msPerMinute;
this.ms += value * msPerMinute;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d75408e17f3887cf953a6975537bde4ae48671ab | gitee |
Explore-In-HMOS-Wearable/nfc-emulation-app | entry/src/main/ets/viewmodels/SplashViewModel.ets | arkts | splashStart | @Trace init: boolean = false; //You can manage parameters here so it will effect screen | async splashStart() {
const result: boolean = await new Promise((resolve: Function) => {
setTimeout(() => {
resolve(true);
}, 3000);
});
// in upper method there can be inital operation like fetching device info from backend
// when everything fetched successfully it will dashbo... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left splashStart 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#{#Ri... | async splashStart() {
const result: boolean = await new Promise((resolve: Function) => {
setTimeout(() => {
resolve(true);
}, 3000);
});
// in upper method there can be inital operation like fetching device info from backend
// when everything fetched successfully it will dashbo... | https://github.com/Explore-In-HMOS-Wearable/nfc-emulation-app | ced00af8673516079cfbd71d363beaed9022d46f | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | removeAlarm | 删除闹钟
@param alarmInfo 闹钟对象 | async removeAlarm(alarmInfo: AlarmInfo): Promise<void> {
const rdbStore = await this.getRdbStore();
try {
rdbStore.beginTransaction();
const predicates = new rdb.RdbPredicates(DATA_TABLE);
predicates.equalTo('ID', alarmInfo.id as string);
await rdbStore.delete(predicates);
rdbSto... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeAlarm AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async removeAlarm(alarmInfo: AlarmInfo): Promise<void> {
const rdbStore = await this.getRdbStore();
try {
rdbStore.beginTransaction();
const predicates = new rdb.RdbPredicates(DATA_TABLE);
predicates.equalTo('ID', alarmInfo.id as string);
await rdbStore.delete(predicates);
rdbSto... | https://gitee.com/openharmony-sig/applications_clock.git | 619509814ae39bef25f91644d7418616a9582f1a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets | arkts | detectTabletDevice | 检测是否是平板、二合一类设备 | private detectTabletDevice(): void {
try {
const deviceTypeStr = deviceInfo.deviceType;
this.isTablet = deviceTypeStr === 'tablet' || deviceTypeStr === '2in1';
logger.info(TAG, `✅ 检测到平板类设备: ${this.isTablet}`);
} catch (error) {
logger.warn(TAG, '平板类设备检测失败', String(error));
this.i... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectTabletDevice 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 A... | private detectTabletDevice(): void {
try {
const deviceTypeStr = deviceInfo.deviceType;
this.isTablet = deviceTypeStr === 'tablet' || deviceTypeStr === '2in1';
logger.info(TAG, `✅ 检测到平板类设备: ${this.isTablet}`);
} catch (error) {
logger.warn(TAG, '平板类设备检测失败', String(error));
this.i... | https://github.com/DaLongZhuaZi/manxia | e536eefbecc5d6601638532a0c32dc3e2c2fca0a | github |
openharmony-sig/applications_clock | common/src/main/ets/utils/WantAgentUtil.ets | arkts | getAlarmWantAgent | Get the WantAgent used by the timer to start the alarm ringing service.
@param alarmInfo AlarmInfo
@param serviceType AlarmServiceType Enum value
@param isNotificationCloseButton Whether is button for closing the notification bar
@return WantAgent used by the timer to start the alarm ringing service | static async getAlarmWantAgent(alarmInfo: AlarmInfo, serviceType: AlarmServiceType,
isNotificationCloseButton?: boolean, isSnooze?: boolean):
Promise<WantAgent | undefined> {
LogUtil.info(TAG, 'getAlarmWantAgent with serviceType:', serviceType);
try {
const wantAgent... | 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 getAlarmWantAgent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#:#L... | static async getAlarmWantAgent(alarmInfo: AlarmInfo, serviceType: AlarmServiceType,
isNotificationCloseButton?: boolean, isSnooze?: boolean):
Promise<WantAgent | undefined> {
LogUtil.info(TAG, 'getAlarmWantAgent with serviceType:', serviceType);
try {
const wantAgent... | https://gitee.com/openharmony-sig/applications_clock.git | 0c038f81d382908d2cbec19c14f7fd1b96f6bf0c | gitee |
codelably/HCompass | packages/demo/src/main/ets/services/DemoNavSvcImpl.ets | arkts | toStateManagement | 跳转到状态管理示例页
@returns {void} 无返回值 | toStateManagement(): void {
const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService);
navigation?.navigateTo(DemoRoutes.StateManagement);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toStateManagement 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_... | toStateManagement(): void {
const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService);
navigation?.navigateTo(DemoRoutes.StateManagement);
} | https://github.com/codelably/HCompass | 55fefa405c3081dcadb4154f3d98a2835d83bf57 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/serviceextability/MyVpnExtAbility.ets | arkts | notifyConfigSignature | ---- Persistent stats notification --------------------------------------- | private notifyConfigSignature(): string {
try {
const stat = fileIo.statSync(this.notifyConfigFilePath);
return `${stat.mtime}:${stat.size}`;
} catch (_) {
return '';
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyConfigSignature AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left s... | private notifyConfigSignature(): string {
try {
const stat = fileIo.statSync(this.notifyConfigFilePath);
return `${stat.mtime}:${stat.size}`;
} catch (_) {
return '';
}
} | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L982-L989 | a2cdbbdf9e065c3e4db1356007b9cfe754ef2442 | github |
erosTeam/NextE | shared/src/main/ets/components/GalleryCard.ets | arkts | chipBg | Chip background: the user's editable MyTags color, else EH preview fill, else inline-style fallback.
Never namespace-derived. | chipBg(t: SimpleTag): ResourceColor {
const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(t.namespace, t.text)
if (u !== undefined && u.colorCode.length > 0) {
return u.colorCode
}
if (u !== undefined && u.fillColor.length > 0) {
return u.fillColor
}
if (t.background... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left chipBg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SimpleTag AST#identifier#Right AST#)#Left ) AST#)#Ri... | chipBg(t: SimpleTag): ResourceColor {
const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(t.namespace, t.text)
if (u !== undefined && u.colorCode.length > 0) {
return u.colorCode
}
if (u !== undefined && u.fillColor.length > 0) {
return u.fillColor
}
if (t.background... | https://github.com/erosTeam/NextE | 0c5603471b04ad53f2ba5db179abc88a76e7f065 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | Finds the last element in the Int8Array that satisfies the condition
@param { function } fn - condition
@returns { byte } - the last element that satisfies fn
@throws { Error } - If the element cannot be found, throw an exception
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number, index: int, array: Int8Array) => boolean): byte {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn((val).toDouble(), i, this)) {
return val
}
}
throw new Error("Int8Array.f... | 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: number, index: int, array: Int8Array) => boolean): byte {
for (let i = this.lengthInt - 1; i >= 0; --i) {
let val = this.getUnsafe(i)
if (fn((val).toDouble(), i, this)) {
return val
}
}
throw new Error("Int8Array.f... | https://gitcode.com/iop123123/arkts-static-skills | 7595789fe56dc3f3005e72025e8b64502a06f646 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ContentPanel.ets | arkts | mergeStyleConfig | 合并样式配置(避免展开运算符) | private mergeStyleConfig(base: PanelStyleConfig, override: Partial<PanelStyleConfig>): PanelStyleConfig {
const result = this.copyStyleConfig(base);
if (override.width !== undefined) result.width = override.width;
if (override.height !== undefined) result.height = override.height;
if (override.borderR... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeStyleConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private mergeStyleConfig(base: PanelStyleConfig, override: Partial<PanelStyleConfig>): PanelStyleConfig {
const result = this.copyStyleConfig(base);
if (override.width !== undefined) result.width = override.width;
if (override.height !== undefined) result.height = override.height;
if (override.borderR... | https://github.com/DaLongZhuaZi/manxia | b6a85488fff932ff43b3dbce1dd373dad9dc6f13 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.