Skip to content

Commit b7b7c7a

Browse files
authored
refactor: rm submodule & loro-ffi@1.5.9 (#24)
* refactor: rm submodule * feat: 1.5.9
1 parent 9d0be55 commit b7b7c7a

File tree

11 files changed

+3028
-22
lines changed

11 files changed

+3028
-22
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ DerivedData/
88
.netrc
99
/gen-swift
1010
loroFFI.xcframework
11-
loroFFI.xcframework.zip
11+
loroFFI.xcframework.zip
12+
target/

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

Sources/Loro/Event.swift

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension LoroDoc{
4646
* - `doc.import(data)` is called.
4747
* - `doc.checkout(version)` is called.
4848
*/
49-
public func subscribe(containerId: ContainerId, callback: @escaping (DiffEvent)->Void) -> Subscription {
49+
public func subscribe(containerId: ContainerId, callback: @escaping (DiffEvent)->Void) -> Subscription {
5050
let closureSubscriber = ClosureSubscriber(closure: callback)
5151
return self.subscribe(containerId: containerId, subscriber: closureSubscriber)
5252
}
@@ -59,3 +59,111 @@ extension LoroDoc{
5959
return self.subscribeLocalUpdate(callback: closureLocalUpdate)
6060
}
6161
}
62+
63+
extension LoroText{
64+
/** Subscribe the events of a container.
65+
*
66+
* The callback will be invoked when the container is changed.
67+
* Returns a subscription id that can be used to unsubscribe.
68+
*
69+
* The events will be emitted after a transaction is committed. A transaction is committed when:
70+
* - `doc.commit()` is called.
71+
* - `doc.exportFrom(version)` is called.
72+
* - `doc.import(data)` is called.
73+
* - `doc.checkout(version)` is called.
74+
*/
75+
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
76+
let closureSubscriber = ClosureSubscriber(closure: callback)
77+
return self.subscribe(subscriber: closureSubscriber)
78+
}
79+
}
80+
81+
extension LoroList{
82+
/** Subscribe the events of a container.
83+
*
84+
* The callback will be invoked when the container is changed.
85+
* Returns a subscription id that can be used to unsubscribe.
86+
*
87+
* The events will be emitted after a transaction is committed. A transaction is committed when:
88+
* - `doc.commit()` is called.
89+
* - `doc.exportFrom(version)` is called.
90+
* - `doc.import(data)` is called.
91+
* - `doc.checkout(version)` is called.
92+
*/
93+
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
94+
let closureSubscriber = ClosureSubscriber(closure: callback)
95+
return self.subscribe(subscriber: closureSubscriber)
96+
}
97+
}
98+
99+
extension LoroMap{
100+
/** Subscribe the events of a container.
101+
*
102+
* The callback will be invoked when the container is changed.
103+
* Returns a subscription id that can be used to unsubscribe.
104+
*
105+
* The events will be emitted after a transaction is committed. A transaction is committed when:
106+
* - `doc.commit()` is called.
107+
* - `doc.exportFrom(version)` is called.
108+
* - `doc.import(data)` is called.
109+
* - `doc.checkout(version)` is called.
110+
*/
111+
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
112+
let closureSubscriber = ClosureSubscriber(closure: callback)
113+
return self.subscribe(subscriber: closureSubscriber)
114+
}
115+
}
116+
117+
extension LoroTree{
118+
/** Subscribe the events of a container.
119+
*
120+
* The callback will be invoked when the container is changed.
121+
* Returns a subscription id that can be used to unsubscribe.
122+
*
123+
* The events will be emitted after a transaction is committed. A transaction is committed when:
124+
* - `doc.commit()` is called.
125+
* - `doc.exportFrom(version)` is called.
126+
* - `doc.import(data)` is called.
127+
* - `doc.checkout(version)` is called.
128+
*/
129+
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
130+
let closureSubscriber = ClosureSubscriber(closure: callback)
131+
return self.subscribe(subscriber: closureSubscriber)
132+
}
133+
}
134+
135+
extension LoroMovableList{
136+
/** Subscribe the events of a container.
137+
*
138+
* The callback will be invoked when the container is changed.
139+
* Returns a subscription id that can be used to unsubscribe.
140+
*
141+
* The events will be emitted after a transaction is committed. A transaction is committed when:
142+
* - `doc.commit()` is called.
143+
* - `doc.exportFrom(version)` is called.
144+
* - `doc.import(data)` is called.
145+
* - `doc.checkout(version)` is called.
146+
*/
147+
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
148+
let closureSubscriber = ClosureSubscriber(closure: callback)
149+
return self.subscribe(subscriber: closureSubscriber)
150+
}
151+
}
152+
153+
extension LoroCounter{
154+
/** Subscribe the events of a container.
155+
*
156+
* The callback will be invoked when the container is changed.
157+
* Returns a subscription id that can be used to unsubscribe.
158+
*
159+
* The events will be emitted after a transaction is committed. A transaction is committed when:
160+
* - `doc.commit()` is called.
161+
* - `doc.exportFrom(version)` is called.
162+
* - `doc.import(data)` is called.
163+
* - `doc.checkout(version)` is called.
164+
*/
165+
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
166+
let closureSubscriber = ClosureSubscriber(closure: callback)
167+
return self.subscribe(subscriber: closureSubscriber)
168+
}
169+
}

0 commit comments

Comments
 (0)