nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets | arkts | toReversed | Returns a new sparse array with the elements in reversed order.
@returns { SparseArray<T> } A new reversed sparse array.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public toReversed(): SparseArray<T> {
const ret: SparseArray<T> = new SparseArray<T>()
ret.maxLength = this.maxLength
for (let i: int = 0; i < this.maxLength; i++) {
if (this.buffer.has(i)) {
const v: T | undefined = this.buffer.get(i)
ret.buffer.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#... | public toReversed(): SparseArray<T> {
const ret: SparseArray<T> = new SparseArray<T>()
ret.maxLength = this.maxLength
for (let i: int = 0; i < this.maxLength; i++) {
if (this.buffer.has(i)) {
const v: T | undefined = this.buffer.get(i)
ret.buffer.... | https://gitcode.com/iop123123/arkts-static-skills | 23c65fac2a3db26b331715c5c9ef02312b47f89e | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/ParentalControlService.ets | arkts | getTodayUsageMinutes | 获取今日使用时长(分钟) | public async getTodayUsageMinutes(): Promise<number> {
const today = this.getTodayString();
const records = await this.getUsageRecords();
const todayRecord = records.find(r => r.date === today);
const recordedMinutes = todayRecord?.totalMinutes || 0;
const currentSessionMinutes = this.getCurrentS... | 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 getTodayUsageMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | public async getTodayUsageMinutes(): Promise<number> {
const today = this.getTodayString();
const records = await this.getUsageRecords();
const todayRecord = records.find(r => r.date === today);
const recordedMinutes = todayRecord?.totalMinutes || 0;
const currentSessionMinutes = this.getCurrentS... | https://github.com/the-wwyang/kids-learning-app | 7735ac0a85a17ec08808972bd91a07391dff3f73 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | consecutiveWrong | 计算连续答错次数 | private consecutiveWrong(): number {
let count = 0;
for (let i = this.answerHistory.length - 1; i >= 0; i--) {
if (!this.answerHistory[i].isCorrect) {
count++;
} else {
break;
}
}
return count;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left consecutiveWrong 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... | private consecutiveWrong(): number {
let count = 0;
for (let i = this.answerHistory.length - 1; i >= 0; i--) {
if (!this.answerHistory[i].isCorrect) {
count++;
} else {
break;
}
}
return count;
} | https://github.com/the-wwyang/kids-learning-app | 6288bde8f767508beea36685efc185ea2e174da6 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrCodeGenerator.ets | arkts | buildQR | ─── Main Generation ────────────────────────────────────────────────────────── | function buildQR(data: Uint8Array, ecLevel: ECLevel): QRMatrix {
const version = selectVersion(data.length, ecLevel);
const dataBytes = encodeData(data, version, ecLevel);
const codewords = createCodewords(dataBytes, version, ecLevel);
// Try all 8 mask patterns, pick the one with lowest penalty
let bestMask... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildQR AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS... | function buildQR(data: Uint8Array, ecLevel: ECLevel): QRMatrix {
const version = selectVersion(data.length, ecLevel);
const dataBytes = encodeData(data, version, ecLevel);
const codewords = createCodewords(dataBytes, version, ecLevel);
// Try all 8 mask patterns, pick the one with lowest penalty
let bestMask... | https://github.com/AlkaidLab/moonlight-harmony | 4904e9c25323f1afa7c8a25d2fc4bbe65e9f34eb | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | updateAnnotation | PATCH /users/{uid}/items/{key}. Partial update of an annotation. The
body's keys correspond to ZoteroItemData fields (annotationColor,
annotationComment, etc.). Returns the new server-side version on
success — callers should store it locally so the next write doesn't
412 against a stale optimistic-locking value. | async updateAnnotation(
annotationKey: string,
version: number,
changes: Record<string, Object>,
): Promise<number> {
if (annotationKey.length === 0) {
throw new ZoteroApiError(0, 'updateAnnotation: annotationKey must not be empty');
}
const uid = this.requireUserId();
const body: ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateAnnotation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left annotationKey AST#identifier... | async updateAnnotation(
annotationKey: string,
version: number,
changes: Record<string, Object>,
): Promise<number> {
if (annotationKey.length === 0) {
throw new ZoteroApiError(0, 'updateAnnotation: annotationKey must not be empty');
}
const uid = this.requireUserId();
const body: ... | https://github.com/Vincent-Leon/zotero-harmony | 549797006b5ab607a4a30319eb87d20f1108186f | github |
honjow/Next2V | shared/src/main/ets/storage/LocalDataCloudSync.ets | arkts | cloudSyncNow | Trigger a manual cloud-first sync of the marked tables; resolve with whether it reached progressCode 0
and record the outcome in CloudSyncState (surfaced by the Settings "立即同步" row). A `code` of
RDB_CLOUD_DISABLED (3) means the system Huawei 云空间 data sync is OFF for this app: the app cannot
toggle that switch, so we fl... | static async cloudSyncNow(context: common.UIAbilityContext): Promise<boolean> {
const state = connectCloudSync()
state.syncing = true
try {
const store = await LocalDataStore.open(context)
// store.cloudSync's promise resolves once the sync is ACCEPTED, not finished — the real outcome
//... | 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 cloudSyncNow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : A... | static async cloudSyncNow(context: common.UIAbilityContext): Promise<boolean> {
const state = connectCloudSync()
state.syncing = true
try {
const store = await LocalDataStore.open(context)
// store.cloudSync's promise resolves once the sync is ACCEPTED, not finished — the real outcome
//... | https://github.com/honjow/Next2V | ee697b40e66f63293c8160428ba112e3604e21e6 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | loadMediaSource | 获取媒体数据源
@param id
@returns | public loadMediaSource(id: string): Promise<PlaybackInfoResponse> {
return this.requireApi().loadMediaSource(id)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loadMediaSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public loadMediaSource(id: string): Promise<PlaybackInfoResponse> {
return this.requireApi().loadMediaSource(id)
} | https://github.com/OHPG/FinMusic | 3094d8de8bc0bfe6e48bdc4e1bd644676f8f13ad | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | copyWithin | Makes a copy of internal elements to targetPos from begin to end of Float32Array.
See rules of parameters normalization on
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin | MDN}
@param { int } target - insert index to place copied elements
@returns { Float32Array... | public copyWithin(target: int): Float32Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left target AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#... | public copyWithin(target: int): Float32Array {
this.copyWithinImpl(target, 0, this.lengthInt)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | a9378b9792cd6cade19da0f8d236803f823b0502 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test45_original_index.ets | arkts | testCaseConversion | --- String case conversion --- | function testCaseConversion(): string {
let lower: string = 'HELLO WORLD'.toLowerCase();
let upper: string = 'hello world'.toUpperCase();
let mixed: string = 'MiXeD CaSe'.toLowerCase();
return lower + '|' + upper + '|' + String(mixed.length);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testCaseConversion AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefin... | function testCaseConversion(): string {
let lower: string = 'HELLO WORLD'.toLowerCase();
let upper: string = 'hello world'.toUpperCase();
let mixed: string = 'MiXeD CaSe'.toLowerCase();
return lower + '|' + upper + '|' + String(mixed.length);
} | https://github.com/miaochiahao/ark-ghidra | d8becc106389ca63a5a76bb738baacf3c724be0b | github |
CLMC2025/Vignette | entry/src/main/ets/pages/learning/controllers/WordInteractionController.ets | arkts | onWordClick | Handle word click in story | public async onWordClick(
storyWord: StoryWord,
getState: () => DialogState,
notebookWords: Set<string>,
currentWord: WordItem | null,
session: LearningSession | null,
storyText: string,
currentStoryHash: string,
ensureSettingsLoaded: () => Promise<void>
): Promise<void> {
const ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left onWordClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right... | public async onWordClick(
storyWord: StoryWord,
getState: () => DialogState,
notebookWords: Set<string>,
currentWord: WordItem | null,
session: LearningSession | null,
storyText: string,
currentStoryHash: string,
ensureSettingsLoaded: () => Promise<void>
): Promise<void> {
const ... | https://github.com/CLMC2025/Vignette | c63f0ee8f2e3bd45b5f021bd1394d1269d2fdeff | github |
wuba/omni-ui | omni_component/src/main/ets/components/pullable/OmniPullableController.ets | arkts | getViewState | WebView 滚动处理
获取当前视图状态 | public getViewState(): ViewState {
return this.viewState
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getViewState 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 ViewState... | public getViewState(): ViewState {
return this.viewState
} | https://github.com/wuba/omni-ui | 12dc455f4c23ac5276c1aceaf6dc78196043c5f9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | now | 获取当前时间戳
@returns 当前时间戳(毫秒) | static now(): number {
return Date.now();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left now 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#:#Right... | static now(): number {
return Date.now();
} | https://github.com/DaLongZhuaZi/manxia | 8b9fb353a5ef74ab6f8c3aa1152131115a4da05d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets | arkts | runJavaScript | 运行JavaScript代码 | private async runJavaScript(js: string): Promise<string> {
if (!this.webviewController) {
throw new Error('WebView控制器未设置');
}
return new Promise((resolve, reject) => {
try {
this.webviewController!.runJavaScript(js)
.then((result) => {
// 处理返回结果
if (r... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left runJavaScript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left js AST#identifier#Right AST#:#Left : AS... | private async runJavaScript(js: string): Promise<string> {
if (!this.webviewController) {
throw new Error('WebView控制器未设置');
}
return new Promise((resolve, reject) => {
try {
this.webviewController!.runJavaScript(js)
.then((result) => {
// 处理返回结果
if (r... | https://github.com/DaLongZhuaZi/manxia | 70e50997290085fd3db528050952ec80c3c7db26 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/TypeShelfManager.ets | arkts | getDynamicShelves | 获取所有动态书架 | getDynamicShelves(): TypeShelf[] {
return this.shelves.filter(s => s.shelfType === ShelfType.DYNAMIC);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getDynamicShelves AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | getDynamicShelves(): TypeShelf[] {
return this.shelves.filter(s => s.shelfType === ShelfType.DYNAMIC);
} | https://github.com/DaLongZhuaZi/manxia | 5985cc032ce56198c977d83c4bc270fc09e44d81 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets | arkts | generateSummary | 生成汇总摘要
@param answers 智能体回答列表
@returns 汇总摘要 | private generateSummary(answers: AgentAnswer[]): string {
const agentNames = answers.map(a => a.agentName).join('、');
const avgConfidence = answers.reduce((sum, a) => sum + a.confidence, 0) / answers.length;
let summary = `经${agentNames}会诊,`;
if (avgConfidence >= 0.8) {
summary += '建议如下:';
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left answers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | private generateSummary(answers: AgentAnswer[]): string {
const agentNames = answers.map(a => a.agentName).join('、');
const avgConfidence = answers.reduce((sum, a) => sum + a.confidence, 0) / answers.length;
let summary = `经${agentNames}会诊,`;
if (avgConfidence >= 0.8) {
summary += '建议如下:';
... | https://github.com/LJ666-ui/harmony-health-care | 95a798d1bba8f8a945f62de5ef0cab2ba26ba025 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | pushPartText | 追加一段 content 文本到最后一个 text part, 或新建 text part。
通常只在 "已确认不会退回 buffer" 的路径上调用(直接 flush 到 aiMessage.content 时)。 | private pushPartText(aiMessage: ChatMessage, delta: string): void {
if (delta === '') {
return
}
const last = aiMessage.parts.length > 0 ? aiMessage.parts[aiMessage.parts.length - 1] : null
if (last !== null && last.kind === MessagePartKind.TEXT) {
last.text = last.text + delta
retur... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left pushPartText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | private pushPartText(aiMessage: ChatMessage, delta: string): void {
if (delta === '') {
return
}
const last = aiMessage.parts.length > 0 ? aiMessage.parts[aiMessage.parts.length - 1] : null
if (last !== null && last.kind === MessagePartKind.TEXT) {
last.text = last.text + delta
retur... | https://github.com/LongLiveY96/chatcube | 0aaa9c42c6967d64ed66c7bc2e1dc22f9ca3c1be | github |
Strive700/AdvisoryCore | AdvisoryCore-Harmony/entry/src/main/ets/pages/BasicFund.ets | arkts | handlePageChange | 处理分页变化 | private handlePageChange(page: number) {
this.currentPage = page;
this.onSearch();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handlePageChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private handlePageChange(page: number) {
this.currentPage = page;
this.onSearch();
} | https://github.com/Strive700/AdvisoryCore | 078a7da1902143dff0b188615b938dbd84ca6fbb | github |
the-wwyang/kids-learning-app | src/main/ets/storage/DataStorageManager.ets | arkts | saveObject | 保存对象数据(序列化为JSON)
@param storeName 存储文件名
@param key 键名
@param value 对象 | async saveObject<T>(storeName: string, key: string, value: T): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.saveString(storeName, key, jsonString);
console.log(`[DataStorageManager] Saved object: ${storeName}/${key}`);
} catch (error) {
console.error(`[Dat... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveObject AST#identifier#Right AST#ERROR#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST... | async saveObject<T>(storeName: string, key: string, value: T): Promise<void> {
try {
const jsonString = JSON.stringify(value);
await this.saveString(storeName, key, jsonString);
console.log(`[DataStorageManager] Saved object: ${storeName}/${key}`);
} catch (error) {
console.error(`[Dat... | https://github.com/the-wwyang/kids-learning-app | ade63a85da9f1080203b4d87462b83cf34c0dcbc | github |
XJTUWYD/ArkDiff | entry/src/main/ets/viewmodel/DiffSessionViewModel.ets | arkts | toggleCharDiff | 切换字符级 Diff | toggleCharDiff(): void {
this.enableCharDiff = !this.enableCharDiff;
this.runTextDiff();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleCharDiff AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | toggleCharDiff(): void {
this.enableCharDiff = !this.enableCharDiff;
this.runTextDiff();
} | https://github.com/XJTUWYD/ArkDiff | 68b2e47a6c9082af7e9ee79b2c7cc833106a22d6 | github |
mybricks/comlib-harmony-normal | packages/rt-arkts/comlib/src/main/ets/utils/GetDesignStyle.ets | arkts | constructor | 修改构造函数,接收参考样式 | constructor(styles: CSSProperties, referenceStyles?: CSSProperties) {
super(styles);
this.referenceStyles = referenceStyles;
} | 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 styles AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CSSProperties AST#identifie... | constructor(styles: CSSProperties, referenceStyles?: CSSProperties) {
super(styles);
this.referenceStyles = referenceStyles;
} | https://github.com/mybricks/comlib-harmony-normal | 0dd1b8dc498f24d15766cf50a95307b90135de65 | github |
OSpark-Team/Free-PCM | entry/src/main/ets/pages/components/FftSpectrum.ets | arkts | getPeaks01 | peaks 0~1 (copy) | public getPeaks01(): number[] {
return Array.from(this.peaks01);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPeaks01 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 number AST#... | public getPeaks01(): number[] {
return Array.from(this.peaks01);
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/entry/src/main/ets/pages/components/FftSpectrum.ets#L480-L482 | 506ad8a86ff8380e83d882eb187b9c53a5a9b6b8 | github |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | getCacheLimitSize | 获取文件或者内存缓存上限(字节)
@param cacheStrategy 指定需要查询类型。CacheStrategy.FILE为查询文件缓存,其余枚举为查询内存缓存
@param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存
@returns 文件或者内存上限, 获取文缓存上限失败返回-1 | getCacheLimitSize(cacheStrategy?: CacheStrategy, cacheName?:string): number | undefined {
return nativeNode.getCacheLimitSize(cacheStrategy, cacheName);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCacheLimitSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cacheStrategy AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Righ... | getCacheLimitSize(cacheStrategy?: CacheStrategy, cacheName?:string): number | undefined {
return nativeNode.getCacheLimitSize(cacheStrategy, cacheName);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L220-L222 | f34f3c4ac90423d8a214dd04816a2ccc8f093f21 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets | arkts | getModifier | 获取当前gridItem的modifier
@param item 网格元素
@returns 属性对象 | getModifier(item: T): GridItemModifier {
logger.info(`getModifier start, item:${JSON.stringify(item)}`);
const index: number = this.gridData.indexOf(item);
if (index === -1) {
return new GridItemModifier();
} else {
return this.modifier[index];
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getModifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri... | getModifier(item: T): GridItemModifier {
logger.info(`getModifier start, item:${JSON.stringify(item)}`);
const index: number = this.gridData.indexOf(item);
if (index === -1) {
return new GridItemModifier();
} else {
return this.modifier[index];
}
} | https://gitcode.com/arkui-x/samples | f3b8c68ad44a9b67869a015bfce94de93f0a9ae6 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/ParentalControlService.ets | arkts | getLearningStats | 获取学习统计 | private async getLearningStats(): Promise<LearningStats[]> {
if (!this.dataPreferences) return [];
try {
const statsJson = await this.dataPreferences.get(
ParentalControlService.LEARNING_STATS_KEY,
'[]'
) as string;
return JSON.parse(statsJson) as LearningStats[];
} cat... | 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 getLearningStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private async getLearningStats(): Promise<LearningStats[]> {
if (!this.dataPreferences) return [];
try {
const statsJson = await this.dataPreferences.get(
ParentalControlService.LEARNING_STATS_KEY,
'[]'
) as string;
return JSON.parse(statsJson) as LearningStats[];
} cat... | https://github.com/the-wwyang/kids-learning-app | a973d3777988d83f8d78704cddba05ed10c53c15 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ViewModelMapper.ets | arkts | toEntityDataWithConfig | 将 ViewModel 转换为 EntityData(使用配置)
@param viewModel ViewModel 实例
@param config 映射配置
@returns EntityData 实例 | static toEntityDataWithConfig<T>(viewModel: T, config: ViewModelMappingConfig<T>): EntityData {
const entityData = new EntityData(config.entityName)
const reverseMapper = config.getReverseMapper()
const propertyNames = config.getPropertyNames()
if (reverseMapper === null) {
throw new EntityMapp... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left toEntityDataWithConfig AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Lef... | static toEntityDataWithConfig<T>(viewModel: T, config: ViewModelMappingConfig<T>): EntityData {
const entityData = new EntityData(config.entityName)
const reverseMapper = config.getReverseMapper()
const propertyNames = config.getPropertyNames()
if (reverseMapper === null) {
throw new EntityMapp... | https://github.com/offlinecat-dev/OCNetORM | f71f4c2dd5b5fdfaf72c8b141e2a339eab5c6b59 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets | arkts | play | 启动播放
@returns {void} | play(): void {
this.avplayerModel.play();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left play AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS... | play(): void {
this.avplayerModel.play();
} | https://gitcode.com/arkui-x/samples | bfbc234b3c30adf7656da8f9641ce057ee70f03e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getFontSize | ==================== 通用字号计算接口 ====================
根据基础字号和场景获取实际字号
@param baseFontSize 基础字号
@param scene 使用场景
@param applyScale 是否应用缩放 | public static getFontSize(baseFontSize: number, scene: FontScene = FontScene.APP_UI, applyScale: boolean = true): number {
if (!applyScale) {
return baseFontSize;
}
return Math.round(baseFontSize * FontAwareHelper.globalState.fontScale);
} | 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 getFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseFontSize AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public static getFontSize(baseFontSize: number, scene: FontScene = FontScene.APP_UI, applyScale: boolean = true): number {
if (!applyScale) {
return baseFontSize;
}
return Math.round(baseFontSize * FontAwareHelper.globalState.fontScale);
} | https://github.com/DaLongZhuaZi/manxia | ad3ade64401a2e6b7431a9a59953019b7d6079b6 | github |
silence17/harmonydemo | common_lib/src/main/ets/utils/axios/HttpClient.ets | arkts | _processServiceCommon | 特定错误处理,解析json
@param {Object} param
@param {Object} respData
@returns {code:"",message:""} | private _processServiceCommon(param: RequestParam<T>, respData: AxiosResponse<ResponseData<T>>) {
// Log.error("url", param.url)
// Log.error("params", JSON.stringify(param.params))
// Log.error("response", JSON.stringify(respData))
let errorCode: string | number = respData.status
if (errorCode =... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _processServiceCommon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instan... | private _processServiceCommon(param: RequestParam<T>, respData: AxiosResponse<ResponseData<T>>) {
// Log.error("url", param.url)
// Log.error("params", JSON.stringify(param.params))
// Log.error("response", JSON.stringify(respData))
let errorCode: string | number = respData.status
if (errorCode =... | https://github.com/silence17/harmonydemo | 41f430fb01ee3351a38d06ef8b7a1b3a87a847bc | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpSessionManager.ets | arkts | registerScreenLockListener | Register screen lock listener | private async registerScreenLockListener(): Promise<void> {
try {
// Check if screen is currently locked using callback API
screenLock.isScreenLocked((err: BusinessError, isLocked: boolean) => {
if (err) {
console.error(`${TAG}: Failed to check screen lock: ${err.code}`);
s... | 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 registerScreenLockListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express... | private async registerScreenLockListener(): Promise<void> {
try {
// Check if screen is currently locked using callback API
screenLock.isScreenLocked((err: BusinessError, isLocked: boolean) => {
if (err) {
console.error(`${TAG}: Failed to check screen lock: ${err.code}`);
s... | https://github.com/tangwengang-del/freerdp-harmonyos | d090a32dda2bec4f801474b32b5f89da8f7f93bd | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | setAttributes | Sets an attribute for the current XML element.
@param {string} name - The name of the attribute to set.
@param {string} value - The value of the attribute to set.
@throws {BusinessError} Throws an error if the method is called in an illegal position and
the `name` parameter is an empty string. | public setAttributes(name: string, value: string): void {
this.checkEmptyParameter(name);
if (this.type !== XmlDynamicType.START_AND_ATTRIBUTES) {
this.checkPosition();
}
let stringBuilder = new StringBuilder(` ${name}=\"`);
this.write... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAttributes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public setAttributes(name: string, value: string): void {
this.checkEmptyParameter(name);
if (this.type !== XmlDynamicType.START_AND_ATTRIBUTES) {
this.checkPosition();
}
let stringBuilder = new StringBuilder(` ${name}=\"`);
this.write... | https://gitcode.com/iop123123/arkts-static-skills | 911f9de15746ce471daf5d319b094f5e8f4002d7 | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LegendRenderer.ets | arkts | drawLabel | Draws the provided label at the given position.
@param c to draw with
@param x
@param y
@param label the label to draw | protected drawLabel(x : number, y : number, label : string): Paint {
let textPaint : TextPaint = new TextPaint(this.mLegendLabelPaint as TextPaint);
textPaint.setText(label);
textPaint.setX(x);
textPaint.setY(y);
return textPaint;
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | protected drawLabel(x : number, y : number, label : string): Paint {
let textPaint : TextPaint = new TextPaint(this.mLegendLabelPaint as TextPaint);
textPaint.setText(label);
textPaint.setX(x);
textPaint.setY(y);
return textPaint;
} | https://gitee.com/openharmony/developtools_profiler.git | fce31b525fc55e541e1e96395435593c4996ddff | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getGranularity | @return the minimum interval between axis values | public getGranularity(): number {
return this.mGranularity;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGranularity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#... | public getGranularity(): number {
return this.mGranularity;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 2c1dac3a994467ac6123f4dc0206a8db0714570d | gitee |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/AccountKitService.ets | arkts | saveCredential | 保存登录凭据 (LoginPage 成功后调用) | saveCredential(cred: CredentialParams): void {
this.credential = {
unionID: cred.unionID,
openID: cred.openID,
authorizationCode: cred.authorizationCode,
idToken: cred.idToken,
accessToken: '',
refreshToken: '',
tokenExpiresAt: 0,
displayName: cred.displayName || ''... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left saveCredential AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cred AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CredentialParams AST#identifier#Right AST... | saveCredential(cred: CredentialParams): void {
this.credential = {
unionID: cred.unionID,
openID: cred.openID,
authorizationCode: cred.authorizationCode,
idToken: cred.idToken,
accessToken: '',
refreshToken: '',
tokenExpiresAt: 0,
displayName: cred.displayName || ''... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | f9fd6b80a368ce2f609c9f9ab6d1d036188028e9 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | setDefaultEncoding | Set the default encoding mode.
@param { string } [encoding] - Encoding type.Default: utf8.
@returns { boolean } Setting successful returns true, setting failed returns false.
@throws { BusinessError } 401 - Parameter error. Possible causes:
1.Mandatory parameters are left unspecified;
2.Incorrect parameter types;
3.Par... | setDefaultEncoding(encoding?: string): boolean {
return this._writable.setDefaultEncoding(encoding);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDefaultEncoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encoding AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#... | setDefaultEncoding(encoding?: string): boolean {
return this._writable.setDefaultEncoding(encoding);
} | https://gitcode.com/iop123123/arkts-static-skills | f75f7ed6240d576a7998d67da08799521f2bd5d2 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets | arkts | getWarnings | 获取性能警告 | public getWarnings(): PerformanceWarning[] {
const result: PerformanceWarning[] = [];
for (let i = 0; i < this.warnings.length; i++) {
result.push(this.warnings[i]);
}
return result;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWarnings 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 Performanc... | public getWarnings(): PerformanceWarning[] {
const result: PerformanceWarning[] = [];
for (let i = 0; i < this.warnings.length; i++) {
result.push(this.warnings[i]);
}
return result;
} | https://github.com/DaLongZhuaZi/manxia | 20f4e047660202c83e4dc0d50f42490f293039d2 | github |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/features/mydemo/src/main/ets/RDB/view/RDBView.ets | arkts | createDB | 创建数据库 | createDB(): void {
// 数据库配置
const storeConfig: relationalStore.StoreConfig = {
// 数据库文件名
name: 'Contacts.db',
// 数据库安全级别
securityLevel: relationalStore.SecurityLevel.S1
}
// 建表Sql语句
const SQL_CREATE_TABLE =
'CREATE TABLE IF NOT EXISTS Contact (id INTEGER PRIMARY KEY A... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createDB 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#Lef... | createDB(): void {
// 数据库配置
const storeConfig: relationalStore.StoreConfig = {
// 数据库文件名
name: 'Contacts.db',
// 数据库安全级别
securityLevel: relationalStore.SecurityLevel.S1
}
// 建表Sql语句
const SQL_CREATE_TABLE =
'CREATE TABLE IF NOT EXISTS Contact (id INTEGER PRIMARY KEY A... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 429057e2ed4cd942361a8c1d1bdaa09705af76ae | gitcode |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | getCurrentCacheSize | 获取磁盘或者内存已用空间大小(字节)
@param cacheStrategy 指定需要查询类型。CacheStrategy.FILE为查询文件缓存,其余枚举为查询内存缓存
@param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存
@returns 文件或者内存已用空间大小,获取文件缓存已用空间返回值为-1时,文件缓存初始化未完成获取不到结果 | getCurrentCacheSize(cacheStrategy : CacheStrategy, cacheName?:string): number | undefined {
return nativeNode.getCurrentCacheSize(cacheStrategy, cacheName);
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentCacheSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheStrategy AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left C... | getCurrentCacheSize(cacheStrategy : CacheStrategy, cacheName?:string): number | undefined {
return nativeNode.getCurrentCacheSize(cacheStrategy, cacheName);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L240-L242 | e40b3b87dc4d242b7be85ac3405c611c0109c427 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets | arkts | $_iterator | Returns an iterator for the list.
@returns An iterator for the list. | public override $_iterator(): IterableIterator<T> {
return new LinkedListIterator_T<T>(this.head);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left $_iterator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public override $_iterator(): IterableIterator<T> {
return new LinkedListIterator_T<T>(this.head);
} | https://gitcode.com/iop123123/arkts-static-skills | 4e67dfef9bafcc350a63854293d13ae0fda4d1a5 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_complement/bitwise_complement_byte.ets | arkts | main | ---
desc: check bitwise complement of byte
--- | function main(): void {
const v: byte = {{v.value}}
assert ~(v) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const v: byte = {{v.value}}
assert ~(v) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c9e9b5601c8fb7a955ef62d0891862dc0341c981 | gitee |
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/datasource/network/agc/FuncNetwork.ets | arkts | getTopics | ************************************* TOPIC *****************************************
Get Topic List by the userid.
@param userId
@returns | public getTopics(userId: string): Promise<Topic[]> {
let params: UserIdParams = { userId };
return new Promise((resolve: (value: Topic[] | PromiseLike<Topic[]>) => void,
reject: (reason?: Object) => void) => {
Request.call(Triggers.TOPICS, params).then((result: Object) => {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTopics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | public getTopics(userId: string): Promise<Topic[]> {
let params: UserIdParams = { userId };
return new Promise((resolve: (value: Topic[] | PromiseLike<Topic[]>) => void,
reject: (reason?: Object) => void) => {
Request.call(Triggers.TOPICS, params).then((result: Object) => {
... | https://github.com/who7708/harmonyos-codelabs | 0ce685cebae268628aaaaf66652e8b5fd6daec92 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies all elements of arr to the current BigInt64Array starting from insertPos.
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
@param { FixedArray<BigInt> } arr - array to copy data from
@param { int } insertPos - start index where data from arr will be inserted... | public set(arr: FixedArray<BigInt>, insertPos: int): void {
const offset = insertPos
if (offset < 0 || offset + arr.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < arr.length; ++i) {
this.setUnsafe(offset + i, a... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public set(arr: FixedArray<BigInt>, insertPos: int): void {
const offset = insertPos
if (offset < 0 || offset + arr.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < arr.length; ++i) {
this.setUnsafe(offset + i, a... | https://gitcode.com/iop123123/arkts-static-skills | cd53c933bc6aa7c4b0f39ab2de6c7eff70366110 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Int8Array from FixedArray<int>
@param { FixedArray<int> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].toByte())
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].toByte())
}
} | https://gitcode.com/iop123123/arkts-static-skills | 66b77b411fccb542d387bfa2ef4985353206035a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelDataManager.ets | arkts | deleteBooksBatch | 批量删除书籍 | async deleteBooksBatch(bookIds: string[]): Promise<void> {
for (const bookId of bookIds) {
await this.deleteBook(bookId);
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteBooksBatch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookIds AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | async deleteBooksBatch(bookIds: string[]): Promise<void> {
for (const bookId of bookIds) {
await this.deleteBook(bookId);
}
} | https://github.com/DaLongZhuaZi/manxia | b8eaa1204d3dc8854646017b69762704baafa20c | github |
zhubowen-bot/Bowen_ArkWeb_framework | entry/src/main/ets/delegate/IWebDownloadFile.ets | arkts | saveFile | 通用文件保存方法 | protected async saveFile(filePath: string): Promise<void> {
const context = getContext()
const fileName = this.extractFileName(filePath)
const saveOptions = new picker.DocumentSaveOptions()
saveOptions.newFileNames = [fileName]
try {
const documentSaveResult = await new picker.DocumentViewP... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Le... | protected async saveFile(filePath: string): Promise<void> {
const context = getContext()
const fileName = this.extractFileName(filePath)
const saveOptions = new picker.DocumentSaveOptions()
saveOptions.newFileNames = [fileName]
try {
const documentSaveResult = await new picker.DocumentViewP... | https://github.com/zhubowen-bot/Bowen_ArkWeb_framework | a96aafabbc5531c3e98e31f4645c8b90476d2b70 | github |
YDYm233/EasyRandom_HarmonyNextApp | common/SystemUtils/src/main/ets/utils/VibratorManager.ets | arkts | vibrateDoubleTap | 双击反馈 — 两次轻柔短振,模拟双击 | static vibrateDoubleTap(): void {
VibratorManager.logExecution('vibrateDoubleTap');
VibratorManager.vibratePreset(HapticEffect.SOFT, 2, 40, VibrationUsage.TOUCH);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateDoubleTap 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#expre... | static vibrateDoubleTap(): void {
VibratorManager.logExecution('vibrateDoubleTap');
VibratorManager.vibratePreset(HapticEffect.SOFT, 2, 40, VibrationUsage.TOUCH);
} | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 2860194b98e93f16e85c996f6ad3830757bd5b2a | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/SettingsService.ets | arkts | setNotifyNewEpisodes | 设置新单集通知 | async setNotifyNewEpisodes(enabled: boolean): Promise<void> {
this.settings.notifyNewEpisodes = enabled;
await this.saveSettings();
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setNotifyNewEpisodes AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required... | async setNotifyNewEpisodes(enabled: boolean): Promise<void> {
this.settings.notifyNewEpisodes = enabled;
await this.saveSettings();
} | https://github.com/pangpang20/antennaPodHM | e3802ac6c15e535068732267476fbf91319d5912 | github |
IoTAccessControl/ArkTSAnalysis | TestApps/Pedometer/entry/src/main/ets/common/utils/StepsUtil.ets | arkts | putStorageValue | Put preferences value.
@param {string} key
@param {string} value | putStorageValue(key: string, value: string) {
GlobalContext.getContext().getObject('getStepsPreferences')?.then((preferences: preferences.Preferences) => {
preferences.put(key, value).then(() => {
Logger.info(TAG, 'Storage put succeeded, key:' + key);
}).catch((err: Error) => {
Logger.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left putStorageValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Righ... | putStorageValue(key: string, value: string) {
GlobalContext.getContext().getObject('getStepsPreferences')?.then((preferences: preferences.Preferences) => {
preferences.put(key, value).then(() => {
Logger.info(TAG, 'Storage put succeeded, key:' + key);
}).catch((err: Error) => {
Logger.... | https://github.com/IoTAccessControl/ArkTSAnalysis | b70cae995fb22fbd82ef5ec87ac8bb98bda0440b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/StatusEnums.ets | arkts | isFinalStatus | 检查状态是否为终态(不会再变化的状态) | static isFinalStatus(status: MangaStatus | DownloadStatus): boolean {
if (MANGA_STATUS_VALUES.includes(status as MangaStatus)) {
const mangaStatus = status as MangaStatus;
return mangaStatus === MangaStatus.COMPLETED ||
mangaStatus === MangaStatus.CANCELLED;
}
if (DOWNLOAD_S... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isFinalStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressio... | static isFinalStatus(status: MangaStatus | DownloadStatus): boolean {
if (MANGA_STATUS_VALUES.includes(status as MangaStatus)) {
const mangaStatus = status as MangaStatus;
return mangaStatus === MangaStatus.COMPLETED ||
mangaStatus === MangaStatus.CANCELLED;
}
if (DOWNLOAD_S... | https://github.com/DaLongZhuaZi/manxia | 1b320ff32588aea2567d19053e31a64dabc353de | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | registerWindowStageStateMonitor | 设置完全沉浸式模式 - 隐藏所有系统栏
@param uiContext 可选的UIContext,推荐在组件中传入
注册窗口状态变化监听(统一入口)
官方 WindowStageEventType 定义(OpenHarmony @ohos.window):
SHOWN=1, ACTIVE=2, INACTIVE=3, HIDDEN=4, RESUMED=5, PAUSED=6
语义要点:
- HIDDEN: 窗口在后台运行
- INACTIVE/PAUSED: 前台但不可交互(并非后台) | static registerWindowStageStateMonitor(windowStage: window.WindowStage): void {
try {
if (WindowManager.windowStageRef === windowStage && WindowManager.windowStageEventCallback) {
return;
}
WindowManager.unregisterWindowStageStateMonitor();
const callback = (event: window.WindowS... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left registerWindowStageStateMonitor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left ... | static registerWindowStageStateMonitor(windowStage: window.WindowStage): void {
try {
if (WindowManager.windowStageRef === windowStage && WindowManager.windowStageEventCallback) {
return;
}
WindowManager.unregisterWindowStageStateMonitor();
const callback = (event: window.WindowS... | https://github.com/DaLongZhuaZi/manxia | a842a6ebecf09b10d480275ee9d7519dcd0b27d7 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/pages/IntroductionPage.ets | arkts | controlImageScale | Control the image scale.
@param this
@param offset
@param state
@returns real list offset. | controlImageScale(offset: number, state: ScrollState): number {
if (offset > 0 && this.imageHeight > Const.MIN_IMAGE_HEIGHT) {
// Scale down the image by offset.
let offsetHeight = (Math.abs(offset) * Const.FULL_PERCENT_NUMBER) / Number(this.screenHeight);
let heightOffset = this.imageHeight - C... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left controlImageScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Le... | controlImageScale(offset: number, state: ScrollState): number {
if (offset > 0 && this.imageHeight > Const.MIN_IMAGE_HEIGHT) {
// Scale down the image by offset.
let offsetHeight = (Math.abs(offset) * Const.FULL_PERCENT_NUMBER) / Number(this.screenHeight);
let heightOffset = this.imageHeight - C... | https://gitee.com/harmonyos/codelabs.git | 7c81463d6123bfce77c9f6eedd474a770c677a59 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | internal | Returns an iterator for all entries
public | /* public */ internal entries(): MapIterator<Int, Byte> {
let ret: Entry<Int, Byte>[] = new Entry<Int, Byte>[this.length];
for (let i: int = 0; i < this.length; i++) {
ret[i] = new Entry<Int, Byte>(i, this.at(i));
}
return new MapIterator<Int, Byte>(ret);
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#ERROR#Right AST#arguments#... | /* public */ internal entries(): MapIterator<Int, Byte> {
let ret: Entry<Int, Byte>[] = new Entry<Int, Byte>[this.length];
for (let i: int = 0; i < this.length; i++) {
ret[i] = new Entry<Int, Byte>(i, this.at(i));
}
return new MapIterator<Int, Byte>(ret);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 13e23aa16362919591d4d7e3425bb5e3920f8156 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/downloads/classes/meowDawnloada.ets | arkts | statusUpdate | Updates the overall download statuses by examining all the download items in list. | statusUpdate() {
this.totalSize = 0;
this.currentSize = 0;
this.currentSpeed = 0;
for (const meowItem of this.items) {
if (meowItem.state != webview.WebDownloadState.IN_PROGRESS && meowItem.state != webview.WebDownloadState.PAUSED && meowItem.state != webview.WebDownloadState.COMPLETED) {
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left statusUpdate 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 ... | statusUpdate() {
this.totalSize = 0;
this.currentSize = 0;
this.currentSpeed = 0;
for (const meowItem of this.items) {
if (meowItem.state != webview.WebDownloadState.IN_PROGRESS && meowItem.state != webview.WebDownloadState.PAUSED && meowItem.state != webview.WebDownloadState.COMPLETED) {
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 6d431ff7f3254051638a46c27268f69069447850 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GameManager.ets | arkts | refreshRecentGamesMetadata | 刷新最近游戏的元数据
用于更新旧数据中缺失的元数据 | public async refreshRecentGamesMetadata(): Promise<void> {
let updated = false;
for (let i = 0; i < this.recentGames.length; i++) {
const game = this.recentGames[i];
// 如果没有 gameCode,说明缺少元数据,需要刷新
if (!game.gameCode) {
const metadata = await this.getGameMetadata(game.path);
i... | 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 refreshRecentGamesMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression... | public async refreshRecentGamesMetadata(): Promise<void> {
let updated = false;
for (let i = 0; i < this.recentGames.length; i++) {
const game = this.recentGames[i];
// 如果没有 gameCode,说明缺少元数据,需要刷新
if (!game.gameCode) {
const metadata = await this.getGameMetadata(game.path);
i... | https://github.com/richshaw2015/nds | abf081d5070ea4ab37233a34f4a9515e25346cb3 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | setBackground | 设置菜单项背景 (支持资源ID)
@param background 背景颜色或资源ID | public setBackground(background: ColorType): void {
this.background = background;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left background AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left ColorType AS... | public setBackground(background: ColorType): void {
this.background = background;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | b4ef9ab6cb4e77f615be70a50dacdcbc516870a7 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/NavigationErrorHandler.ets | arkts | handle | 处理导航错误
@param error 错误对象
@param url 目标URL | public static handle(error: Error | NavigationError, url: string): void {
// 确定错误类型
const errorType = error instanceof NavigationError
? error.type
: NavigationErrorType.NAVIGATION_FAILED;
// 记录错误日志
NavigationErrorHandler.logError(error, url, errorType);
// 获取用户友好的错误消息
const user... | 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 handle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Ri... | public static handle(error: Error | NavigationError, url: string): void {
// 确定错误类型
const errorType = error instanceof NavigationError
? error.type
: NavigationErrorType.NAVIGATION_FAILED;
// 记录错误日志
NavigationErrorHandler.logError(error, url, errorType);
// 获取用户友好的错误消息
const user... | https://github.com/LJ666-ui/harmony-health-care | 5e768908244ee28df7d72e12c981248e5380e0a9 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/PieDataSet.ets | arkts | isUsingSliceColorAsValueLineColor | This method is deprecated.
Use isUseValueColorForLineEnabled() instead.
@Deprecated | public isUsingSliceColorAsValueLineColor(): boolean {
return this.isUseValueColorForLineEnabled();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isUsingSliceColorAsValueLineColor 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#bool... | public isUsingSliceColorAsValueLineColor(): boolean {
return this.isUseValueColorForLineEnabled();
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 9b32795f373888a101bd5a00b5afb9aa1a979a1f | gitee |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | setTimeUpdateListener | Set time change listening
@param listener | public setTimeUpdateListener(listener: (currentTimeMs: number) => void) {
LogUtil.info(`${TAG} setTimeUpdateListener`);
this.timeUpdateListener = listener;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setTimeUpdateListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expressio... | public setTimeUpdateListener(listener: (currentTimeMs: number) => void) {
LogUtil.info(`${TAG} setTimeUpdateListener`);
this.timeUpdateListener = listener;
} | https://gitee.com/openharmony-sig/applications_clock.git | 26557dbc2e10e99646f9b87bc213285adec17d62 | gitee |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/utils/dateUtils.ets | arkts | normalizeDate | 归一化日期到本地零点,便于天数精度计算
@param d Date对象
@returns 零点的Date对象 | function normalizeDate(d: Date): Date {
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left normalizeDate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left d AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function normalizeDate(d: Date): Date {
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
} | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/utils/dateUtils.ets#L48-L50 | 1aa1541ef313c6b20cce58edf4b4239b2df2f255 | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Column.ets | arkts | build | 渲染布局
@returns {void} 无返回值
@example
ColumnSpaceAroundEnd() { Text("A"); Text("B"); Text("C"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marg... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.SpaceAround,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marg... | https://github.com/Joker-x-dev/CoolMallArkTS | 2489080d5e0d4265c76f9e72c8c02aff9739fc2d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | createTask | 创建新任务 | public createTask(
type: TaskType,
name: string,
executor: TaskExecutor,
options?: BackgroundTaskOptions
): string {
const taskId = generateUUID();
const task: InternalTask = {
id: taskId,
type: type,
name: name,
status: TaskStatus.PENDING,
progress: {
c... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TaskT... | public createTask(
type: TaskType,
name: string,
executor: TaskExecutor,
options?: BackgroundTaskOptions
): string {
const taskId = generateUUID();
const task: InternalTask = {
id: taskId,
type: type,
name: name,
status: TaskStatus.PENDING,
progress: {
c... | https://github.com/DaLongZhuaZi/manxia | 60f2b7d50b91bf6e0e58e1c9814d35134503c612 | github |
erosTeam/NextE | feature/reader/src/main/ets/pages/ReaderPage.ets | arkts | aboutToDisappear | Force-persist on close so the last page survives an unfired debounce (eros_fe saveToStore). | aboutToDisappear(): void {
if (this.params.gid.length > 0) {
GalleryReadProgressSettings.flush(this.hostContext())
}
this.stopAutoRead()
this.unregisterVolumeKeyConsumer()
// Always restore (fires on NavDestination pop, incl. swipe-back) so the wakelock never leaks.
this.setReaderKeepScr... | 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#ERROR#Right AST#expression_statement#Left AST#unary_expressio... | aboutToDisappear(): void {
if (this.params.gid.length > 0) {
GalleryReadProgressSettings.flush(this.hostContext())
}
this.stopAutoRead()
this.unregisterVolumeKeyConsumer()
// Always restore (fires on NavDestination pop, incl. swipe-back) so the wakelock never leaks.
this.setReaderKeepScr... | https://github.com/erosTeam/NextE | b6b027091249a4143d817d130db3abe572104fcd | github |
openharmony-sig/fluttertpc_camerawesome | ohos/ohos/src/main/ets/components/cameraX/CameraState.ets | arkts | setExposureBias | 设置曝光补偿
@param brightness | setExposureBias(brightness: number): void {
Logger.debug(TAG, `setCorrection is called`);
this.session?.setExposureBias(brightness)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setExposureBias AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left brightness AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A... | setExposureBias(brightness: number): void {
Logger.debug(TAG, `setCorrection is called`);
this.session?.setExposureBias(brightness)
} | https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git | ce28a6b1ee045c700ad8352428984b039c40f059 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setFormLineWidth | sets the line width in vp for forms that consist of lines, default 3f
@param size | public setFormLineWidth(size: number): void {
this.mFormLineWidth = size;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFormLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setFormLineWidth(size: number): void {
this.mFormLineWidth = size;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | b024d154c57c94f73f621b5ddc3d92d6b9d4b63d | gitee |
who7708/harmonyos-codelabs | HmosWorld/features/challenge/src/main/ets/components/ChallengeView.ets | arkts | initMap | init map size | initMap(): void {
// Set the map height to the screen height by default.
this.mapHeight = this.mapContainerHeight;
// Calculate the image width based on the image length/width ratio.
this.mapWidth = Const.MAP_REAL_WIDTH / Const.MAP_REAL_HEIGHT * this.mapHeight;
this.ratio = vp2px(this.mapContainer... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | initMap(): void {
// Set the map height to the screen height by default.
this.mapHeight = this.mapContainerHeight;
// Calculate the image width based on the image length/width ratio.
this.mapWidth = Const.MAP_REAL_WIDTH / Const.MAP_REAL_HEIGHT * this.mapHeight;
this.ratio = vp2px(this.mapContainer... | https://github.com/who7708/harmonyos-codelabs | cc72db9b9cf11d59e8f7ccf9136a9a1f01725466 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/OptionGroup.ets | arkts | addOption | Add the specified {@code Option} to this group.
@param option the option to add to this group
@return this option group with the option added | public addOption(option: CliOption): OptionGroup{
// key - option name
// value - the option
this.optionMap.put(option.getKey(), option);
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CliO... | public addOption(option: CliOption): OptionGroup{
// key - option name
// value - the option
this.optionMap.put(option.getKey(), option);
return this;
} | https://gitee.com/openharmony-sig/commons-cli.git | cf5d71d174abd5e42f21963031166e7cbecbc76e | gitee |
Cool_foolisher1/ArkTSRepository | ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/component/lazyforeach/LazyForEachPage.ets | arkts | unregisterDataChangeListener | 为对应的LazyForEach组件在数据源处去除监听器
@param listener 监听器 | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
console.info('remove listener')
this.listeners.splice(pos, 1)
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#... | unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener)
if (pos >= 0) {
console.info('remove listener')
this.listeners.splice(pos, 1)
}
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 31cb9627163ce63a764f7e8939bf8b0116e4239d | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/DemoDataService.ets | arkts | seedNotifications | ---------------- 通知数据填充 ---------------- | private static async seedNotifications(userId: number) {
try {
const existingNotifications = await NotificationDAO.getByUserId(userId, 1);
if (existingNotifications.length > 0) {
console.info('[DemoDataService] 通知数据已存在,跳过生成');
return;
}
const now = new Date();
// 系统... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left seedNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le... | private static async seedNotifications(userId: number) {
try {
const existingNotifications = await NotificationDAO.getByUserId(userId, 1);
if (existingNotifications.length > 0) {
console.info('[DemoDataService] 通知数据已存在,跳过生成');
return;
}
const now = new Date();
// 系统... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 62fdcb47de9383b899a480d4664bd7369f8ee9ad | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/AudioManager.ets | arkts | previous | 播放上一首 | async previous(): Promise<void> {
if (this.playlist.length === 0) return;
if (this.isRandom) {
// 随机播放模式
this.currentIndex = Math.floor(Math.random() * this.playlist.length);
} else {
// 顺序播放或列表循环
this.currentIndex = this.currentIndex > 0 ?
this.currentIndex - 1 :
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left previous AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#... | async previous(): Promise<void> {
if (this.playlist.length === 0) return;
if (this.isRandom) {
// 随机播放模式
this.currentIndex = Math.floor(Math.random() * this.playlist.length);
} else {
// 顺序播放或列表循环
this.currentIndex = this.currentIndex > 0 ?
this.currentIndex - 1 :
... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | d690f878efe725f9157cb055e91143899b63f785 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/OverlayStore.ets | arkts | publishFeedback | -- Feedback -- | public static publishFeedback(widget: CountlyFeedbackWidget, url: string, immersive: boolean): void {
AppStorage.SetOrCreate<string>(OverlayKeys.FEEDBACK_URL, url);
AppStorage.SetOrCreate<string>(OverlayKeys.FEEDBACK_TYPE, widget.type);
AppStorage.SetOrCreate<string>(OverlayKeys.FEEDBACK_WIDGET_ID, widget... | 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 publishFeedback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left widget AST#identifier#Right AST#:#Left ... | public static publishFeedback(widget: CountlyFeedbackWidget, url: string, immersive: boolean): void {
AppStorage.SetOrCreate<string>(OverlayKeys.FEEDBACK_URL, url);
AppStorage.SetOrCreate<string>(OverlayKeys.FEEDBACK_TYPE, widget.type);
AppStorage.SetOrCreate<string>(OverlayKeys.FEEDBACK_WIDGET_ID, widget... | https://github.com/Countly/countly-sdk-hos | 02f9d9682d0deed0d004fa706fe475c7b90c2b63 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets | arkts | index | Getters and setters for each property | public set index(i: int) { this._index = i; } | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | public set index(i: int) { this._index = i; } | https://gitcode.com/iop123123/arkts-static-skills | ca51f17f7fb94bc28aac6331a6a348a68ecbdc2a | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/navigation/TabsDemo.ets | arkts | build | Tabs - 页签导航
barPosition - 页签栏的位置
BarPosition.Start - 在顶部或左侧
BarPosition.End - 在底部或右侧
index - 当前选中的页签的索引位置
controller - 绑定的 TabsController 对象
vertical() - 页签栏中的页签是垂直排列还是水平排列
scrollable() - 是否允许在内容区通过滑动手势切换页签
barMode() - 页签栏的布局模式(BarMode 枚举)
Fixed - 页签栏不可滚动,每个页签的宽度会被平均分配
Scrollable - 每个页签的宽度由其内容决定,如果显示不下则页签栏可滚动
barWidth(... | build() {
Column({space:10}) {
Text(this.message)
Button(`vertical:${this.vertical}`).onClick(() => {
this.vertical = !this.vertical
})
Button(`controller.changeIndex(1)`).onClick(() => {
// 通过 TabsController 切换到指定索引位置的页签
this.controller.changeIndex(1)
})
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Column({space:10}) {
Text(this.message)
Button(`vertical:${this.vertical}`).onClick(() => {
this.vertical = !this.vertical
})
Button(`controller.changeIndex(1)`).onClick(() => {
// 通过 TabsController 切换到指定索引位置的页签
this.controller.changeIndex(1)
})
... | https://github.com/webabcd/HarmonyDemo | 30941e515222f29372b9bdc6f9b1f61e5ea886e0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | getCachedChapterIndexes | 获取已缓存的章节索引列表(扫描chapters目录) | async getCachedChapterIndexes(bookId: string, totalChapters: number): Promise<Set<number>> {
const cachedIndexes = new Set<number>();
try {
// 确保缓存目录已初始化
await this.ensureInitialized();
const maxIndex = totalChapters > 0 ? totalChapters : Number.MAX_SAFE_INTEGER;
const candidateBookId... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCachedChapterIndexes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AS... | async getCachedChapterIndexes(bookId: string, totalChapters: number): Promise<Set<number>> {
const cachedIndexes = new Set<number>();
try {
// 确保缓存目录已初始化
await this.ensureInitialized();
const maxIndex = totalChapters > 0 ? totalChapters : Number.MAX_SAFE_INTEGER;
const candidateBookId... | https://github.com/DaLongZhuaZi/manxia | d7b0e57c55d69350dcc5d8a80855f19e601a16ed | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/GlobalContext.ets | arkts | clearContext | 清除上下文 | static clearContext(): void {
GlobalContextStore.context = null;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressio... | static clearContext(): void {
GlobalContextStore.context = null;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6f267e331b4d9c44f34235ca2bf4dc9c47303436 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/OneDriveManager.ets | arkts | importFromVMShared | 从 VM 的 OneDrive 导入文件到鸿蒙沙箱
用户需要先在 VM 里把文件复制到共享文件夹 | public async importFromVMShared(vmName: string, fileName: string): Promise<boolean> {
try {
console.info(`[OneDriveManager] Importing ${fileName} from VM ${vmName}`);
// 从 VM 共享目录复制到 OneDrive 缓存
const success = await this.driveManager.copyFromVMSharedToOneDrive(vmName, fileName);
... | 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 importFromVMShared AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Lef... | public async importFromVMShared(vmName: string, fileName: string): Promise<boolean> {
try {
console.info(`[OneDriveManager] Importing ${fileName} from VM ${vmName}`);
// 从 VM 共享目录复制到 OneDrive 缓存
const success = await this.driveManager.copyFromVMSharedToOneDrive(vmName, fileName);
... | https://github.com/AetheriumSimulator/qemu-hmos | e9f66a34da0d5dfc2fb848201678d0ac63dac7af | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | setPlayMode | Set music play mode (order, shuffle, repeat, etc.).
@param playMode Target play mode. | public setPlayMode(playMode: MusicPlayMode) {
this.playMode = playMode;
Logger.info(TAG, 'setPlayMode mode: ' + this.playMode);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPlayMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left playMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public setPlayMode(playMode: MusicPlayMode) {
this.playMode = playMode;
Logger.info(TAG, 'setPlayMode mode: ' + this.playMode);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 6452957dc5e128a3961ccdc2fdebfe4e8a5c8600 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/algorithm/Algorithm.ets | arkts | calculateElapsedDays | Calculate elapsed days since last review | calculateElapsedDays(lastReviewMs: number): number {
const now = Date.now();
const elapsedMs = now - lastReviewMs;
return elapsedMs / (24 * 60 * 60 * 1000);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateElapsedDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lastReviewMs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#L... | calculateElapsedDays(lastReviewMs: number): number {
const now = Date.now();
const elapsedMs = now - lastReviewMs;
return elapsedMs / (24 * 60 * 60 * 1000);
} | https://github.com/CLMC2025/Vignette | 5908530c4e8a808008de5be5938ffdeb18c9b6c1 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets | arkts | tickLocal | 本地 fallback 模式:PID 式控制器 | private async tickLocal(stats: StreamStats): Promise<void> {
const now = Date.now();
const cooldown = this.mode === 'lowLatency' ? 1500 : 2000;
// 防抖:调整后冷却期
if (now - this.lastAdjustTime < cooldown) return;
let newBitrate = this.currentBitrate;
let reason = '';
const sceneMitigation = t... | 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 tickLocal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stats AST#identifier#Right AST#:#Left : AST... | private async tickLocal(stats: StreamStats): Promise<void> {
const now = Date.now();
const cooldown = this.mode === 'lowLatency' ? 1500 : 2000;
// 防抖:调整后冷却期
if (now - this.lastAdjustTime < cooldown) return;
let newBitrate = this.currentBitrate;
let reason = '';
const sceneMitigation = t... | https://github.com/AlkaidLab/moonlight-harmony | 2fedb7e99427ef4a129639adf237c8e916feb848 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | operatorModule | Calculates the remainder of division of this BigInt by another.
@param { BigInt } other The divisor.
@returns { BigInt } The remainder.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public operatorModule(other: BigInt): BigInt {
return (this.operatorDivideInternal(other))[1]
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorModule 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 ... | public operatorModule(other: BigInt): BigInt {
return (this.operatorDivideInternal(other))[1]
} | https://gitcode.com/iop123123/arkts-static-skills | 24391a556b44dc9ef88638a26342a86a00ee1c15 | gitcode |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | getRomHeaderChecksum | 获取 ROM Header CRC32 校验和
对齐 Android Crc32.compute(romHeader)
@returns 8 位大写 hex 字符串(如 "B126A7EF"),失败返回空字符串 | static getRomHeaderChecksum(romPath: string): string {
return MelonDSNative.native.getRomHeaderChecksum(romPath);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRomHeaderChecksum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left romPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | static getRomHeaderChecksum(romPath: string): string {
return MelonDSNative.native.getRomHeaderChecksum(romPath);
} | https://github.com/richshaw2015/nds | ba6d3cc83d0f26b9bce81e1d257798360df18985 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/allowPass.ets | arkts | fn21 | Works because Foo is a local type | function fn21(arg: Foo) {} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fn21 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ty... | function fn21(arg: Foo) {} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 85e5a412039252944eb24b937dfea4f1216ddef6 | github |
arkui-x/samples | CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets | arkts | startAnimateTo | 选择的省市区名下方的下滑线动画
@param duration 动画时长
@param leftMargin 下划线动画偏移量 | startAnimateTo(duration: number, leftMargin: number) {
animateTo({
duration: duration, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal // 动画模式
}, () => {
this.leftMargin = leftMargin;
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAnimateTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AS... | startAnimateTo(duration: number, leftMargin: number) {
animateTo({
duration: duration, // 动画时长
curve: Curve.Linear, // 动画曲线
iterations: 1, // 播放次数
playMode: PlayMode.Normal // 动画模式
}, () => {
this.leftMargin = leftMargin;
})
} | https://gitcode.com/arkui-x/samples | 275437e22ff65cdace5e1d6f8bdacb1223a0c8db | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/pages/TitleWindowPage.ets | arkts | subscribeCallBack | 订阅公共事件回调 | function subscribeCallBack(err, data) {
if (data.data == '') {
} else {
console.error('subscriberCurData:' + data.data);
that.tIndexInfo = JSON.parse(data.data)
globalThis.cpu0Frequency = that.tIndexInfo.cpu0Frequency
globalThis.cpu1Frequency = that.tIndexInfo.cpu1Frequen... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left subscribeCallBack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left err AST#identifier#Right AST#required_parameter#Right AST#,#Left , A... | function subscribeCallBack(err, data) {
if (data.data == '') {
} else {
console.error('subscriberCurData:' + data.data);
that.tIndexInfo = JSON.parse(data.data)
globalThis.cpu0Frequency = that.tIndexInfo.cpu0Frequency
globalThis.cpu1Frequency = that.tIndexInfo.cpu1Frequen... | https://gitee.com/openharmony/developtools_profiler.git | 5ed7f8bdbddb50b3cff70291c9c161be2370901c | gitee |
openharmony/codelabs | ETSUI/AccountApp/entry/src/main/ets/utils/PreferenceUtil.ets | arkts | saveLoginInfo | --- 自动登录相关 --- | async saveLoginInfo(userId: number, username: string): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put(PreferenceUtil.KEY_CURRENT_USER_ID, userId);
await this.preferences.put(PreferenceUtil.KEY_CURRENT_USERNAME, username);
await this.preferences.flush();
}... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveLoginInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left user... | async saveLoginInfo(userId: number, username: string): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put(PreferenceUtil.KEY_CURRENT_USER_ID, userId);
await this.preferences.put(PreferenceUtil.KEY_CURRENT_USERNAME, username);
await this.preferences.flush();
}... | https://gitcode.com/openharmony/codelabs | 69858634b8a9a564f0813bf63e775fa39b1bfdf6 | gitcode |
XHXYT/Pixark | entry/src/main/ets/services/MockData.ets | arkts | getSpotlight | 模拟:获取亮点文章 (HomeViewModel 用) | static async getSpotlight(): Promise<SpotlightResponse> {
await MockData.delay();
const articles: SpotlightArticle[] = [];
for (let i = 0; i < 5; i++) {
articles.push({
id: 4000 + i,
title: `第 ${i + 1} 期 Pixiv 亮点文章`,
pure_title: `第 ${i + 1} 期 Pixiv 亮点文章`,
thumbnail: ... | 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 getSpotlight 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 getSpotlight(): Promise<SpotlightResponse> {
await MockData.delay();
const articles: SpotlightArticle[] = [];
for (let i = 0; i < 5; i++) {
articles.push({
id: 4000 + i,
title: `第 ${i + 1} 期 Pixiv 亮点文章`,
pure_title: `第 ${i + 1} 期 Pixiv 亮点文章`,
thumbnail: ... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/services/MockData.ets#L110-L132 | a5d5cc2122097e26d0580cb167e0fb76fb97be1b | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | setWebLineWidth | Sets the width of the web lines that come from the center.
@param width | public setWebLineWidth(width: number): void {
this.mWebLineWidth = Utils.handleDataValues(width);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWebLineWidth 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... | public setWebLineWidth(width: number): void {
this.mWebLineWidth = Utils.handleDataValues(width);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 978bf0673beb9a15fa56b67eff4cf765eee2b68e | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/BookOfMoeScraper.ets | arkts | search | 搜索书籍(通用方法) | public async search(keyword: string): Promise<ScraperSearchResult> {
// 检查是否是ISBN格式
const isbnPattern = /^[\d\-X]{10,17}$/i;
if (isbnPattern.test(keyword.replace(/[\s\-]/g, ''))) {
return this.searchByIsbn(keyword);
}
return this.searchByTitle(keyword);
} | 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 search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public async search(keyword: string): Promise<ScraperSearchResult> {
// 检查是否是ISBN格式
const isbnPattern = /^[\d\-X]{10,17}$/i;
if (isbnPattern.test(keyword.replace(/[\s\-]/g, ''))) {
return this.searchByIsbn(keyword);
}
return this.searchByTitle(keyword);
} | https://github.com/DaLongZhuaZi/manxia | a90960278d60835fb49310b1c27fc8f186e30ebe | github |
Xiwei753/xiezuoruanjian | apps/harmony/entry/src/main/ets/bridge/MockWriterCoreBridge.ets | arkts | resolveLayout | Layout Policy methods — 委托给 LayoutPolicyHelper 纯函数 | resolveLayout(metrics: WindowMetrics): Promise<ResultEnvelope<LayoutPlan>> {
const plan = resolveLayoutFromMetrics(metrics)
return Promise.resolve({
success: true,
data: plan,
warnings: [] as string[],
changedPaths: [] as string[],
changedEntities: [] as ChangedEntity[]
} as ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resolveLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metrics AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WindowMetrics AST#identifier#Right AST#... | resolveLayout(metrics: WindowMetrics): Promise<ResultEnvelope<LayoutPlan>> {
const plan = resolveLayoutFromMetrics(metrics)
return Promise.resolve({
success: true,
data: plan,
warnings: [] as string[],
changedPaths: [] as string[],
changedEntities: [] as ChangedEntity[]
} as ... | https://github.com/Xiwei753/xiezuoruanjian | cdcb708ca6fe4f4039d665e68601d8e7a8bb5e66 | github |
openharmony/applications_dlp_manager | entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets | arkts | unLoadOpeningDialogNormal | viewAbility正常结束 | public async unLoadOpeningDialogNormal(): Promise<void> {
this.printAllDecryptingMap();
this._isChargeDecrypting = false;
const isDecrypting = this._decryptingMap.size > 0;
HiLog.info(TAG, `OpeningDialogManager unLoadOpeningDialogNormal isDecrypting ${isDecrypting}`);
if (isDecrypting) {
HiL... | 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 unLoadOpeningDialogNormal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#... | public async unLoadOpeningDialogNormal(): Promise<void> {
this.printAllDecryptingMap();
this._isChargeDecrypting = false;
const isDecrypting = this._decryptingMap.size > 0;
HiLog.info(TAG, `OpeningDialogManager unLoadOpeningDialogNormal isDecrypting ${isDecrypting}`);
if (isDecrypting) {
HiL... | https://gitee.com/openharmony/applications_dlp_manager.git | 34a723783b1534e4520c82daeb5f7f97b252f483 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets | arkts | getPageContent | 获取页面内容 | private async getPageContent(): Promise<string> {
return await this.executeJavaScript<string>('document.documentElement.outerHTML');
} | 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 getPageContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async getPageContent(): Promise<string> {
return await this.executeJavaScript<string>('document.documentElement.outerHTML');
} | https://github.com/DaLongZhuaZi/manxia | 911b737f759020ad1ba0edd685b6fca46946d9ad | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/VideosApi.ets | arkts | getAdditionalPart | getAdditionalPart
@summary Gets additional parts for a video.
@param {VideosApiGetAdditionalPartRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof VideosApi | public async getAdditionalPart(requestParameters: VideosApiGetAdditionalPartRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Videos/${requestParameters.itemId}/AdditionalParts`, parameters: requestParameters, excludeParams: ['itemId']})
... | 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 getAdditionalPart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right... | public async getAdditionalPart(requestParameters: VideosApiGetAdditionalPartRequest): Promise<BaseItemDtoQueryResult> {
this.assertParam(requestParameters.itemId)
return this.apiClient.get({path: `/Videos/${requestParameters.itemId}/AdditionalParts`, parameters: requestParameters, excludeParams: ['itemId']})
... | https://github.com/OHPG/FinSdk | a846ca656996e7a6159710886b1b60c2691a5046 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/RDPDisplay.ets | arkts | isConnected | 检查是否已连接 | isConnected(): boolean {
return this.state === RDPConnectionState.CONNECTED
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isConnected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme... | isConnected(): boolean {
return this.state === RDPConnectionState.CONNECTED
} | https://github.com/AetheriumSimulator/qemu-hmos | c11fa763669debe374ebd3c60d94d59a8d99bca9 | github |
ZestBox-18/kitebook-frontend | features/home/src/main/ets/utils/HomeIndexCalculator.ets | arkts | getRemainingDaysOfMonth | 计算本月剩余天数,用于预算卡展示。 | private static getRemainingDaysOfMonth(): number {
const now = new Date();
const lastDay: number = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
const remainingDays: number = lastDay - now.getDate() + 1;
return remainingDays > 0 ? remainingDays : 1;
} | 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 getRemainingDaysOfMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio... | private static getRemainingDaysOfMonth(): number {
const now = new Date();
const lastDay: number = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate();
const remainingDays: number = lastDay - now.getDate() + 1;
return remainingDays > 0 ? remainingDays : 1;
} | https://github.com/ZestBox-18/kitebook-frontend | acec1bec949eb887ea75e692f37d2b1bfa4f5f43 | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | relationsContact | The relation information of the contact is saved to the database.
@param {Object} addParams Contact Information
@param {string} DAHelper Database path
@param {number} result Contact ID
@param {string} uri Database address | relationsContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
if (!ArrayUtil.isEmpty(addParams.relationships)) {
let index = 1;
addParams.relationships.forEach(element => {
if (StringUtil.isEmpty(element.name)) {
return;
}
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left relationsContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#ide... | relationsContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) {
if (!ArrayUtil.isEmpty(addParams.relationships)) {
let index = 1;
addParams.relationships.forEach(element => {
if (StringUtil.isEmpty(element.name)) {
return;
}
... | https://gitee.com/openharmony/applications_contacts.git | 7652be5907c32b831296409e9ff9c3bf53c2f607 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/AppSettingsService.ets | arkts | setCurrencySymbol | 设置货币符号 | static async setCurrencySymbol(symbol: CurrencySymbol): Promise<void> {
console.log(`[AppSettingsService] setCurrencySymbol called with: ${symbol}`);
await AppSettingsService.ensureInitialized();
await AppSettingsService.preferencesInstance!.put(KEY_CURRENCY, symbol);
await AppSettingsService.preferen... | 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 setCurrencySymbol AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left symbol AST#identifier#Right AST#:#Left... | static async setCurrencySymbol(symbol: CurrencySymbol): Promise<void> {
console.log(`[AppSettingsService] setCurrencySymbol called with: ${symbol}`);
await AppSettingsService.ensureInitialized();
await AppSettingsService.preferencesInstance!.put(KEY_CURRENCY, symbol);
await AppSettingsService.preferen... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | d348109787b811b75b6bd85bd083a687b54a8530 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | reportAddressBarFocus | Called after focusing the adress bar, to synchronize the statuses in this meowUiHost. | reportAddressBarFocus() {
clearTimeout(this.addressBarBlurTimeoutId);
if (!this.addressBarFocused) {
animateToImmediately(defaultAnimation(), () => {
this.addressBarFocused = true;
});
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reportAddressBarFocus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | reportAddressBarFocus() {
clearTimeout(this.addressBarBlurTimeoutId);
if (!this.addressBarFocused) {
animateToImmediately(defaultAnimation(), () => {
this.addressBarFocused = true;
});
}
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | f1850640592033cdb0802e5dcae32488e39bcee4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | fromCodePoint | The String.fromCodePoint() static method returns a string created by using the specified sequence of code points. | public static fromCodePoint(/* ... */ cp: number[]): String {
throw new Error("not implemented")
} | 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 fromCodePoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#comment#Left /* ... */ AST#comment#Right AST#ERROR#Left AST#identifier#L... | public static fromCodePoint(/* ... */ cp: number[]): String {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fc2ff4a5211f5c213f64da1642ac70a6b776c998 | gitee |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/SocialListSettings.ets | arkts | ensureFavorites | ============== Favorites ============== | ensureFavorites(): void {
if (this.favoritesLoaded || !this.ctx.auth!.isAuthenticated) return
const hasCache = this.ctx.state.favorites.length > 0
if (hasCache) {
this.favoritesLoaded = true
}
setTimeout(async () => {
await this.doRefreshFavorites()
}, hasCache ? REFRESH_DELAY : 0)... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ensureFavorites 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#{#Left { AST#{#Right AST#pro... | ensureFavorites(): void {
if (this.favoritesLoaded || !this.ctx.auth!.isAuthenticated) return
const hasCache = this.ctx.state.favorites.length > 0
if (hasCache) {
this.favoritesLoaded = true
}
setTimeout(async () => {
await this.doRefreshFavorites()
}, hasCache ? REFRESH_DELAY : 0)... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/SocialListSettings.ets#L60-L69 | 44ec5b2cd02d1a4a1edf1b9294c41fc57f732694 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/EventChannel.ets | arkts | setStreamHandler | Registers a stream handler on this channel.
<p>Overrides any existing handler registration for (the name of) this channel.
<p>If no handler has been registered, any incoming stream setup requests will be handled
silently by providing an empty stream.
@param handler a {@link StreamHandler}, or null to deregister. | setStreamHandler(handler: StreamHandler): void {
// We call the 2 parameter variant specifically to avoid breaking changes in
// mock verify calls.
// See https://github.com/flutter/flutter/issues/92582.
if (this.taskQueue != null) {
this.messenger.setMessageHandler(
this.name, handler =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setStreamHandler AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left handler AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StreamHandler AST#identifier#Right A... | setStreamHandler(handler: StreamHandler): void {
// We call the 2 parameter variant specifically to avoid breaking changes in
// mock verify calls.
// See https://github.com/flutter/flutter/issues/92582.
if (this.taskQueue != null) {
this.messenger.setMessageHandler(
this.name, handler =... | https://gitee.com/openharmony-sig/flutter_engine.git | 5467245c4b0a9b3b2ae2f81fb3bfdc39847d0c74 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ColorTemplate.ets | arkts | createColors | turn an array of resource-colors (contains resource-id integers) into an
array list of actual color integers
@param r
@param colors an integer array of resource id's of colors
@return | public static createColors(colors?: number[]): JArrayList<number> {
let result: JArrayList<number> = new JArrayList<number>();
if (colors) {
for (let i = 0; i < colors.length; i++) {
result.add(colors[i]);
}
}
return result;
} | 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 createColors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colors AST#identifier#Right AST#?#Left ? A... | public static createColors(colors?: number[]): JArrayList<number> {
let result: JArrayList<number> = new JArrayList<number>();
if (colors) {
for (let i = 0; i < colors.length; i++) {
result.add(colors[i]);
}
}
return result;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d75689c3674b5e023592a31605e09cfc84307776 | gitee |
terryma2024/happyword | harmonyos/entry/src/main/ets/models/Question.ets | arkts | isValid | Runtime invariant check. Returns true when the question is well-formed.
Keep this cheap: it runs during QuestionGenerator tests on every generated
question. | isValid(): boolean {
if (this.wordId.length === 0) {
return false;
}
if (this.answer.length === 0) {
return false;
}
if (this.kind === QuestionKind.FillLetter) {
return this.isValidFillLetter();
}
if (this.kind === QuestionKind.FillLetterMedium) {
return this.isVali... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValid 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... | isValid(): boolean {
if (this.wordId.length === 0) {
return false;
}
if (this.answer.length === 0) {
return false;
}
if (this.kind === QuestionKind.FillLetter) {
return this.isValidFillLetter();
}
if (this.kind === QuestionKind.FillLetterMedium) {
return this.isVali... | https://github.com/terryma2024/happyword | 6b1c40e2a70ef119a2e91b51f61d4eee73f87465 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.