Skip to content

refactor: rm submodule & loro-ffi@1.5.9 #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ DerivedData/
.netrc
/gen-swift
loroFFI.xcframework
loroFFI.xcframework.zip
loroFFI.xcframework.zip
target/
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

110 changes: 109 additions & 1 deletion Sources/Loro/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension LoroDoc{
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(containerId: ContainerId, callback: @escaping (DiffEvent)->Void) -> Subscription {
public func subscribe(containerId: ContainerId, callback: @escaping (DiffEvent)->Void) -> Subscription {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(containerId: containerId, subscriber: closureSubscriber)
}
Expand All @@ -59,3 +59,111 @@ extension LoroDoc{
return self.subscribeLocalUpdate(callback: closureLocalUpdate)
}
}

extension LoroText{
/** Subscribe the events of a container.
*
* The callback will be invoked when the container is changed.
* Returns a subscription id that can be used to unsubscribe.
*
* The events will be emitted after a transaction is committed. A transaction is committed when:
* - `doc.commit()` is called.
* - `doc.exportFrom(version)` is called.
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(subscriber: closureSubscriber)
}
}

extension LoroList{
/** Subscribe the events of a container.
*
* The callback will be invoked when the container is changed.
* Returns a subscription id that can be used to unsubscribe.
*
* The events will be emitted after a transaction is committed. A transaction is committed when:
* - `doc.commit()` is called.
* - `doc.exportFrom(version)` is called.
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(subscriber: closureSubscriber)
}
}

extension LoroMap{
/** Subscribe the events of a container.
*
* The callback will be invoked when the container is changed.
* Returns a subscription id that can be used to unsubscribe.
*
* The events will be emitted after a transaction is committed. A transaction is committed when:
* - `doc.commit()` is called.
* - `doc.exportFrom(version)` is called.
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(subscriber: closureSubscriber)
}
}

extension LoroTree{
/** Subscribe the events of a container.
*
* The callback will be invoked when the container is changed.
* Returns a subscription id that can be used to unsubscribe.
*
* The events will be emitted after a transaction is committed. A transaction is committed when:
* - `doc.commit()` is called.
* - `doc.exportFrom(version)` is called.
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(subscriber: closureSubscriber)
}
}

extension LoroMovableList{
/** Subscribe the events of a container.
*
* The callback will be invoked when the container is changed.
* Returns a subscription id that can be used to unsubscribe.
*
* The events will be emitted after a transaction is committed. A transaction is committed when:
* - `doc.commit()` is called.
* - `doc.exportFrom(version)` is called.
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(subscriber: closureSubscriber)
}
}

extension LoroCounter{
/** Subscribe the events of a container.
*
* The callback will be invoked when the container is changed.
* Returns a subscription id that can be used to unsubscribe.
*
* The events will be emitted after a transaction is committed. A transaction is committed when:
* - `doc.commit()` is called.
* - `doc.exportFrom(version)` is called.
* - `doc.import(data)` is called.
* - `doc.checkout(version)` is called.
*/
public func subscribe(callback: @escaping (DiffEvent)->Void) -> Subscription? {
let closureSubscriber = ClosureSubscriber(closure: callback)
return self.subscribe(subscriber: closureSubscriber)
}
}
Loading
Loading