mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-12-23 20:18:15 +00:00
feat(session): fix sessions getting disregarded due to reload
This commit is contained in:
@@ -2,8 +2,14 @@ import { EventEmitter } from 'stream';
|
|||||||
import { applyPatch } from 'rfc6902';
|
import { applyPatch } from 'rfc6902';
|
||||||
import { Block } from './types';
|
import { Block } from './types';
|
||||||
|
|
||||||
|
const sessions =
|
||||||
|
(global as any)._sessionManagerSessions || new Map<string, SessionManager>();
|
||||||
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
(global as any)._sessionManagerSessions = sessions;
|
||||||
|
}
|
||||||
|
|
||||||
class SessionManager {
|
class SessionManager {
|
||||||
private static sessions = new Map<string, SessionManager>();
|
private static sessions: Map<string, SessionManager> = sessions;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
private blocks = new Map<string, Block>();
|
private blocks = new Map<string, Block>();
|
||||||
private events: { event: string; data: any }[] = [];
|
private events: { event: string; data: any }[] = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user