1
/*
2
 * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
 * the License. A copy of the License is located at
6
 *
7
 *     http://aws.amazon.com/apache2.0/
8
 *
9
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
 * and limitations under the License.
12
 */
13
import { XRProvider, ProviderOptions, SceneOptions } from '../types';
14 1
import { ConsoleLogger as Logger } from '@aws-amplify/core';
15

16 1
const logger = new Logger('AbstractXRProvider');
17

18 1
export abstract class AbstractXRProvider implements XRProvider {
19
	private _config: ProviderOptions;
20

21 1
	constructor(options: ProviderOptions = {}) {
22 1
		this._config = options;
23
	}
24

25 1
	configure(config: ProviderOptions = {}): ProviderOptions {
26 1
		this._config = { ...config, ...this._config };
27

28 1
		logger.debug(`configure ${this.getProviderName()}`, this._config);
29

30 1
		return this.options;
31
	}
32

33 1
	getCategory() {
34 1
		return 'XR';
35
	}
36

37
	abstract getProviderName(): string;
38

39 1
	protected get options(): ProviderOptions {
40 1
		return { ...this._config };
41
	}
42

43
	public abstract loadScene(
44
		sceneName: string,
45
		domElementId: string,
46
		sceneOptions: SceneOptions
47
	): void;
48
	public abstract isSceneLoaded(sceneName: string);
49
	public abstract getSceneController(sceneName: string): any;
50
	public abstract isVRCapable(sceneName: string): boolean;
51
	public abstract isVRPresentationActive(sceneName: string): boolean;
52
	public abstract start(sceneName: string): void;
53
	public abstract enterVR(sceneName: string): void;
54
	public abstract exitVR(sceneName: string): void;
55
	public abstract isMuted(sceneName: string): boolean;
56
	public abstract setMuted(sceneName: string, muted: boolean): void;
57
	public abstract onSceneEvent(
58
		sceneName: string,
59
		eventName: string,
60
		eventHandler: Function
61
	): void;
62
	public abstract enableAudio(sceneName: string): void;
63 1
}

Read our documentation on viewing source code .

Loading