!267 extension接口返回值变更为Promise<void>

Merge pull request !267 from Mupceet/release_0721_return_type
This commit is contained in:
openharmony_ci 2022-07-27 02:22:32 +00:00 committed by Gitee
commit b248590efa
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 7 deletions

View File

@ -25,11 +25,14 @@ import { GesturePath } from "../@ohos.application.AccessibilityExtensionAbility"
* @syscap SystemCapability.BarrierFree.Accessibility.Core
*/
export default class AccessibilityExtensionContext extends ExtensionContext {
setEventTypeFilter(type: Array<accessibility.EventType>, callback: AsyncCallback<boolean>): boolean;
setEventTypeFilter(type: Array<accessibility.EventType>): Promise<boolean>;
setTargetBundleName(targetNames: Array<string>, callback: AsyncCallback<boolean>): boolean;
setTargetBundleName(targetNames: Array<string>): Promise<boolean>;
setEventTypeFilter(type: Array<accessibility.EventType>, callback: AsyncCallback<void>): void;
setEventTypeFilter(type: Array<accessibility.EventType>): Promise<void>;
/**
* Set the name of the bundle name that is interested in sending the event.
* @param targetNames
*/
setTargetBundleName(targetNames: Array<string>): Promise<void>;
setTargetBundleName(targetNames: Array<string>, callback: AsyncCallback<void>): void;
/**
* Get focus element.

View File

@ -167,7 +167,7 @@ private:
}
bool ret = context->SetEventTypeFilter(filter);
if (ret) {
task.Resolve(engine, engine.CreateBoolean(ret));
task.Resolve(engine, engine.CreateUndefined());
} else {
HILOG_ERROR("set event type failed. ret: %{public}d.", ret);
task.Reject(engine, CreateJsError(engine, RESULT_ERROR, "set event type failed."));
@ -208,7 +208,7 @@ private:
bool ret = context->SetTargetBundleName(targetBundleNames);
if (ret) {
task.Resolve(engine, engine.CreateBoolean(ret));
task.Resolve(engine, engine.CreateUndefined());
} else {
HILOG_ERROR("set target bundle name failed. ret: %{public}d.", ret);
task.Reject(engine, CreateJsError(engine, RESULT_ERROR, "set target bundle name failed."));