• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef INTERFACES_KITS_JS_SRC_MOD_BACKUP_PROPERTIES_GENERAL_CALLBACKS_H
16 #define INTERFACES_KITS_JS_SRC_MOD_BACKUP_PROPERTIES_GENERAL_CALLBACKS_H
17 
18 #include <memory>
19 #include <node_api.h>
20 #include <string>
21 
22 #include "filemgmt_libn.h"
23 
24 namespace OHOS::FileManagement::Backup {
25 class GeneralCallbacks {
26 public:
GeneralCallbacks(const napi_env & env,const LibN::NVal & thisPtr,const LibN::NVal & jsCallbacks)27     GeneralCallbacks(const napi_env &env, const LibN::NVal &thisPtr, const LibN::NVal &jsCallbacks)
28         : onFileReady(env, thisPtr, jsCallbacks.GetProp("onFileReady")),
29           onBundleBegin(env, thisPtr, jsCallbacks.GetProp("onBundleBegin")),
30           onBundleEnd(env, thisPtr, jsCallbacks.GetProp("onBundleEnd")),
31           onAllBundlesEnd(env, thisPtr, jsCallbacks.GetProp("onAllBundlesEnd")),
32           onBackupServiceDied(env, thisPtr, jsCallbacks.GetProp("onBackupServiceDied")) {};
33 
34 public:
35     LibN::NAsyncWorkCallback onFileReady;
36     LibN::NAsyncWorkCallback onBundleBegin;
37     LibN::NAsyncWorkCallback onBundleEnd;
38     LibN::NAsyncWorkCallback onAllBundlesEnd;
39     LibN::NAsyncWorkCallback onBackupServiceDied;
40 };
41 } // namespace OHOS::FileManagement::Backup
42 #endif // INTERFACES_KITS_JS_SRC_MOD_BACKUP_PROPERTIES_GENERAL_CALLBACKS_H