Открыть боковую панель
Медведев Антон Павлович
universo-react
Коммиты
8d8bd496
Не подтверждена
Коммит
8d8bd496
создал
Май 08, 2024
по автору
EYHN
Просмотр файлов
chore(infra): remove compatible code (#6833)
владелец
87078ff7
Изменения
3
Скрыть пробелы
Построчно
Рядом
packages/common/infra/src/sync/doc/event.ts
Просмотр файла @
8d8bd496
...
...
@@ -11,11 +11,6 @@ export type DocEvent =
docId
:
string
;
update
:
Uint8Array
;
clientId
:
string
;
}
|
{
type
:
'
LegacyClientUpdateCommitted
'
;
docId
:
string
;
update
:
Uint8Array
;
};
export
interface
DocEventBus
{
...
...
packages/common/infra/src/sync/doc/local.ts
Просмотр файла @
8d8bd496
...
...
@@ -254,13 +254,6 @@ export class DocEngineLocalPart {
});
}
},
LegacyClientUpdateCommitted
:
({
docId
,
update
})
=>
{
this
.
schedule
({
type
:
'
save
'
,
docId
,
update
,
});
},
};
handleDocUpdate
=
(
update
:
Uint8Array
,
origin
:
any
,
doc
:
YDoc
)
=>
{
...
...
packages/frontend/core/src/modules/workspace-engine/impls/engine/doc-broadcast-channel.ts
Просмотр файла @
8d8bd496
import
type
{
DocEvent
,
DocEventBus
}
from
'
@toeverything/infra
'
;
type
LegacyChannelMessage
=
{
type
:
'
db-updated
'
;
payload
:
{
docId
:
string
;
update
:
Uint8Array
;
};
__from_new_doc_engine
?:
boolean
;
};
export
class
BroadcastChannelDocEventBus
implements
DocEventBus
{
legacyChannel
=
new
BroadcastChannel
(
'
indexeddb:
'
+
this
.
workspaceId
);
senderChannel
=
new
BroadcastChannel
(
'
doc:
'
+
this
.
workspaceId
);
constructor
(
private
readonly
workspaceId
:
string
)
{
this
.
legacyChannel
.
addEventListener
(
'
message
'
,
(
event
:
MessageEvent
<
LegacyChannelMessage
>
)
=>
{
if
(
event
.
data
.
__from_new_doc_engine
)
{
return
;
}
if
(
event
.
data
.
type
===
'
db-updated
'
)
{
this
.
emit
({
type
:
'
LegacyClientUpdateCommitted
'
,
docId
:
event
.
data
.
payload
.
docId
,
update
:
event
.
data
.
payload
.
update
,
});
}
}
);
}
constructor
(
private
readonly
workspaceId
:
string
)
{}
emit
(
event
:
DocEvent
):
void
{
if
(
event
.
type
===
'
ClientUpdateCommitted
'
||
event
.
type
===
'
ServerUpdateCommitted
'
)
{
this
.
legacyChannel
.
postMessage
({
type
:
'
db-updated
'
,
payload
:
{
docId
:
event
.
docId
,
update
:
event
.
update
,
},
__from_new_doc_engine
:
true
,
}
satisfies
LegacyChannelMessage
);
}
this
.
senderChannel
.
postMessage
(
event
);
}
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать