mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-27 12:45:21 +00:00
Merge pull request #280 from status-im/timestamp-chat
Demonstrate usage of history time filter in web chat
This commit is contained in:
commit
37b8056a78
@ -61,10 +61,20 @@ async function retrieveStoreMessages(
|
|||||||
setArchivedMessages(messages);
|
setArchivedMessages(messages);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const startTime = new Date();
|
||||||
|
// Only retrieve a week of history
|
||||||
|
startTime.setTime(Date.now() - 1000 * 60 * 60 * 24 * 7);
|
||||||
|
|
||||||
|
const endTime = new Date();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await waku.store.queryHistory([ChatContentTopic], {
|
const res = await waku.store.queryHistory([ChatContentTopic], {
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
direction: Direction.FORWARD,
|
direction: Direction.FORWARD,
|
||||||
|
timeFilter: {
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
},
|
||||||
callback,
|
callback,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user