• 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
16let ExtensionContext = requireNapi('application.ExtensionContext');
17
18const ERROR_CODE_INVALID_PARAM = 401;
19const ERROR_MSG_INVALID_PARAM = 'Invalid input parameter.';
20class ParamError extends Error {
21    constructor() {
22        super(ERROR_MSG_INVALID_PARAM);
23        this.code = ERROR_CODE_INVALID_PARAM;
24    }
25}
26
27class MediaControlExtensionContext extends ExtensionContext {
28  constructor(obj) {
29    super(obj);
30  }
31
32  startAbility(want, options, callback) {
33    console.log('startAbility');
34    return this.__context_impl__.startAbility(want, options, callback);
35  }
36
37  terminateSelf(callback) {
38    console.log('terminateSelf');
39    return this.__context_impl__.terminateSelf(callback);
40  }
41
42  terminateSelfWithResult(abilityResult, callback) {
43    console.log('terminateSelfWithResult');
44    return this.__context_impl__.terminateSelfWithResult(abilityResult, callback);
45  }
46}
47
48export default MediaControlExtensionContext;