mirror of
https://github.com/fluencelabs/fluent-pad
synced 2025-04-25 00:42:14 +00:00
rename calls -> api
This commit is contained in:
parent
f7e57bf9b3
commit
98d3cfd990
@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import './App.scss';
|
||||
import { FluenceClientContext } from '../app/FluenceClientContext';
|
||||
import { UserList } from './UserList';
|
||||
import * as calls from 'src/app/api';
|
||||
import * as api from 'src/app/api';
|
||||
import { CollaborativeEditor } from './CollaborativeEditor';
|
||||
import { relayNode } from 'src/app/constants';
|
||||
|
||||
@ -27,7 +27,7 @@ const App = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await calls.join(client, nickName);
|
||||
await api.join(client, nickName);
|
||||
setIsInRoom(true);
|
||||
};
|
||||
|
||||
@ -36,7 +36,7 @@ const App = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await calls.leave(client);
|
||||
await api.leave(client);
|
||||
setIsInRoom(false);
|
||||
};
|
||||
|
||||
@ -53,7 +53,7 @@ const App = () => {
|
||||
</div>
|
||||
|
||||
<div className="header-item">
|
||||
<button className="button" onClick={() => calls.clean(client!)}>
|
||||
<button className="button" onClick={() => api.clean(client!)}>
|
||||
Clean
|
||||
</button>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@ import { subscribeToEvent } from '@fluencelabs/fluence';
|
||||
import { fluentPadServiceId, notifyTextUpdateFnName } from 'src/app/constants';
|
||||
import { useFluenceClient } from '../app/FluenceClientContext';
|
||||
import { getUpdatedDocFromText, initDoc, SyncClient } from '../app/sync';
|
||||
import * as calls from 'src/app/api';
|
||||
import * as api from 'src/app/api';
|
||||
|
||||
const broadcastUpdates = _.debounce((text: string, syncClient: SyncClient) => {
|
||||
let doc = syncClient.getDoc();
|
||||
@ -29,7 +29,7 @@ export const CollaborativeEditor = () => {
|
||||
|
||||
syncClient.handleSendChanges = (changes: string) => {
|
||||
console.log('syncClient.handleSendChanges');
|
||||
calls.addEntry(client, changes);
|
||||
api.addEntry(client, changes);
|
||||
};
|
||||
|
||||
const unsub = subscribeToEvent(client, fluentPadServiceId, notifyTextUpdateFnName, (args, tetraplets) => {
|
||||
@ -46,7 +46,7 @@ export const CollaborativeEditor = () => {
|
||||
syncClient.start();
|
||||
|
||||
// don't block
|
||||
calls.getHistory(client).then((res) => {
|
||||
api.getHistory(client).then((res) => {
|
||||
for (let e of res) {
|
||||
syncClient.receiveChanges(e.body);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
notifyUserRemovedFnName,
|
||||
} from 'src/app/constants';
|
||||
import { useFluenceClient } from '../app/FluenceClientContext';
|
||||
import * as calls from 'src/app/api';
|
||||
import * as api from 'src/app/api';
|
||||
import { subscribeToEvent } from '@fluencelabs/fluence';
|
||||
|
||||
type PeerId = string;
|
||||
@ -42,11 +42,11 @@ export const UserList = (props: { selfName: string }) => {
|
||||
});
|
||||
|
||||
// don't block
|
||||
calls.updateOnlineStatuses(client);
|
||||
api.updateOnlineStatuses(client);
|
||||
}, refreshTimeoutMs);
|
||||
|
||||
const unsub1 = subscribeToEvent(client, fluentPadServiceId, notifyUserAddedFnName, (args, _) => {
|
||||
const users = args.flatMap((x) => x).flatMap((x) => x) as calls.User[];
|
||||
const users = args.flatMap((x) => x).flatMap((x) => x) as api.User[];
|
||||
setUsers((prev) => {
|
||||
const result = new Map(prev);
|
||||
for (let u of users) {
|
||||
@ -96,8 +96,8 @@ export const UserList = (props: { selfName: string }) => {
|
||||
});
|
||||
|
||||
// don't block
|
||||
calls.getUserList(client);
|
||||
calls.notifySelfAdded(client, props.selfName);
|
||||
api.getUserList(client);
|
||||
api.notifySelfAdded(client, props.selfName);
|
||||
|
||||
return () => {
|
||||
clearTimeout(listRefreshTimer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user