ref(flow) Remove flow (#13343)

Remove flow-related packages
Remove type annotations from JS files
This commit is contained in:
Robert Pintilii
2023-05-12 16:39:18 +03:00
committed by GitHub
parent ccebccf8e6
commit 6b28af8329
16 changed files with 89 additions and 191 deletions

View File

@@ -1,5 +1,4 @@
// @flow
/* global APP */
import Logger from '@jitsi/logger';
import { createApiEvent } from '../../react/features/analytics/AnalyticsEvents';
@@ -114,7 +113,6 @@ import { setTileView, toggleTileView } from '../../react/features/video-layout/a
import { muteAllParticipants } from '../../react/features/video-menu/actions';
import { setVideoQuality } from '../../react/features/video-quality/actions';
import { toggleWhiteboard } from '../../react/features/whiteboard/actions.any';
import { WhiteboardStatus } from '../../react/features/whiteboard/types';
import { getJitsiMeetTransport } from '../transport';
import {
@@ -125,8 +123,6 @@ import {
const logger = Logger.getLogger(__filename);
declare var APP: Object;
/**
* List of the available commands.
*/
@@ -1035,7 +1031,7 @@ function toggleScreenSharing(enable) {
* @param {MouseEvent} event - The mouse event to sanitize.
* @returns {Object}
*/
function sanitizeMouseEvent(event: MouseEvent) {
function sanitizeMouseEvent(event) {
const {
clientX,
clientY,
@@ -1073,7 +1069,7 @@ function sanitizeMouseEvent(event: MouseEvent) {
* Jitsi Meet.
*/
class API {
_enabled: boolean;
_enabled;
/**
* Initializes the API. Setups message event listeners that will receive
@@ -1108,7 +1104,7 @@ class API {
* otherwise.
* @returns {void}
*/
notifyLargeVideoVisibilityChanged(isHidden: boolean) {
notifyLargeVideoVisibilityChanged(isHidden) {
this._sendEvent({
name: 'large-video-visibility-changed',
isVisible: !isHidden
@@ -1122,7 +1118,7 @@ class API {
* @param {Object} event - The message to pass onto spot.
* @returns {void}
*/
sendProxyConnectionEvent(event: Object) {
sendProxyConnectionEvent(event) {
this._sendEvent({
name: 'proxy-connection-event',
...event
@@ -1135,7 +1131,7 @@ class API {
* @param {Object} event - The event to be sent.
* @returns {void}
*/
_sendEvent(event: Object = {}) {
_sendEvent(event = {}) {
if (this._enabled) {
transport.sendEvent(event);
}
@@ -1148,7 +1144,7 @@ class API {
* @param {boolean} isOpen - True if the chat panel is open.
* @returns {void}
*/
notifyChatUpdated(unreadCount: number, isOpen: boolean) {
notifyChatUpdated(unreadCount, isOpen) {
this._sendEvent({
name: 'chat-updated',
unreadCount,
@@ -1163,7 +1159,7 @@ class API {
* @param {boolean} privateMessage - True if the message was a private message.
* @returns {void}
*/
notifySendingChatMessage(message: string, privateMessage: boolean) {
notifySendingChatMessage(message, privateMessage) {
this._sendEvent({
name: 'outgoing-message',
message,
@@ -1177,7 +1173,7 @@ class API {
* @param {MouseEvent} event - The mousemove event.
* @returns {void}
*/
notifyMouseEnter(event: MouseEvent) {
notifyMouseEnter(event) {
this._sendEvent({
name: 'mouse-enter',
event: sanitizeMouseEvent(event)
@@ -1190,7 +1186,7 @@ class API {
* @param {MouseEvent} event - The mousemove event.
* @returns {void}
*/
notifyMouseLeave(event: MouseEvent) {
notifyMouseLeave(event) {
this._sendEvent({
name: 'mouse-leave',
event: sanitizeMouseEvent(event)
@@ -1203,7 +1199,7 @@ class API {
* @param {MouseEvent} event - The mousemove event.
* @returns {void}
*/
notifyMouseMove(event: MouseEvent) {
notifyMouseMove(event) {
this._sendEvent({
name: 'mouse-move',
event: sanitizeMouseEvent(event)
@@ -1217,7 +1213,7 @@ class API {
* @param {boolean} enabled - Whether or not the new moderation status is enabled.
* @returns {void}
*/
notifyModerationChanged(mediaType: string, enabled: boolean) {
notifyModerationChanged(mediaType, enabled) {
this._sendEvent({
name: 'moderation-status-changed',
mediaType,
@@ -1232,7 +1228,7 @@ class API {
* @param {string} mediaType - Media type for which the participant was approved.
* @returns {void}
*/
notifyParticipantApproved(participantId: string, mediaType: string) {
notifyParticipantApproved(participantId, mediaType) {
this._sendEvent({
name: 'moderation-participant-approved',
id: participantId,
@@ -1247,7 +1243,7 @@ class API {
* @param {string} mediaType - Media type for which the participant was rejected.
* @returns {void}
*/
notifyParticipantRejected(participantId: string, mediaType: string) {
notifyParticipantRejected(participantId, mediaType) {
this._sendEvent({
name: 'moderation-participant-rejected',
id: participantId,
@@ -1263,7 +1259,7 @@ class API {
*
* @returns {void}
*/
notifyNotificationTriggered(title: string, description: string) {
notifyNotificationTriggered(title, description) {
this._sendEvent({
description,
name: 'notification-triggered',
@@ -1277,7 +1273,7 @@ class API {
* @param {number} videoQuality - The video quality. The number represents the maximum height of the video streams.
* @returns {void}
*/
notifyVideoQualityChanged(videoQuality: number) {
notifyVideoQualityChanged(videoQuality) {
this._sendEvent({
name: 'video-quality-changed',
videoQuality
@@ -1292,9 +1288,7 @@ class API {
* @returns {void}
*/
notifyReceivedChatMessage(
{ body, id, nick, privateMessage, ts }: {
body: *, id: string, nick: string, privateMessage: boolean, ts: *
} = {}) {
{ body, id, nick, privateMessage, ts } = {}) {
if (APP.conference.isLocalId(id)) {
return;
}
@@ -1317,7 +1311,7 @@ class API {
* @param {Object} props - The display name of the user.
* @returns {void}
*/
notifyUserJoined(id: string, props: Object) {
notifyUserJoined(id, props) {
this._sendEvent({
name: 'participant-joined',
id,
@@ -1332,7 +1326,7 @@ class API {
* @param {string} id - User id.
* @returns {void}
*/
notifyUserLeft(id: string) {
notifyUserLeft(id) {
this._sendEvent({
name: 'participant-left',
id
@@ -1347,7 +1341,7 @@ class API {
* @param {string} role - The new user role.
* @returns {void}
*/
notifyUserRoleChanged(id: string, role: string) {
notifyUserRoleChanged(id, role) {
this._sendEvent({
name: 'participant-role-changed',
id,
@@ -1363,7 +1357,7 @@ class API {
* @param {string} avatarURL - The new avatar URL of the participant.
* @returns {void}
*/
notifyAvatarChanged(id: string, avatarURL: string) {
notifyAvatarChanged(id, avatarURL) {
this._sendEvent({
name: 'avatar-changed',
avatarURL,
@@ -1378,7 +1372,7 @@ class API {
* @param {Object} data - The event data.
* @returns {void}
*/
notifyEndpointTextMessageReceived(data: Object) {
notifyEndpointTextMessageReceived(data) {
this._sendEvent({
name: 'endpoint-text-message-received',
data
@@ -1392,7 +1386,7 @@ class API {
* @param {string} faceExpression - Detected face expression.
* @returns {void}
*/
notifyFaceLandmarkDetected(faceBox: Object, faceExpression: string) {
notifyFaceLandmarkDetected(faceBox, faceExpression) {
this._sendEvent({
name: 'face-landmark-detected',
faceBox,
@@ -1406,7 +1400,7 @@ class API {
* @param {Object} data - The event data.
* @returns {void}
*/
notifySharingParticipantsChanged(data: Object) {
notifySharingParticipantsChanged(data) {
this._sendEvent({
name: 'content-sharing-participants-changed',
data
@@ -1420,7 +1414,7 @@ class API {
* @param {Object} devices - The new device list.
* @returns {void}
*/
notifyDeviceListChanged(devices: Object) {
notifyDeviceListChanged(devices) {
this._sendEvent({
name: 'device-list-changed',
devices
@@ -1438,8 +1432,8 @@ class API {
* @returns {void}
*/
notifyDisplayNameChanged(
id: string,
{ displayName, formattedDisplayName }: Object) {
id,
{ displayName, formattedDisplayName }) {
this._sendEvent({
name: 'display-name-change',
displayname: displayName,
@@ -1457,8 +1451,8 @@ class API {
* @returns {void}
*/
notifyEmailChanged(
id: string,
{ email }: Object) {
id,
{ email }) {
this._sendEvent({
name: 'email-change',
email,
@@ -1470,10 +1464,10 @@ class API {
* Notify external application (if API is enabled) that the an error has been logged.
*
* @param {string} logLevel - The message log level.
* @param {Array} args - Array of strings composing the log message.
* @param {Array<string>} args - Array of strings composing the log message.
* @returns {void}
*/
notifyLog(logLevel: string, args: Array<string>) {
notifyLog(logLevel, args) {
this._sendEvent({
name: 'log',
logLevel,
@@ -1491,7 +1485,7 @@ class API {
* user and the type of the room.
* @returns {void}
*/
notifyConferenceJoined(roomName: string, id: string, props: Object) {
notifyConferenceJoined(roomName, id, props) {
this._sendEvent({
name: 'video-conference-joined',
roomName,
@@ -1506,7 +1500,7 @@ class API {
* @param {string} roomName - User id.
* @returns {void}
*/
notifyConferenceLeft(roomName: string) {
notifyConferenceLeft(roomName) {
this._sendEvent({
name: 'video-conference-left',
roomName
@@ -1521,7 +1515,7 @@ class API {
*
* @returns {void}
*/
notifyDataChannelClosed(code: number, reason: string) {
notifyDataChannelClosed(code, reason) {
this._sendEvent({
name: 'data-channel-closed',
code,
@@ -1564,7 +1558,7 @@ class API {
* @param {boolean} muted - The new muted status.
* @returns {void}
*/
notifyAudioMutedStatusChanged(muted: boolean) {
notifyAudioMutedStatusChanged(muted) {
this._sendEvent({
name: 'audio-mute-status-changed',
muted
@@ -1578,7 +1572,7 @@ class API {
* @param {boolean} muted - The new muted status.
* @returns {void}
*/
notifyVideoMutedStatusChanged(muted: boolean) {
notifyVideoMutedStatusChanged(muted) {
this._sendEvent({
name: 'video-mute-status-changed',
muted
@@ -1592,7 +1586,7 @@ class API {
* @param {boolean} available - True if available and false otherwise.
* @returns {void}
*/
notifyAudioAvailabilityChanged(available: boolean) {
notifyAudioAvailabilityChanged(available) {
audioAvailable = available;
this._sendEvent({
name: 'audio-availability-changed',
@@ -1607,7 +1601,7 @@ class API {
* @param {boolean} available - True if available and false otherwise.
* @returns {void}
*/
notifyVideoAvailabilityChanged(available: boolean) {
notifyVideoAvailabilityChanged(available) {
videoAvailable = available;
this._sendEvent({
name: 'video-availability-changed',
@@ -1622,7 +1616,7 @@ class API {
* @param {string} id - User id of the new on stage participant.
* @returns {void}
*/
notifyOnStageParticipantChanged(id: string) {
notifyOnStageParticipantChanged(id) {
this._sendEvent({
name: 'on-stage-participant-changed',
id
@@ -1636,7 +1630,7 @@ class API {
* @param {boolean} isVisible - Whether the prejoin video is visible.
* @returns {void}
*/
notifyPrejoinVideoVisibilityChanged(isVisible: boolean) {
notifyPrejoinVideoVisibilityChanged(isVisible) {
this._sendEvent({
name: 'on-prejoin-video-changed',
isVisible
@@ -1670,7 +1664,7 @@ class API {
* @param {string} message - Additional information about the error.
* @returns {void}
*/
notifyOnCameraError(type: string, message: string) {
notifyOnCameraError(type, message) {
this._sendEvent({
name: 'camera-error',
type,
@@ -1686,7 +1680,7 @@ class API {
* @param {string} message - Additional information about the error.
* @returns {void}
*/
notifyOnMicError(type: string, message: string) {
notifyOnMicError(type, message) {
this._sendEvent({
name: 'mic-error',
type,
@@ -1702,7 +1696,7 @@ class API {
* @param {string} error - A failure message, if any.
* @returns {void}
*/
notifyFeedbackSubmitted(error: string) {
notifyFeedbackSubmitted(error) {
this._sendEvent({
name: 'feedback-submitted',
error
@@ -1727,7 +1721,7 @@ class API {
* be displayed or hidden.
* @returns {void}
*/
notifyFilmstripDisplayChanged(visible: boolean) {
notifyFilmstripDisplayChanged(visible) {
this._sendEvent({
name: 'filmstrip-display-changed',
visible
@@ -1744,7 +1738,7 @@ class API {
* other participant.
* @returns {void}
*/
notifyKickedOut(kicked: Object, kicker: Object) {
notifyKickedOut(kicked, kicker) {
this._sendEvent({
name: 'participant-kicked-out',
kicked,
@@ -1773,7 +1767,7 @@ class API {
* share is capturing.
* @returns {void}
*/
notifyScreenSharingStatusChanged(on: boolean, details: Object) {
notifyScreenSharingStatusChanged(on, details) {
this._sendEvent({
name: 'screen-sharing-status-changed',
on,
@@ -1788,7 +1782,7 @@ class API {
* @param {string} id - Id of the dominant participant.
* @returns {void}
*/
notifyDominantSpeakerChanged(id: string) {
notifyDominantSpeakerChanged(id) {
this._sendEvent({
name: 'dominant-speaker-changed',
id
@@ -1802,7 +1796,7 @@ class API {
* @param {string} subject - Conference subject.
* @returns {void}
*/
notifySubjectChanged(subject: string) {
notifySubjectChanged(subject) {
this._sendEvent({
name: 'subject-change',
subject
@@ -1817,7 +1811,7 @@ class API {
* otherwise.
* @returns {void}
*/
notifyTileViewChanged(enabled: boolean) {
notifyTileViewChanged(enabled) {
this._sendEvent({
name: 'tile-view-changed',
enabled
@@ -1830,7 +1824,7 @@ class API {
* @param {string} localStorageContent - The new localStorageContent.
* @returns {void}
*/
notifyLocalStorageChanged(localStorageContent: string) {
notifyLocalStorageChanged(localStorageContent) {
this._sendEvent({
name: 'local-storage-changed',
localStorageContent
@@ -1844,7 +1838,7 @@ class API {
* @param {boolean} handRaised - Whether user has raised hand.
* @returns {void}
*/
notifyRaiseHandUpdated(id: string, handRaised: boolean) {
notifyRaiseHandUpdated(id, handRaised) {
this._sendEvent({
name: 'raise-hand-updated',
handRaised,
@@ -1860,7 +1854,7 @@ class API {
* @param {string} error - Error type or null if success.
* @returns {void}
*/
notifyRecordingStatusChanged(on: boolean, mode: string, error?: string) {
notifyRecordingStatusChanged(on, mode, error) {
this._sendEvent({
name: 'recording-status-changed',
on,
@@ -1877,7 +1871,7 @@ class API {
* @param {number} ttl - The recording download link time to live.
* @returns {void}
*/
notifyRecordingLinkAvailable(link: string, ttl: number) {
notifyRecordingLinkAvailable(link, ttl) {
this._sendEvent({
name: 'recording-link-available',
link,
@@ -1891,7 +1885,7 @@ class API {
* @param {Object} participant - Participant data such as id and name.
* @returns {void}
*/
notifyKnockingParticipant(participant: Object) {
notifyKnockingParticipant(participant) {
this._sendEvent({
name: 'knocking-participant',
participant
@@ -1904,7 +1898,7 @@ class API {
* @param {Object} error - The error.
* @returns {void}
*/
notifyError(error: Object) {
notifyError(error) {
this._sendEvent({
name: 'error-occurred',
error
@@ -1918,7 +1912,7 @@ class API {
* @param {boolean} preventExecution - Whether execution of the button click was prevented or not.
* @returns {void}
*/
notifyToolbarButtonClicked(key: string, preventExecution: boolean) {
notifyToolbarButtonClicked(key, preventExecution) {
this._sendEvent({
name: 'toolbar-button-clicked',
key,
@@ -1932,7 +1926,7 @@ class API {
* @param {boolean} supported - If browser is supported or not.
* @returns {void}
*/
notifyBrowserSupport(supported: boolean) {
notifyBrowserSupport(supported) {
this._sendEvent({
name: 'browser-support',
supported
@@ -2026,7 +2020,7 @@ class API {
* @param {WhiteboardStatus} status - The new whiteboard status.
* @returns {void}
*/
notifyWhiteboardStatusChanged(status: WhiteboardStatus) {
notifyWhiteboardStatusChanged(status) {
this._sendEvent({
name: 'whiteboard-status-changed',
status

View File

@@ -1,5 +1,3 @@
// @flow
import Logger from '@jitsi/logger';
const logger = Logger.getLogger(__filename);
@@ -11,7 +9,7 @@ const logger = Logger.getLogger(__filename);
* the external communication.
* @returns {Promise}
*/
export function getAvailableDevices(transport: Object) {
export function getAvailableDevices(transport) {
return transport.sendRequest({
type: 'devices',
name: 'getAvailableDevices'
@@ -29,7 +27,7 @@ export function getAvailableDevices(transport: Object) {
* the external communication.
* @returns {Promise}
*/
export function getCurrentDevices(transport: Object) {
export function getCurrentDevices(transport) {
return transport.sendRequest({
type: 'devices',
name: 'getCurrentDevices'
@@ -50,7 +48,7 @@ export function getCurrentDevices(transport: Object) {
* Default - 'input'.
* @returns {Promise}
*/
export function isDeviceChangeAvailable(transport: Object, deviceType: string) {
export function isDeviceChangeAvailable(transport, deviceType) {
return transport.sendRequest({
deviceType,
type: 'devices',
@@ -66,7 +64,7 @@ export function isDeviceChangeAvailable(transport: Object, deviceType: string) {
* the external communication.
* @returns {Promise}
*/
export function isDeviceListAvailable(transport: Object) {
export function isDeviceListAvailable(transport) {
return transport.sendRequest({
type: 'devices',
name: 'isDeviceListAvailable'
@@ -81,7 +79,7 @@ export function isDeviceListAvailable(transport: Object) {
* the external communication.
* @returns {Promise}
*/
export function isMultipleAudioInputSupported(transport: Object) {
export function isMultipleAudioInputSupported(transport) {
return transport.sendRequest({
type: 'devices',
name: 'isMultipleAudioInputSupported'
@@ -97,7 +95,7 @@ export function isMultipleAudioInputSupported(transport: Object) {
* @param {string} id - The id of the new device.
* @returns {Promise}
*/
export function setAudioInputDevice(transport: Object, label: string, id: string) {
export function setAudioInputDevice(transport, label, id) {
return _setDevice(transport, {
id,
kind: 'audioinput',
@@ -114,7 +112,7 @@ export function setAudioInputDevice(transport: Object, label: string, id: string
* @param {string} id - The id of the new device.
* @returns {Promise}
*/
export function setAudioOutputDevice(transport: Object, label: string, id: string) {
export function setAudioOutputDevice(transport, label, id) {
return _setDevice(transport, {
id,
kind: 'audiooutput',
@@ -130,7 +128,7 @@ export function setAudioOutputDevice(transport: Object, label: string, id: strin
* @param {Object} device - The new device to be used.
* @returns {Promise}
*/
function _setDevice(transport: Object, device) {
function _setDevice(transport, device) {
return transport.sendRequest({
type: 'devices',
name: 'setDevice',
@@ -147,7 +145,7 @@ function _setDevice(transport: Object, device) {
* @param {string} id - The id of the new device.
* @returns {Promise}
*/
export function setVideoInputDevice(transport: Object, label: string, id: string) {
export function setVideoInputDevice(transport, label, id) {
return _setDevice(transport, {
id,
kind: 'videoinput',