2024-05-23 15:17:28 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 Mehdi Benadel <https://mehdibenadel.com>
|
2024-06-12 14:26:35 +00:00
|
|
|
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
|
2024-05-23 15:17:28 +00:00
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-06-12 14:26:35 +00:00
|
|
|
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
|
|
|
|
import { getPtContext, PtContext } from '../contexts/peertube'
|
2024-05-23 15:09:58 +00:00
|
|
|
import { LitElement } from 'lit'
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for all Custom Elements.
|
|
|
|
*/
|
|
|
|
export class LivechatElement extends LitElement {
|
2024-06-12 14:26:35 +00:00
|
|
|
public readonly ptContext: PtContext
|
|
|
|
public readonly ptOptions: RegisterClientOptions
|
|
|
|
public readonly ptTranslate: RegisterClientOptions['peertubeHelpers']['translate']
|
|
|
|
public readonly ptNotifier: RegisterClientOptions['peertubeHelpers']['notifier']
|
2024-06-14 13:07:15 +00:00
|
|
|
public readonly logger: ReturnType<PtContext['logger']['createLogger']>
|
2024-06-12 14:26:35 +00:00
|
|
|
|
|
|
|
constructor () {
|
|
|
|
super()
|
|
|
|
this.ptContext = getPtContext()
|
|
|
|
this.ptOptions = this.ptContext.ptOptions
|
|
|
|
this.ptNotifier = this.ptOptions.peertubeHelpers.notifier
|
|
|
|
this.ptTranslate = this.ptOptions.peertubeHelpers.translate
|
2024-06-14 13:07:15 +00:00
|
|
|
this.logger = this.ptContext.logger.createLogger(this.tagName.toLowerCase())
|
2024-06-12 14:26:35 +00:00
|
|
|
}
|
|
|
|
|
2024-09-10 07:49:21 +00:00
|
|
|
protected override createRenderRoot = (): HTMLElement | DocumentFragment => {
|
2024-05-23 15:09:58 +00:00
|
|
|
return this
|
|
|
|
}
|
|
|
|
}
|