mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
事件通知 off 接口维测日志
Co-Authored-By: liuzongze Signed-off-by: liuzongze@h-partners.com <liuzongze@h-partners.com> 🤖 AI[0%] 🔧 Human Fixed[0%] 🧑 Human[100%] 👌 AI Adopted[0%] Change-Id: Iff026fd57f7430988098dbc8413487a072c588c3
This commit is contained in:
@@ -324,6 +324,7 @@ export default class ApplicationContext extends Context {
|
||||
}
|
||||
|
||||
offEnvironment(callbackId: int, callback: AsyncCallback<void>): void {
|
||||
console.log('AbilityKit off environment');
|
||||
this.nativeOffEnvironmentCheck();
|
||||
let myCall = new AsyncCallbackWrapper<void>(callback);
|
||||
taskpool.execute((): void => {
|
||||
@@ -332,6 +333,7 @@ export default class ApplicationContext extends Context {
|
||||
}
|
||||
|
||||
offAbilityLifecycle(callbackId: int, callback: AsyncCallback<void>): void {
|
||||
console.log('AbilityKit off abilityLifecycle');
|
||||
this.nativeOffAbilityLifecycleCheck();
|
||||
let myCall = new AsyncCallbackWrapper<void>(callback);
|
||||
taskpool.execute((): void => {
|
||||
@@ -340,6 +342,7 @@ export default class ApplicationContext extends Context {
|
||||
}
|
||||
|
||||
offEnvironment(callbackId: int): Promise<void> {
|
||||
console.log('AbilityKit off environment');
|
||||
this.nativeOffEnvironmentCheck();
|
||||
let p =
|
||||
new Promise<void>((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => {
|
||||
@@ -358,6 +361,7 @@ export default class ApplicationContext extends Context {
|
||||
}
|
||||
|
||||
offAbilityLifecycle(callbackId: int): Promise<void> {
|
||||
console.log('AbilityKit off abilityLifecycle');
|
||||
this.nativeOffAbilityLifecycleCheck();
|
||||
let p =
|
||||
new Promise<void>((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => {
|
||||
|
||||
@@ -75,6 +75,7 @@ export default class EventHub {
|
||||
}
|
||||
|
||||
off(event: string, callback: Function): void {
|
||||
console.log('AbilityKit eventHub off event: ' + event);
|
||||
this.offByNativeContext(event, callback);
|
||||
if (!this.dynamicContextEventHub) {
|
||||
this.dynamicContextEventHub = this.getDynamicContextEventHub();
|
||||
|
||||
@@ -135,6 +135,7 @@ class EventHub {
|
||||
throw new BusinessError(ERROR_CODE_INVALID_PARAM);
|
||||
return;
|
||||
}
|
||||
console.log('AbilityKit eventHub off event: ' + event);
|
||||
if (this.eventMap[event]) {
|
||||
if (callback) {
|
||||
let cbArray = this.eventMap[event];
|
||||
|
||||
@@ -140,6 +140,7 @@ class EventHub {
|
||||
if (typeof (event) !== 'string') {
|
||||
return;
|
||||
}
|
||||
console.log('AbilityKit eventHub off event: ' + event);
|
||||
if (this.eventMap[event]) {
|
||||
if (callback) {
|
||||
let cbArray = this.eventMap[event];
|
||||
|
||||
@@ -1772,7 +1772,7 @@ napi_value JsApplicationContextUtils::OnOffAbilityLifecycle(
|
||||
"callback is nullptr"));
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "off abilityLifecycle event");
|
||||
if (!callback->UnRegister(callbackId, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
task.Reject(env, CreateJsError(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER,
|
||||
@@ -1852,7 +1852,7 @@ napi_value JsApplicationContextUtils::OnOffInteropAbilityLifecycle(
|
||||
napi_value JsApplicationContextUtils::OnOffAbilityLifecycleEventSync(
|
||||
napi_env env, NapiCallbackInfo& info, int32_t callbackId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "off abilityLifecycleEvent sync");
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
@@ -1920,7 +1920,7 @@ napi_value JsApplicationContextUtils::OnOffEnvironment(
|
||||
return;
|
||||
}
|
||||
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "OnOffEnvironment begin");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "off environment");
|
||||
if (!env_callback->UnRegister(callbackId, false)) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "call UnRegister failed");
|
||||
task.Reject(env, CreateJsError(env, ERR_ABILITY_RUNTIME_EXTERNAL_INVALID_PARAMETER,
|
||||
@@ -1940,7 +1940,7 @@ napi_value JsApplicationContextUtils::OnOffEnvironment(
|
||||
napi_value JsApplicationContextUtils::OnOffEnvironmentEventSync(
|
||||
napi_env env, NapiCallbackInfo& info, int32_t callbackId)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "off environmentEvent sync");
|
||||
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
@@ -1987,7 +1987,7 @@ napi_value JsApplicationContextUtils::OnOnApplicationStateChange(
|
||||
napi_value JsApplicationContextUtils::OnOffApplicationStateChange(
|
||||
napi_env env, NapiCallbackInfo& info)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "called");
|
||||
TAG_LOGI(AAFwkTag::APPKIT, "off applicationStateChange");
|
||||
auto applicationContext = applicationContext_.lock();
|
||||
if (applicationContext == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "null applicationContext");
|
||||
|
||||
Reference in New Issue
Block a user