feat: expose Timeline.onChange to Room.getTimeline

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-01-26 11:45:03 +01:00
parent d008c7fe69
commit ed6f9c06b7
1 changed files with 9 additions and 4 deletions

View File

@ -1117,9 +1117,12 @@ class Room {
} }
/// Creates a timeline from the store. Returns a [Timeline] object. /// Creates a timeline from the store. Returns a [Timeline] object.
Future<Timeline> getTimeline( Future<Timeline> getTimeline({
{void Function()? onUpdate, void Function(int index)? onChange,
void Function(int insertID)? onInsert}) async { void Function(int index)? onRemove,
void Function(int insertID)? onInsert,
void Function()? onUpdate,
}) async {
await postLoad(); await postLoad();
var events; var events;
events = await client.database?.getEventList( events = await client.database?.getEventList(
@ -1144,8 +1147,10 @@ class Room {
final timeline = Timeline( final timeline = Timeline(
room: this, room: this,
events: events, events: events,
onUpdate: onUpdate, onChange: onChange,
onRemove: onRemove,
onInsert: onInsert, onInsert: onInsert,
onUpdate: onUpdate,
); );
if (client.database == null) { if (client.database == null) {
await requestHistory(historyCount: 10); await requestHistory(historyCount: 10);