mirror of
https://github.com/tribufu/sdk-js
synced 2025-06-16 02:34:19 +00:00
36 lines
775 B
TypeScript
36 lines
775 B
TypeScript
// Copyright (c) Tribufu. All Rights Reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { TribufuApi } from "./";
|
|
|
|
/**
|
|
* **Tribufu API**
|
|
*
|
|
* Helper class to get a singleton instance of the Tribufu API.
|
|
*/
|
|
export class TribufuApiSingleton {
|
|
private static instance: TribufuApi | null = null;
|
|
|
|
private constructor() {}
|
|
|
|
/**
|
|
* Get the singleton instance of {@link TribufuApi}.
|
|
*
|
|
* @return Singleton instance
|
|
*/
|
|
public static getInstance(): TribufuApi {
|
|
if (!this.instance) {
|
|
this.instance = TribufuApi.fromEnvOrDefault();
|
|
}
|
|
|
|
return this.instance;
|
|
}
|
|
|
|
/**
|
|
* Reset the singleton instance of {@link TribufuApi}.
|
|
*/
|
|
public static resetInstance() {
|
|
this.instance = null;
|
|
}
|
|
}
|