waffle/frontend/src/main.js
hippoz 7260525eec
frontend: message loading
This command finalizes support for dynamic message loading. The behavior is as follows:
When a user selects a channel for the first time, an "initial load" of messages will happen.
When the user is scrolled all the way to the bottom of the message view,
the store will continuously remove old messages to save memory.
Scrolling all the way to the top loads more messages.
2022-04-20 03:14:28 +03:00

27 lines
No EOL
626 B
JavaScript

import App from './components/App.svelte';
import gateway from './gateway';
import request from './request';
import { apiRoute, initStorageDefaults } from './storage';
initStorageDefaults();
gateway.init();
// Remove loading screen
const loadingElement = document.getElementById("pre--loading-screen");
if (loadingElement) {
loadingElement.parentElement.removeChild(loadingElement);
}
window.__testing = async () => {
for (let i = 0; i < 100; i++) {
await request("POST", apiRoute("channels/6/messages"), true, {
content: `test ${i}`
});
}
};
const app = new App({
target: document.body
});
export default app;