mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
stop using default exports
because it becomes hard to remember where you used them and where not
This commit is contained in:
parent
0de5e899ea
commit
001dbefbcf
@ -1,4 +1,4 @@
|
|||||||
export default class EventEmitter {
|
export class EventEmitter {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._handlersByName = {};
|
this._handlersByName = {};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//#ifdef PLATFORM_GNOME
|
//#ifdef PLATFORM_GNOME
|
||||||
//##export {default} from "./ui/gnome/GnomePlatform.js";
|
//##export {default} from "./ui/gnome/GnomePlatform.js";
|
||||||
//#else
|
//#else
|
||||||
export {default} from "./ui/web/WebPlatform.js";
|
export {WebPlatform as Platform} from "./ui/web/WebPlatform.js";
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import Session from "../matrix/Session.js";
|
import {Session} from "../matrix/Session.js";
|
||||||
import {Sync} from "../matrix/Sync.js";
|
import {Sync} from "../matrix/Sync.js";
|
||||||
import SessionViewModel from "./session/SessionViewModel.js";
|
import {SessionViewModel} from "./session/SessionViewModel.js";
|
||||||
import LoginViewModel from "./LoginViewModel.js";
|
import {LoginViewModel} from "./LoginViewModel.js";
|
||||||
import SessionPickerViewModel from "./SessionPickerViewModel.js";
|
import {SessionPickerViewModel} from "./SessionPickerViewModel.js";
|
||||||
import EventEmitter from "../EventEmitter.js";
|
import {EventEmitter} from "../EventEmitter.js";
|
||||||
|
|
||||||
export function createNewSessionId() {
|
export function createNewSessionId() {
|
||||||
return (Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)).toString();
|
return (Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class BrawlViewModel extends EventEmitter {
|
export class BrawlViewModel extends EventEmitter {
|
||||||
constructor({storageFactory, sessionInfoStorage, createHsApi, clock}) {
|
constructor({storageFactory, sessionInfoStorage, createHsApi, clock}) {
|
||||||
super();
|
super();
|
||||||
this._storageFactory = storageFactory;
|
this._storageFactory = storageFactory;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import EventEmitter from "../EventEmitter.js";
|
import {EventEmitter} from "../EventEmitter.js";
|
||||||
|
|
||||||
export default class LoginViewModel extends EventEmitter {
|
export class LoginViewModel extends EventEmitter {
|
||||||
constructor({loginCallback, defaultHomeServer, createHsApi}) {
|
constructor({loginCallback, defaultHomeServer, createHsApi}) {
|
||||||
super();
|
super();
|
||||||
this._loginCallback = loginCallback;
|
this._loginCallback = loginCallback;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {SortedArray} from "../observable/index.js";
|
import {SortedArray} from "../observable/index.js";
|
||||||
import EventEmitter from "../EventEmitter.js";
|
import {EventEmitter} from "../EventEmitter.js";
|
||||||
import {createNewSessionId} from "./BrawlViewModel.js"
|
import {createNewSessionId} from "./BrawlViewModel.js"
|
||||||
|
|
||||||
class SessionItemViewModel extends EventEmitter {
|
class SessionItemViewModel extends EventEmitter {
|
||||||
@ -98,7 +98,7 @@ class SessionItemViewModel extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SessionPickerViewModel {
|
export class SessionPickerViewModel {
|
||||||
constructor({storageFactory, sessionInfoStorage, sessionCallback}) {
|
constructor({storageFactory, sessionInfoStorage, sessionCallback}) {
|
||||||
this._storageFactory = storageFactory;
|
this._storageFactory = storageFactory;
|
||||||
this._sessionInfoStorage = sessionInfoStorage;
|
this._sessionInfoStorage = sessionInfoStorage;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import EventEmitter from "../../EventEmitter.js";
|
import {EventEmitter} from "../../EventEmitter.js";
|
||||||
import RoomTileViewModel from "./roomlist/RoomTileViewModel.js";
|
import {RoomTileViewModel} from "./roomlist/RoomTileViewModel.js";
|
||||||
import RoomViewModel from "./room/RoomViewModel.js";
|
import {RoomViewModel} from "./room/RoomViewModel.js";
|
||||||
import SyncStatusViewModel from "./SyncStatusViewModel.js";
|
import {SyncStatusViewModel} from "./SyncStatusViewModel.js";
|
||||||
|
|
||||||
export default class SessionLoadViewModel extends ViewModel {
|
export class SessionLoadViewModel extends ViewModel {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
this._sessionContainer = options.sessionContainer;
|
this._sessionContainer = options.sessionContainer;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import EventEmitter from "../../EventEmitter.js";
|
import {EventEmitter} from "../../EventEmitter.js";
|
||||||
import RoomTileViewModel from "./roomlist/RoomTileViewModel.js";
|
import {RoomTileViewModel} from "./roomlist/RoomTileViewModel.js";
|
||||||
import RoomViewModel from "./room/RoomViewModel.js";
|
import {RoomViewModel} from "./room/RoomViewModel.js";
|
||||||
import SyncStatusViewModel from "./SyncStatusViewModel.js";
|
import {SyncStatusViewModel} from "./SyncStatusViewModel.js";
|
||||||
|
|
||||||
export default class SessionViewModel extends EventEmitter {
|
export class SessionViewModel extends EventEmitter {
|
||||||
constructor({session, sync}) {
|
constructor({session, sync}) {
|
||||||
super();
|
super();
|
||||||
this._session = session;
|
this._session = session;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import EventEmitter from "../../EventEmitter.js";
|
import {EventEmitter} from "../../EventEmitter.js";
|
||||||
|
|
||||||
export default class SyncStatusViewModel extends EventEmitter {
|
export class SyncStatusViewModel extends EventEmitter {
|
||||||
constructor(sync) {
|
constructor(sync) {
|
||||||
super();
|
super();
|
||||||
this._sync = sync;
|
this._sync = sync;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import EventEmitter from "../../../EventEmitter.js";
|
import {EventEmitter} from "../../../EventEmitter.js";
|
||||||
import TimelineViewModel from "./timeline/TimelineViewModel.js";
|
import {TimelineViewModel} from "./timeline/TimelineViewModel.js";
|
||||||
import {avatarInitials} from "../avatar.js";
|
import {avatarInitials} from "../avatar.js";
|
||||||
|
|
||||||
export default class RoomViewModel extends EventEmitter {
|
export class RoomViewModel extends EventEmitter {
|
||||||
constructor({room, ownUserId, closeCallback}) {
|
constructor({room, ownUserId, closeCallback}) {
|
||||||
super();
|
super();
|
||||||
this._room = room;
|
this._room = room;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import BaseObservableList from "../../../../observable/list/BaseObservableList.js";
|
import {BaseObservableList} from "../../../../observable/list/BaseObservableList.js";
|
||||||
import sortedIndex from "../../../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../../../utils/sortedIndex.js";
|
||||||
|
|
||||||
// maps 1..n entries to 0..1 tile. Entries are what is stored in the timeline, either an event or fragmentboundary
|
// maps 1..n entries to 0..1 tile. Entries are what is stored in the timeline, either an event or fragmentboundary
|
||||||
// for now, tileCreator should be stable in whether it returns a tile or not.
|
// for now, tileCreator should be stable in whether it returns a tile or not.
|
||||||
// e.g. the decision to create a tile or not should be based on properties
|
// e.g. the decision to create a tile or not should be based on properties
|
||||||
// not updated later on (e.g. event type)
|
// not updated later on (e.g. event type)
|
||||||
// also see big comment in onUpdate
|
// also see big comment in onUpdate
|
||||||
export default class TilesCollection extends BaseObservableList {
|
export class TilesCollection extends BaseObservableList {
|
||||||
constructor(entries, tileCreator) {
|
constructor(entries, tileCreator) {
|
||||||
super();
|
super();
|
||||||
this._entries = entries;
|
this._entries = entries;
|
||||||
@ -187,8 +187,8 @@ export default class TilesCollection extends BaseObservableList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import ObservableArray from "../../../../observable/list/ObservableArray.js";
|
import {ObservableArray} from "../../../../observable/list/ObservableArray.js";
|
||||||
import UpdateAction from "./UpdateAction.js";
|
import {UpdateAction} from "./UpdateAction.js";
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
class TestTile {
|
class TestTile {
|
||||||
|
@ -14,10 +14,10 @@ the timeline (counted in tiles), which results to a range in sortKeys we want on
|
|||||||
to the room timeline, which unload entries from memory.
|
to the room timeline, which unload entries from memory.
|
||||||
when loading, it just reads events from a sortkey backwards or forwards...
|
when loading, it just reads events from a sortkey backwards or forwards...
|
||||||
*/
|
*/
|
||||||
import TilesCollection from "./TilesCollection.js";
|
import {TilesCollection} from "./TilesCollection.js";
|
||||||
import tilesCreator from "./tilesCreator.js";
|
import {tilesCreator} from "./tilesCreator.js";
|
||||||
|
|
||||||
export default class TimelineViewModel {
|
export class TimelineViewModel {
|
||||||
constructor(room, timeline, ownUserId) {
|
constructor(room, timeline, ownUserId) {
|
||||||
this._timeline = timeline;
|
this._timeline = timeline;
|
||||||
// once we support sending messages we could do
|
// once we support sending messages we could do
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class UpdateAction {
|
export class UpdateAction {
|
||||||
constructor(remove, update, updateParams) {
|
constructor(remove, update, updateParams) {
|
||||||
this._remove = remove;
|
this._remove = remove;
|
||||||
this._update = update;
|
this._update = update;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import SimpleTile from "./SimpleTile.js";
|
import {SimpleTile} from "./SimpleTile.js";
|
||||||
import UpdateAction from "../UpdateAction.js";
|
import {UpdateAction} from "../UpdateAction.js";
|
||||||
|
|
||||||
export default class GapTile extends SimpleTile {
|
export class GapTile extends SimpleTile {
|
||||||
constructor(options, timeline) {
|
constructor(options, timeline) {
|
||||||
super(options);
|
super(options);
|
||||||
this._timeline = timeline;
|
this._timeline = timeline;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import MessageTile from "./MessageTile.js";
|
import {MessageTile} from "./MessageTile.js";
|
||||||
|
|
||||||
export default class ImageTile extends MessageTile {
|
export class ImageTile extends MessageTile {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import MessageTile from "./MessageTile.js";
|
import {MessageTile} from "./MessageTile.js";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
map urls:
|
map urls:
|
||||||
@ -7,7 +7,7 @@ android: https://developers.google.com/maps/documentation/urls/guide
|
|||||||
wp: maps:49.275267 -122.988617
|
wp: maps:49.275267 -122.988617
|
||||||
https://www.habaneroconsulting.com/stories/insights/2011/opening-native-map-apps-from-the-mobile-browser
|
https://www.habaneroconsulting.com/stories/insights/2011/opening-native-map-apps-from-the-mobile-browser
|
||||||
*/
|
*/
|
||||||
export default class LocationTile extends MessageTile {
|
export class LocationTile extends MessageTile {
|
||||||
get mapsLink() {
|
get mapsLink() {
|
||||||
const geoUri = this._getContent().geo_uri;
|
const geoUri = this._getContent().geo_uri;
|
||||||
const [lat, long] = geoUri.split(":")[1].split(",");
|
const [lat, long] = geoUri.split(":")[1].split(",");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import SimpleTile from "./SimpleTile.js";
|
import {SimpleTile} from "./SimpleTile.js";
|
||||||
|
|
||||||
export default class MessageTile extends SimpleTile {
|
export class MessageTile extends SimpleTile {
|
||||||
|
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import SimpleTile from "./SimpleTile.js";
|
import {SimpleTile} from "./SimpleTile.js";
|
||||||
|
|
||||||
export default class RoomNameTile extends SimpleTile {
|
export class RoomMemberTile extends SimpleTile {
|
||||||
|
|
||||||
get shape() {
|
get shape() {
|
||||||
return "announcement";
|
return "announcement";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import SimpleTile from "./SimpleTile.js";
|
import {SimpleTile} from "./SimpleTile.js";
|
||||||
|
|
||||||
export default class RoomNameTile extends SimpleTile {
|
export class RoomNameTile extends SimpleTile {
|
||||||
|
|
||||||
get shape() {
|
get shape() {
|
||||||
return "announcement";
|
return "announcement";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import UpdateAction from "../UpdateAction.js";
|
import {UpdateAction} from "../UpdateAction.js";
|
||||||
|
|
||||||
export default class SimpleTile {
|
export class SimpleTile {
|
||||||
constructor({entry}) {
|
constructor({entry}) {
|
||||||
this._entry = entry;
|
this._entry = entry;
|
||||||
this._emitUpdate = null;
|
this._emitUpdate = null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import MessageTile from "./MessageTile.js";
|
import {MessageTile} from "./MessageTile.js";
|
||||||
|
|
||||||
export default class TextTile extends MessageTile {
|
export class TextTile extends MessageTile {
|
||||||
get text() {
|
get text() {
|
||||||
const content = this._getContent();
|
const content = this._getContent();
|
||||||
const body = content && content.body;
|
const body = content && content.body;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import GapTile from "./tiles/GapTile.js";
|
import {GapTile} from "./tiles/GapTile.js";
|
||||||
import TextTile from "./tiles/TextTile.js";
|
import {TextTile} from "./tiles/TextTile.js";
|
||||||
import LocationTile from "./tiles/LocationTile.js";
|
import {LocationTile} from "./tiles/LocationTile.js";
|
||||||
import RoomNameTile from "./tiles/RoomNameTile.js";
|
import {RoomNameTile} from "./tiles/RoomNameTile.js";
|
||||||
import RoomMemberTile from "./tiles/RoomMemberTile.js";
|
import {RoomMemberTile} from "./tiles/RoomMemberTile.js";
|
||||||
|
|
||||||
export default function ({room, ownUserId}) {
|
export function tilesCreator({room, ownUserId}) {
|
||||||
return function tilesCreator(entry, emitUpdate) {
|
return function tilesCreator(entry, emitUpdate) {
|
||||||
const options = {entry, emitUpdate, ownUserId};
|
const options = {entry, emitUpdate, ownUserId};
|
||||||
if (entry.isGap) {
|
if (entry.isGap) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {avatarInitials} from "../avatar.js";
|
import {avatarInitials} from "../avatar.js";
|
||||||
|
|
||||||
export default class RoomTileViewModel {
|
export class RoomTileViewModel {
|
||||||
// we use callbacks to parent VM instead of emit because
|
// we use callbacks to parent VM instead of emit because
|
||||||
// it would be annoying to keep track of subscriptions in
|
// it would be annoying to keep track of subscriptions in
|
||||||
// parent for all RoomTileViewModels
|
// parent for all RoomTileViewModels
|
||||||
|
16
src/main.js
16
src/main.js
@ -1,13 +1,13 @@
|
|||||||
import HomeServerApi from "./matrix/net/HomeServerApi.js";
|
import {HomeServerApi} from "./matrix/net/HomeServerApi.js";
|
||||||
// import {RecordRequester, ReplayRequester} from "./matrix/net/request/replay.js";
|
// import {RecordRequester, ReplayRequester} from "./matrix/net/request/replay.js";
|
||||||
import fetchRequest from "./matrix/net/request/fetch.js";
|
import {fetchRequest} from "./matrix/net/request/fetch.js";
|
||||||
import {Reconnector} from "./matrix/net/Reconnector.js";
|
import {Reconnector} from "./matrix/net/Reconnector.js";
|
||||||
import StorageFactory from "./matrix/storage/idb/create.js";
|
import {StorageFactory} from "./matrix/storage/idb/create.js";
|
||||||
import SessionInfoStorage from "./matrix/sessioninfo/localstorage/SessionInfoStorage.js";
|
import {SessionInfoStorage} from "./matrix/sessioninfo/localstorage/SessionInfoStorage.js";
|
||||||
import BrawlViewModel from "./domain/BrawlViewModel.js";
|
import {BrawlViewModel} from "./domain/BrawlViewModel.js";
|
||||||
import BrawlView from "./ui/web/BrawlView.js";
|
import {BrawlView} from "./ui/web/BrawlView.js";
|
||||||
import DOMClock from "./ui/web/dom/Clock.js";
|
import {Clock as DOMClock} from "./ui/web/dom/Clock.js";
|
||||||
import OnlineStatus from "./ui/web/dom/OnlineStatus.js";
|
import {OnlineStatus} from "./ui/web/dom/OnlineStatus.js";
|
||||||
|
|
||||||
export default async function main(container) {
|
export default async function main(container) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Platform from "../Platform.js";
|
import {Platform} from "../Platform.js";
|
||||||
import {HomeServerError, ConnectionError} from "./error.js";
|
import {HomeServerError, ConnectionError} from "./error.js";
|
||||||
|
|
||||||
export class RateLimitingBackoff {
|
export class RateLimitingBackoff {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import Room from "./room/room.js";
|
import {Room} from "./room/room.js";
|
||||||
import { ObservableMap } from "../observable/index.js";
|
import { ObservableMap } from "../observable/index.js";
|
||||||
import { SendScheduler, RateLimitingBackoff } from "./SendScheduler.js";
|
import { SendScheduler, RateLimitingBackoff } from "./SendScheduler.js";
|
||||||
import User from "./User.js";
|
import {User} from "./User.js";
|
||||||
|
|
||||||
export default class Session {
|
export class Session {
|
||||||
// sessionInfo contains deviceId, userId and homeServer
|
// sessionInfo contains deviceId, userId and homeServer
|
||||||
constructor({storage, hsApi, sessionInfo}) {
|
constructor({storage, hsApi, sessionInfo}) {
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import createEnum from "../utils/enum.js";
|
import {createEnum} from "../utils/enum.js";
|
||||||
import ObservableValue from "../observable/ObservableValue.js";
|
import {ObservableValue} from "../observable/ObservableValue.js";
|
||||||
import HomeServerApi from "./net/HomeServerApi.js";
|
import {HomeServerApi} from "./net/HomeServerApi.js";
|
||||||
import {Reconnector, ConnectionStatus} from "./net/Reconnector.js";
|
import {Reconnector, ConnectionStatus} from "./net/Reconnector.js";
|
||||||
import ExponentialRetryDelay from "./net/ExponentialRetryDelay.js";
|
import {ExponentialRetryDelay} from "./net/ExponentialRetryDelay.js";
|
||||||
import {HomeServerError, ConnectionError, AbortError} from "./error.js";
|
import {HomeServerError, ConnectionError, AbortError} from "./error.js";
|
||||||
import {Sync, SyncStatus} from "./Sync.js";
|
import {Sync, SyncStatus} from "./Sync.js";
|
||||||
import Session from "./Session.js";
|
import {Session} from "./Session.js";
|
||||||
|
|
||||||
export const LoadStatus = createEnum(
|
export const LoadStatus = createEnum(
|
||||||
"NotLoading",
|
"NotLoading",
|
||||||
@ -138,7 +138,7 @@ export class SessionContainer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
await this._waitForFirstSync();
|
await this._waitForFirstSync();
|
||||||
|
|
||||||
this._status.set(LoadStatus.Ready);
|
this._status.set(LoadStatus.Ready);
|
||||||
|
|
||||||
// if the sync failed, and then the reconnector
|
// if the sync failed, and then the reconnector
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {AbortError} from "./error.js";
|
import {AbortError} from "./error.js";
|
||||||
import ObservableValue from "../observable/ObservableValue.js";
|
import {ObservableValue} from "../observable/ObservableValue.js";
|
||||||
import createEnum from "../utils/enum.js";
|
import {createEnum} from "../utils/enum.js";
|
||||||
|
|
||||||
const INCREMENTAL_TIMEOUT = 30000;
|
const INCREMENTAL_TIMEOUT = 30000;
|
||||||
const SYNC_EVENT_LIMIT = 10;
|
const SYNC_EVENT_LIMIT = 10;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class User {
|
export class User {
|
||||||
constructor(userId) {
|
constructor(userId) {
|
||||||
this._userId = userId;
|
this._userId = userId;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {AbortError} from "../../utils/error.js";
|
import {AbortError} from "../../utils/error.js";
|
||||||
|
|
||||||
export default class ExponentialRetryDelay {
|
export class ExponentialRetryDelay {
|
||||||
constructor(createTimeout, start = 2000) {
|
constructor(createTimeout, start = 2000) {
|
||||||
this._start = start;
|
this._start = start;
|
||||||
this._current = start;
|
this._current = start;
|
||||||
@ -43,7 +43,7 @@ export default class ExponentialRetryDelay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import MockClock from "../../mocks/Clock.js";
|
import {Clock as MockClock} from "../../mocks/Clock.js";
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
return {
|
return {
|
||||||
|
@ -28,7 +28,7 @@ class RequestWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class HomeServerApi {
|
export class HomeServerApi {
|
||||||
constructor({homeServer, accessToken, request, createTimeout, reconnector}) {
|
constructor({homeServer, accessToken, request, createTimeout, reconnector}) {
|
||||||
// store these both in a closure somehow so it's harder to get at in case of XSS?
|
// store these both in a closure somehow so it's harder to get at in case of XSS?
|
||||||
// one could change the homeserver as well so the token gets sent there, so both must be protected from read/write
|
// one could change the homeserver as well so the token gets sent there, so both must be protected from read/write
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import createEnum from "../../utils/enum.js";
|
import {createEnum} from "../../utils/enum.js";
|
||||||
import {AbortError} from "../../utils/error.js";
|
import {AbortError} from "../../utils/error.js";
|
||||||
import {ConnectionError} from "../error.js"
|
import {ConnectionError} from "../error.js"
|
||||||
import ObservableValue from "../../observable/ObservableValue.js";
|
import {ObservableValue} from "../../observable/ObservableValue.js";
|
||||||
|
|
||||||
export const ConnectionStatus = createEnum(
|
export const ConnectionStatus = createEnum(
|
||||||
"Offline",
|
"Offline",
|
||||||
@ -111,8 +111,8 @@ export class Reconnector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import MockClock from "../../mocks/Clock.js";
|
import {Clock as MockClock} from "../../mocks/Clock.js";
|
||||||
import ExponentialRetryDelay from "./ExponentialRetryDelay.js";
|
import {ExponentialRetryDelay} from "./ExponentialRetryDelay.js";
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
function createHsApiMock(remainingFailures) {
|
function createHsApiMock(remainingFailures) {
|
||||||
|
@ -31,7 +31,7 @@ class RequestResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function fetchRequest(url, options) {
|
export function fetchRequest(url, options) {
|
||||||
const controller = typeof AbortController === "function" ? new AbortController() : null;
|
const controller = typeof AbortController === "function" ? new AbortController() : null;
|
||||||
if (controller) {
|
if (controller) {
|
||||||
options = Object.assign(options, {
|
options = Object.assign(options, {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import EventEmitter from "../../EventEmitter.js";
|
import {EventEmitter} from "../../EventEmitter.js";
|
||||||
import RoomSummary from "./summary.js";
|
import {RoomSummary} from "./summary.js";
|
||||||
import SyncWriter from "./timeline/persistence/SyncWriter.js";
|
import {SyncWriter} from "./timeline/persistence/SyncWriter.js";
|
||||||
import GapWriter from "./timeline/persistence/GapWriter.js";
|
import {GapWriter} from "./timeline/persistence/GapWriter.js";
|
||||||
import Timeline from "./timeline/Timeline.js";
|
import {Timeline} from "./timeline/Timeline.js";
|
||||||
import FragmentIdComparer from "./timeline/FragmentIdComparer.js";
|
import {FragmentIdComparer} from "./timeline/FragmentIdComparer.js";
|
||||||
import SendQueue from "./sending/SendQueue.js";
|
import {SendQueue} from "./sending/SendQueue.js";
|
||||||
|
|
||||||
export default class Room extends EventEmitter {
|
export class Room extends EventEmitter {
|
||||||
constructor({roomId, storage, hsApi, emitCollectionChange, sendScheduler, pendingEvents, user}) {
|
constructor({roomId, storage, hsApi, emitCollectionChange, sendScheduler, pendingEvents, user}) {
|
||||||
super();
|
super();
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class PendingEvent {
|
export class PendingEvent {
|
||||||
constructor(data) {
|
constructor(data) {
|
||||||
this._data = data;
|
this._data = data;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import SortedArray from "../../../observable/list/SortedArray.js";
|
import {SortedArray} from "../../../observable/list/SortedArray.js";
|
||||||
import {ConnectionError} from "../../error.js";
|
import {ConnectionError} from "../../error.js";
|
||||||
import PendingEvent from "./PendingEvent.js";
|
import {PendingEvent} from "./PendingEvent.js";
|
||||||
|
|
||||||
function makeTxnId() {
|
function makeTxnId() {
|
||||||
const n = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
const n = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
||||||
@ -8,7 +8,7 @@ function makeTxnId() {
|
|||||||
return "t" + "0".repeat(14 - str.length) + str;
|
return "t" + "0".repeat(14 - str.length) + str;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SendQueue {
|
export class SendQueue {
|
||||||
constructor({roomId, storage, sendScheduler, pendingEvents}) {
|
constructor({roomId, storage, sendScheduler, pendingEvents}) {
|
||||||
pendingEvents = pendingEvents || [];
|
pendingEvents = pendingEvents || [];
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
|
@ -99,7 +99,7 @@ class SummaryData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class RoomSummary {
|
export class RoomSummary {
|
||||||
constructor(roomId) {
|
constructor(roomId) {
|
||||||
this._data = new SummaryData(null, roomId);
|
this._data = new SummaryData(null, roomId);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
|
export class Direction {
|
||||||
|
|
||||||
export default class Direction {
|
|
||||||
constructor(isForward) {
|
constructor(isForward) {
|
||||||
this._isForward = isForward;
|
this._isForward = isForward;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Platform from "../../../Platform.js";
|
import {Platform} from "../../../Platform.js";
|
||||||
|
|
||||||
// key for events in the timelineEvents store
|
// key for events in the timelineEvents store
|
||||||
export default class EventKey {
|
export class EventKey {
|
||||||
constructor(fragmentId, eventIndex) {
|
constructor(fragmentId, eventIndex) {
|
||||||
this.fragmentId = fragmentId;
|
this.fragmentId = fragmentId;
|
||||||
this.eventIndex = eventIndex;
|
this.eventIndex = eventIndex;
|
||||||
|
@ -114,7 +114,7 @@ class Island {
|
|||||||
/*
|
/*
|
||||||
index for fast lookup of how two fragments can be sorted
|
index for fast lookup of how two fragments can be sorted
|
||||||
*/
|
*/
|
||||||
export default class FragmentIdComparer {
|
export class FragmentIdComparer {
|
||||||
constructor(fragments) {
|
constructor(fragments) {
|
||||||
this._fragmentsById = fragments.reduce((map, f) => {map.set(f.id, f); return map;}, new Map());
|
this._fragmentsById = fragments.reduce((map, f) => {map.set(f.id, f); return map;}, new Map());
|
||||||
this.rebuild(fragments);
|
this.rebuild(fragments);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { SortedArray, MappedList, ConcatList } from "../../../observable/index.js";
|
import {SortedArray, MappedList, ConcatList} from "../../../observable/index.js";
|
||||||
import Direction from "./Direction.js";
|
import {Direction} from "./Direction.js";
|
||||||
import TimelineReader from "./persistence/TimelineReader.js";
|
import {TimelineReader} from "./persistence/TimelineReader.js";
|
||||||
import PendingEventEntry from "./entries/PendingEventEntry.js";
|
import {PendingEventEntry} from "./entries/PendingEventEntry.js";
|
||||||
|
|
||||||
export default class Timeline {
|
export class Timeline {
|
||||||
constructor({roomId, storage, closeCallback, fragmentIdComparer, pendingEvents, user}) {
|
constructor({roomId, storage, closeCallback, fragmentIdComparer, pendingEvents, user}) {
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
//entries can be sorted, first by fragment, then by entry index.
|
//entries can be sorted, first by fragment, then by entry index.
|
||||||
import EventKey from "../EventKey.js";
|
import {EventKey} from "../EventKey.js";
|
||||||
export const PENDING_FRAGMENT_ID = Number.MAX_SAFE_INTEGER;
|
export const PENDING_FRAGMENT_ID = Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
export default class BaseEntry {
|
export class BaseEntry {
|
||||||
constructor(fragmentIdComparer) {
|
constructor(fragmentIdComparer) {
|
||||||
this._fragmentIdComparer = fragmentIdComparer;
|
this._fragmentIdComparer = fragmentIdComparer;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseEntry from "./BaseEntry.js";
|
import {BaseEntry} from "./BaseEntry.js";
|
||||||
|
|
||||||
export default class EventEntry extends BaseEntry {
|
export class EventEntry extends BaseEntry {
|
||||||
constructor(eventEntry, fragmentIdComparer) {
|
constructor(eventEntry, fragmentIdComparer) {
|
||||||
super(fragmentIdComparer);
|
super(fragmentIdComparer);
|
||||||
this._eventEntry = eventEntry;
|
this._eventEntry = eventEntry;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import BaseEntry from "./BaseEntry.js";
|
import {BaseEntry} from "./BaseEntry.js";
|
||||||
import Direction from "../Direction.js";
|
import {Direction} from "../Direction.js";
|
||||||
import {isValidFragmentId} from "../common.js";
|
import {isValidFragmentId} from "../common.js";
|
||||||
import Platform from "../../../../Platform.js";
|
import {Platform} from "../../../../Platform.js";
|
||||||
|
|
||||||
export default class FragmentBoundaryEntry extends BaseEntry {
|
export class FragmentBoundaryEntry extends BaseEntry {
|
||||||
constructor(fragment, isFragmentStart, fragmentIdComparer) {
|
constructor(fragment, isFragmentStart, fragmentIdComparer) {
|
||||||
super(fragmentIdComparer);
|
super(fragmentIdComparer);
|
||||||
this._fragment = fragment;
|
this._fragment = fragment;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseEntry, {PENDING_FRAGMENT_ID} from "./BaseEntry.js";
|
import {BaseEntry, PENDING_FRAGMENT_ID} from "./BaseEntry.js";
|
||||||
|
|
||||||
export default class PendingEventEntry extends BaseEntry {
|
export class PendingEventEntry extends BaseEntry {
|
||||||
constructor({pendingEvent, user}) {
|
constructor({pendingEvent, user}) {
|
||||||
super(null);
|
super(null);
|
||||||
this._pendingEvent = pendingEvent;
|
this._pendingEvent = pendingEvent;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import EventKey from "../EventKey.js";
|
import {EventKey} from "../EventKey.js";
|
||||||
import EventEntry from "../entries/EventEntry.js";
|
import {EventEntry} from "../entries/EventEntry.js";
|
||||||
import {createEventEntry, directionalAppend} from "./common.js";
|
import {createEventEntry, directionalAppend} from "./common.js";
|
||||||
|
|
||||||
export default class GapWriter {
|
export class GapWriter {
|
||||||
constructor({roomId, storage, fragmentIdComparer}) {
|
constructor({roomId, storage, fragmentIdComparer}) {
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import EventKey from "../EventKey.js";
|
import {EventKey} from "../EventKey.js";
|
||||||
import EventEntry from "../entries/EventEntry.js";
|
import {EventEntry} from "../entries/EventEntry.js";
|
||||||
import FragmentBoundaryEntry from "../entries/FragmentBoundaryEntry.js";
|
import {FragmentBoundaryEntry} from "../entries/FragmentBoundaryEntry.js";
|
||||||
import {createEventEntry} from "./common.js";
|
import {createEventEntry} from "./common.js";
|
||||||
|
|
||||||
// Synapse bug? where the m.room.create event appears twice in sync response
|
// Synapse bug? where the m.room.create event appears twice in sync response
|
||||||
@ -17,7 +17,7 @@ function deduplicateEvents(events) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SyncWriter {
|
export class SyncWriter {
|
||||||
constructor({roomId, fragmentIdComparer}) {
|
constructor({roomId, fragmentIdComparer}) {
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
this._fragmentIdComparer = fragmentIdComparer;
|
this._fragmentIdComparer = fragmentIdComparer;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {directionalConcat, directionalAppend} from "./common.js";
|
import {directionalConcat, directionalAppend} from "./common.js";
|
||||||
import Direction from "../Direction.js";
|
import {Direction} from "../Direction.js";
|
||||||
import EventEntry from "../entries/EventEntry.js";
|
import {EventEntry} from "../entries/EventEntry.js";
|
||||||
import FragmentBoundaryEntry from "../entries/FragmentBoundaryEntry.js";
|
import {FragmentBoundaryEntry} from "../entries/FragmentBoundaryEntry.js";
|
||||||
|
|
||||||
export default class TimelineReader {
|
export class TimelineReader {
|
||||||
constructor({roomId, storage, fragmentIdComparer}) {
|
constructor({roomId, storage, fragmentIdComparer}) {
|
||||||
this._roomId = roomId;
|
this._roomId = roomId;
|
||||||
this._storage = storage;
|
this._storage = storage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class SessionInfoStorage {
|
export class SessionInfoStorage {
|
||||||
constructor(name) {
|
constructor(name) {
|
||||||
this._name = name;
|
this._name = name;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import Storage from "./storage.js";
|
import {Storage} from "./storage.js";
|
||||||
import { openDatabase, reqAsPromise } from "./utils.js";
|
import { openDatabase, reqAsPromise } from "./utils.js";
|
||||||
import { exportSession, importSession } from "./export.js";
|
import { exportSession, importSession } from "./export.js";
|
||||||
|
|
||||||
const sessionName = sessionId => `brawl_session_${sessionId}`;
|
const sessionName = sessionId => `brawl_session_${sessionId}`;
|
||||||
const openDatabaseWithSessionId = sessionId => openDatabase(sessionName(sessionId), createStores, 1);
|
const openDatabaseWithSessionId = sessionId => openDatabase(sessionName(sessionId), createStores, 1);
|
||||||
|
|
||||||
export default class StorageFactory {
|
export class StorageFactory {
|
||||||
async create(sessionId) {
|
async create(sessionId) {
|
||||||
const db = await openDatabaseWithSessionId(sessionId);
|
const db = await openDatabaseWithSessionId(sessionId);
|
||||||
return new Storage(db);
|
return new Storage(db);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {iterateCursor, reqAsPromise} from "./utils.js";
|
import {iterateCursor, reqAsPromise} from "./utils.js";
|
||||||
|
|
||||||
export default class QueryTarget {
|
export class QueryTarget {
|
||||||
constructor(target) {
|
constructor(target) {
|
||||||
this._target = target;
|
this._target = target;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Transaction from "./transaction.js";
|
import {Transaction} from "./transaction.js";
|
||||||
import { STORE_NAMES, StorageError } from "../common.js";
|
import { STORE_NAMES, StorageError } from "../common.js";
|
||||||
|
|
||||||
export default class Storage {
|
export class Storage {
|
||||||
constructor(idbDatabase) {
|
constructor(idbDatabase) {
|
||||||
this._db = idbDatabase;
|
this._db = idbDatabase;
|
||||||
const nameMap = STORE_NAMES.reduce((nameMap, name) => {
|
const nameMap = STORE_NAMES.reduce((nameMap, name) => {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import QueryTarget from "./query-target.js";
|
import {QueryTarget} from "./query-target.js";
|
||||||
import { reqAsPromise } from "./utils.js";
|
import { reqAsPromise } from "./utils.js";
|
||||||
import { StorageError } from "../common.js";
|
import { StorageError } from "../common.js";
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class QueryTargetWrapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Store extends QueryTarget {
|
export class Store extends QueryTarget {
|
||||||
constructor(idbStore) {
|
constructor(idbStore) {
|
||||||
super(new QueryTargetWrapper(idbStore));
|
super(new QueryTargetWrapper(idbStore));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { encodeUint32, decodeUint32 } from "../utils.js";
|
import { encodeUint32, decodeUint32 } from "../utils.js";
|
||||||
import Platform from "../../../../Platform.js";
|
import {Platform} from "../../../../Platform.js";
|
||||||
|
|
||||||
function encodeKey(roomId, queueIndex) {
|
function encodeKey(roomId, queueIndex) {
|
||||||
return `${roomId}|${encodeUint32(queueIndex)}`;
|
return `${roomId}|${encodeUint32(queueIndex)}`;
|
||||||
@ -11,7 +11,7 @@ function decodeKey(key) {
|
|||||||
return {roomId, queueIndex};
|
return {roomId, queueIndex};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class PendingEventStore {
|
export class PendingEventStore {
|
||||||
constructor(eventStore) {
|
constructor(eventStore) {
|
||||||
this._eventStore = eventStore;
|
this._eventStore = eventStore;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class RoomStateStore {
|
export class RoomStateStore {
|
||||||
constructor(idbStore) {
|
constructor(idbStore) {
|
||||||
this._roomStateStore = idbStore;
|
this._roomStateStore = idbStore;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ store contains:
|
|||||||
inviteCount
|
inviteCount
|
||||||
joinCount
|
joinCount
|
||||||
*/
|
*/
|
||||||
export default class RoomSummaryStore {
|
export class RoomSummaryStore {
|
||||||
constructor(summaryStore) {
|
constructor(summaryStore) {
|
||||||
this._summaryStore = summaryStore;
|
this._summaryStore = summaryStore;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ store contains:
|
|||||||
avatarUrl
|
avatarUrl
|
||||||
lastSynced
|
lastSynced
|
||||||
*/
|
*/
|
||||||
export default class SessionStore {
|
export class SessionStore {
|
||||||
constructor(sessionStore) {
|
constructor(sessionStore) {
|
||||||
this._sessionStore = sessionStore;
|
this._sessionStore = sessionStore;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import EventKey from "../../../room/timeline/EventKey.js";
|
import {EventKey} from "../../../room/timeline/EventKey.js";
|
||||||
import { StorageError } from "../../common.js";
|
import { StorageError } from "../../common.js";
|
||||||
import { encodeUint32 } from "../utils.js";
|
import { encodeUint32 } from "../utils.js";
|
||||||
import Platform from "../../../../Platform.js";
|
import {Platform} from "../../../../Platform.js";
|
||||||
|
|
||||||
function encodeKey(roomId, fragmentId, eventIndex) {
|
function encodeKey(roomId, fragmentId, eventIndex) {
|
||||||
return `${roomId}|${encodeUint32(fragmentId)}|${encodeUint32(eventIndex)}`;
|
return `${roomId}|${encodeUint32(fragmentId)}|${encodeUint32(eventIndex)}`;
|
||||||
@ -81,7 +81,7 @@ class Range {
|
|||||||
* @property {?Event} event if an event entry, the event
|
* @property {?Event} event if an event entry, the event
|
||||||
* @property {?Gap} gap if a gap entry, the gap
|
* @property {?Gap} gap if a gap entry, the gap
|
||||||
*/
|
*/
|
||||||
export default class TimelineEventStore {
|
export class TimelineEventStore {
|
||||||
constructor(timelineStore) {
|
constructor(timelineStore) {
|
||||||
this._timelineStore = timelineStore;
|
this._timelineStore = timelineStore;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { StorageError } from "../../common.js";
|
import { StorageError } from "../../common.js";
|
||||||
import Platform from "../../../../Platform.js";
|
import {Platform} from "../../../../Platform.js";
|
||||||
import { encodeUint32 } from "../utils.js";
|
import { encodeUint32 } from "../utils.js";
|
||||||
|
|
||||||
function encodeKey(roomId, fragmentId) {
|
function encodeKey(roomId, fragmentId) {
|
||||||
return `${roomId}|${encodeUint32(fragmentId)}`;
|
return `${roomId}|${encodeUint32(fragmentId)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class RoomFragmentStore {
|
export class TimelineFragmentStore {
|
||||||
constructor(store) {
|
constructor(store) {
|
||||||
this._store = store;
|
this._store = store;
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {txnAsPromise} from "./utils.js";
|
import {txnAsPromise} from "./utils.js";
|
||||||
import {StorageError} from "../common.js";
|
import {StorageError} from "../common.js";
|
||||||
import Store from "./store.js";
|
import {Store} from "./store.js";
|
||||||
import SessionStore from "./stores/SessionStore.js";
|
import {SessionStore} from "./stores/SessionStore.js";
|
||||||
import RoomSummaryStore from "./stores/RoomSummaryStore.js";
|
import {RoomSummaryStore} from "./stores/RoomSummaryStore.js";
|
||||||
import TimelineEventStore from "./stores/TimelineEventStore.js";
|
import {TimelineEventStore} from "./stores/TimelineEventStore.js";
|
||||||
import RoomStateStore from "./stores/RoomStateStore.js";
|
import {RoomStateStore} from "./stores/RoomStateStore.js";
|
||||||
import TimelineFragmentStore from "./stores/TimelineFragmentStore.js";
|
import {TimelineFragmentStore} from "./stores/TimelineFragmentStore.js";
|
||||||
import PendingEventStore from "./stores/PendingEventStore.js";
|
import {PendingEventStore} from "./stores/PendingEventStore.js";
|
||||||
|
|
||||||
export default class Transaction {
|
export class Transaction {
|
||||||
constructor(txn, allowedStoreNames) {
|
constructor(txn, allowedStoreNames) {
|
||||||
this._txn = txn;
|
this._txn = txn;
|
||||||
this._allowedStoreNames = allowedStoreNames;
|
this._allowedStoreNames = allowedStoreNames;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Transaction from "./transaction.js";
|
import {Transaction} from "./transaction.js";
|
||||||
import { STORE_MAP, STORE_NAMES } from "../common.js";
|
import { STORE_MAP, STORE_NAMES } from "../common.js";
|
||||||
|
|
||||||
export default class Storage {
|
export class Storage {
|
||||||
constructor(initialStoreValues = {}) {
|
constructor(initialStoreValues = {}) {
|
||||||
this._validateStoreNames(Object.keys(initialStoreValues));
|
this._validateStoreNames(Object.keys(initialStoreValues));
|
||||||
this.storeNames = STORE_MAP;
|
this.storeNames = STORE_MAP;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import RoomTimelineStore from "./stores/RoomTimelineStore.js";
|
import {RoomTimelineStore} from "./stores/RoomTimelineStore.js";
|
||||||
|
|
||||||
export default class Transaction {
|
export class Transaction {
|
||||||
constructor(storeValues, writable) {
|
constructor(storeValues, writable) {
|
||||||
this._storeValues = storeValues;
|
this._storeValues = storeValues;
|
||||||
this._txnStoreValues = {};
|
this._txnStoreValues = {};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import SortKey from "../../room/timeline/SortKey.js";
|
import {SortKey} from "../../room/timeline/SortKey.js";
|
||||||
import sortedIndex from "../../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../../utils/sortedIndex.js";
|
||||||
import Store from "./Store.js";
|
import {Store} from "./Store.js";
|
||||||
|
|
||||||
function compareKeys(key, entry) {
|
function compareKeys(key, entry) {
|
||||||
if (key.roomId === entry.roomId) {
|
if (key.roomId === entry.roomId) {
|
||||||
@ -65,7 +65,7 @@ class Range {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class RoomTimelineStore extends Store {
|
export class RoomTimelineStore extends Store {
|
||||||
constructor(timeline, writable) {
|
constructor(timeline, writable) {
|
||||||
super(timeline || [], writable);
|
super(timeline || [], writable);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class Store {
|
export class Store {
|
||||||
constructor(storeValue, writable) {
|
constructor(storeValue, writable) {
|
||||||
this._storeValue = storeValue;
|
this._storeValue = storeValue;
|
||||||
this._writable = writable;
|
this._writable = writable;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import ObservableValue from "../observable/ObservableValue.js";
|
import {ObservableValue} from "../observable/ObservableValue.js";
|
||||||
|
|
||||||
class Timeout {
|
class Timeout {
|
||||||
constructor(elapsed, ms) {
|
constructor(elapsed, ms) {
|
||||||
@ -29,7 +29,7 @@ class TimeMeasure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Clock {
|
export class Clock {
|
||||||
constructor(baseTimestamp = 0) {
|
constructor(baseTimestamp = 0) {
|
||||||
this._baseTimestamp = baseTimestamp;
|
this._baseTimestamp = baseTimestamp;
|
||||||
this._elapsed = new ObservableValue(0);
|
this._elapsed = new ObservableValue(0);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class BaseObservable {
|
export class BaseObservable {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._handlers = new Set();
|
this._handlers = new Set();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {AbortError} from "../utils/error.js";
|
import {AbortError} from "../utils/error.js";
|
||||||
import BaseObservable from "./BaseObservable.js";
|
import {BaseObservable} from "./BaseObservable.js";
|
||||||
|
|
||||||
// like an EventEmitter, but doesn't have an event type
|
// like an EventEmitter, but doesn't have an event type
|
||||||
export class BaseObservableValue extends BaseObservable {
|
export class BaseObservableValue extends BaseObservable {
|
||||||
@ -49,7 +49,7 @@ class ResolvedWaitForHandle {
|
|||||||
dispose() {}
|
dispose() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ObservableValue extends BaseObservableValue {
|
export class ObservableValue extends BaseObservableValue {
|
||||||
constructor(initialValue) {
|
constructor(initialValue) {
|
||||||
super();
|
super();
|
||||||
this._value = initialValue;
|
this._value = initialValue;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import SortedMapList from "./list/SortedMapList.js";
|
import {SortedMapList} from "./list/SortedMapList.js";
|
||||||
import FilteredMap from "./map/FilteredMap.js";
|
import {FilteredMap} from "./map/FilteredMap.js";
|
||||||
import MappedMap from "./map/MappedMap.js";
|
import {MappedMap} from "./map/MappedMap.js";
|
||||||
import BaseObservableMap from "./map/BaseObservableMap.js";
|
import {BaseObservableMap} from "./map/BaseObservableMap.js";
|
||||||
// re-export "root" (of chain) collections
|
// re-export "root" (of chain) collections
|
||||||
export { default as ObservableArray } from "./list/ObservableArray.js";
|
export { ObservableArray } from "./list/ObservableArray.js";
|
||||||
export { default as SortedArray } from "./list/SortedArray.js";
|
export { SortedArray } from "./list/SortedArray.js";
|
||||||
export { default as MappedList } from "./list/MappedList.js";
|
export { MappedList } from "./list/MappedList.js";
|
||||||
export { default as ConcatList } from "./list/ConcatList.js";
|
export { ConcatList } from "./list/ConcatList.js";
|
||||||
export { default as ObservableMap } from "./map/ObservableMap.js";
|
export { ObservableMap } from "./map/ObservableMap.js";
|
||||||
|
|
||||||
// avoid circular dependency between these classes
|
// avoid circular dependency between these classes
|
||||||
// and BaseObservableMap (as they extend it)
|
// and BaseObservableMap (as they extend it)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservable from "../BaseObservable.js";
|
import {BaseObservable} from "../BaseObservable.js";
|
||||||
|
|
||||||
export default class BaseObservableList extends BaseObservable {
|
export class BaseObservableList extends BaseObservable {
|
||||||
emitReset() {
|
emitReset() {
|
||||||
for(let h of this._handlers) {
|
for(let h of this._handlers) {
|
||||||
h.onReset(this);
|
h.onReset(this);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservableList from "./BaseObservableList.js";
|
import {BaseObservableList} from "./BaseObservableList.js";
|
||||||
|
|
||||||
export default class ConcatList extends BaseObservableList {
|
export class ConcatList extends BaseObservableList {
|
||||||
constructor(...sourceLists) {
|
constructor(...sourceLists) {
|
||||||
super();
|
super();
|
||||||
this._sourceLists = sourceLists;
|
this._sourceLists = sourceLists;
|
||||||
@ -86,7 +86,7 @@ export default class ConcatList extends BaseObservableList {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import ObservableArray from "./ObservableArray.js";
|
import {ObservableArray} from "./ObservableArray.js";
|
||||||
export async function tests() {
|
export async function tests() {
|
||||||
return {
|
return {
|
||||||
test_length(assert) {
|
test_length(assert) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservableList from "./BaseObservableList.js";
|
import {BaseObservableList} from "./BaseObservableList.js";
|
||||||
|
|
||||||
export default class MappedList extends BaseObservableList {
|
export class MappedList extends BaseObservableList {
|
||||||
constructor(sourceList, mapper, updater) {
|
constructor(sourceList, mapper, updater) {
|
||||||
super();
|
super();
|
||||||
this._sourceList = sourceList;
|
this._sourceList = sourceList;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservableList from "./BaseObservableList.js";
|
import {BaseObservableList} from "./BaseObservableList.js";
|
||||||
|
|
||||||
export default class ObservableArray extends BaseObservableList {
|
export class ObservableArray extends BaseObservableList {
|
||||||
constructor(initialValues = []) {
|
constructor(initialValues = []) {
|
||||||
super();
|
super();
|
||||||
this._items = initialValues;
|
this._items = initialValues;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import BaseObservableList from "./BaseObservableList.js";
|
import {BaseObservableList} from "./BaseObservableList.js";
|
||||||
import sortedIndex from "../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../utils/sortedIndex.js";
|
||||||
|
|
||||||
export default class SortedArray extends BaseObservableList {
|
export class SortedArray extends BaseObservableList {
|
||||||
constructor(comparator) {
|
constructor(comparator) {
|
||||||
super();
|
super();
|
||||||
this._comparator = comparator;
|
this._comparator = comparator;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import BaseObservableList from "./BaseObservableList.js";
|
import {BaseObservableList} from "./BaseObservableList.js";
|
||||||
import sortedIndex from "../../utils/sortedIndex.js";
|
import {sortedIndex} from "../../utils/sortedIndex.js";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ with a node containing {value, leftCount, rightCount, leftNode, rightNode, paren
|
|||||||
// types modified outside of the collection (and affecting sort order) or not
|
// types modified outside of the collection (and affecting sort order) or not
|
||||||
|
|
||||||
// no duplicates allowed for now
|
// no duplicates allowed for now
|
||||||
export default class SortedMapList extends BaseObservableList {
|
export class SortedMapList extends BaseObservableList {
|
||||||
constructor(sourceMap, comparator) {
|
constructor(sourceMap, comparator) {
|
||||||
super();
|
super();
|
||||||
this._sourceMap = sourceMap;
|
this._sourceMap = sourceMap;
|
||||||
@ -114,7 +114,7 @@ export default class SortedMapList extends BaseObservableList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef TESTS
|
//#ifdef TESTS
|
||||||
import ObservableMap from "../map/ObservableMap.js";
|
import {ObservableMap} from "../map/ObservableMap.js";
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
return {
|
return {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservable from "../BaseObservable.js";
|
import {BaseObservable} from "../BaseObservable.js";
|
||||||
|
|
||||||
export default class BaseObservableMap extends BaseObservable {
|
export class BaseObservableMap extends BaseObservable {
|
||||||
emitReset() {
|
emitReset() {
|
||||||
for(let h of this._handlers) {
|
for(let h of this._handlers) {
|
||||||
h.onReset();
|
h.onReset();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservableMap from "./BaseObservableMap.js";
|
import {BaseObservableMap} from "./BaseObservableMap.js";
|
||||||
|
|
||||||
export default class FilteredMap extends BaseObservableMap {
|
export class FilteredMap extends BaseObservableMap {
|
||||||
constructor(source, mapper, updater) {
|
constructor(source, mapper, updater) {
|
||||||
super();
|
super();
|
||||||
this._source = source;
|
this._source = source;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import BaseObservableMap from "./BaseObservableMap.js";
|
import {BaseObservableMap} from "./BaseObservableMap.js";
|
||||||
/*
|
/*
|
||||||
so a mapped value can emit updates on it's own with this._updater that is passed in the mapping function
|
so a mapped value can emit updates on it's own with this._updater that is passed in the mapping function
|
||||||
how should the mapped value be notified of an update though? and can it then decide to not propagate the update?
|
how should the mapped value be notified of an update though? and can it then decide to not propagate the update?
|
||||||
*/
|
*/
|
||||||
export default class MappedMap extends BaseObservableMap {
|
export class MappedMap extends BaseObservableMap {
|
||||||
constructor(source, mapper) {
|
constructor(source, mapper) {
|
||||||
super();
|
super();
|
||||||
this._source = source;
|
this._source = source;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import BaseObservableMap from "./BaseObservableMap.js";
|
import {BaseObservableMap} from "./BaseObservableMap.js";
|
||||||
|
|
||||||
export default class ObservableMap extends BaseObservableMap {
|
export class ObservableMap extends BaseObservableMap {
|
||||||
constructor(initialValues) {
|
constructor(initialValues) {
|
||||||
super();
|
super();
|
||||||
this._values = new Map(initialValues);
|
this._values = new Map(initialValues);
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import SessionView from "./session/SessionView.js";
|
import {SessionView} from "./session/SessionView.js";
|
||||||
import LoginView from "./login/LoginView.js";
|
import {LoginView} from "./login/LoginView.js";
|
||||||
import SessionPickerView from "./login/SessionPickerView.js";
|
import {SessionPickerView} from "./login/SessionPickerView.js";
|
||||||
import TemplateView from "./general/TemplateView.js";
|
import {TemplateView} from "./general/TemplateView.js";
|
||||||
import SwitchView from "./general/SwitchView.js";
|
import {SwitchView} from "./general/SwitchView.js";
|
||||||
|
|
||||||
export default class BrawlView {
|
export class BrawlView {
|
||||||
constructor(vm) {
|
constructor(vm) {
|
||||||
this._vm = vm;
|
this._vm = vm;
|
||||||
this._switcher = null;
|
this._switcher = null;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default {
|
export const WebPlatform = {
|
||||||
get minStorageKey() {
|
get minStorageKey() {
|
||||||
// for indexeddb, we use unsigned 32 bit integers as keys
|
// for indexeddb, we use unsigned 32 bit integers as keys
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -37,7 +37,7 @@ class TimeMeasure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Clock {
|
export class Clock {
|
||||||
createMeasure() {
|
createMeasure() {
|
||||||
return new TimeMeasure();
|
return new TimeMeasure();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {BaseObservableValue} from "../../../observable/ObservableValue.js";
|
import {BaseObservableValue} from "../../../observable/ObservableValue.js";
|
||||||
|
|
||||||
export default class OnlineStatus extends BaseObservableValue {
|
export class OnlineStatus extends BaseObservableValue {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._onOffline = this._onOffline.bind(this);
|
this._onOffline = this._onOffline.bind(this);
|
||||||
|
@ -10,7 +10,7 @@ function insertAt(parentNode, idx, childNode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class ListView {
|
export class ListView {
|
||||||
constructor({list, onItemClick, className}, childCreator) {
|
constructor({list, onItemClick, className}, childCreator) {
|
||||||
this._onItemClick = onItemClick;
|
this._onItemClick = onItemClick;
|
||||||
this._list = list;
|
this._list = list;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export default class SwitchView {
|
export class SwitchView {
|
||||||
constructor(defaultView) {
|
constructor(defaultView) {
|
||||||
this._childView = defaultView;
|
this._childView = defaultView;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ function objHasFns(obj) {
|
|||||||
missing:
|
missing:
|
||||||
- create views
|
- create views
|
||||||
*/
|
*/
|
||||||
export default class Template {
|
export class Template {
|
||||||
constructor(value, render) {
|
constructor(value, render) {
|
||||||
this._value = value;
|
this._value = value;
|
||||||
this._eventListeners = null;
|
this._eventListeners = null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Template from "./Template.js";
|
import {Template} from "./Template.js";
|
||||||
|
|
||||||
export default class TemplateView {
|
export class TemplateView {
|
||||||
constructor(vm, bindToChangeEvent) {
|
constructor(vm, bindToChangeEvent) {
|
||||||
this.viewModel = vm;
|
this.viewModel = vm;
|
||||||
this._changeEventHandler = bindToChangeEvent ? this.update.bind(this, this.viewModel) : null;
|
this._changeEventHandler = bindToChangeEvent ? this.update.bind(this, this.viewModel) : null;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import TemplateView from "../general/TemplateView.js";
|
import {TemplateView} from "../general/TemplateView.js";
|
||||||
import {brawlGithubLink} from "./common.js";
|
import {brawlGithubLink} from "./common.js";
|
||||||
|
|
||||||
export default class LoginView extends TemplateView {
|
export class LoginView extends TemplateView {
|
||||||
constructor(vm) {
|
constructor(vm) {
|
||||||
super(vm, true);
|
super(vm, true);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import ListView from "../general/ListView.js";
|
import {ListView} from "../general/ListView.js";
|
||||||
import TemplateView from "../general/TemplateView.js";
|
import {TemplateView} from "../general/TemplateView.js";
|
||||||
import {brawlGithubLink} from "./common.js";
|
import {brawlGithubLink} from "./common.js";
|
||||||
|
|
||||||
function selectFileAsText(mimeType) {
|
function selectFileAsText(mimeType) {
|
||||||
@ -71,7 +71,7 @@ class SessionPickerItemView extends TemplateView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SessionPickerView extends TemplateView {
|
export class SessionPickerView extends TemplateView {
|
||||||
mount() {
|
mount() {
|
||||||
this._sessionList = new ListView({
|
this._sessionList = new ListView({
|
||||||
list: this.viewModel.sessions,
|
list: this.viewModel.sessions,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {tag} from "../general/html.js";
|
import {tag} from "../general/html.js";
|
||||||
|
|
||||||
export default class RoomPlaceholderView {
|
export class RoomPlaceholderView {
|
||||||
constructor() {
|
constructor() {
|
||||||
this._root = null;
|
this._root = null;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import TemplateView from "../general/TemplateView.js";
|
import {TemplateView} from "../general/TemplateView.js";
|
||||||
|
|
||||||
export default class RoomTile extends TemplateView {
|
export class RoomTile extends TemplateView {
|
||||||
render(t) {
|
render(t) {
|
||||||
return t.li([
|
return t.li([
|
||||||
t.div({className: "avatar medium"}, vm => vm.avatarInitials),
|
t.div({className: "avatar medium"}, vm => vm.avatarInitials),
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import ListView from "../general/ListView.js";
|
import {ListView} from "../general/ListView.js";
|
||||||
import RoomTile from "./RoomTile.js";
|
import {RoomTile} from "./RoomTile.js";
|
||||||
import RoomView from "./room/RoomView.js";
|
import {RoomView} from "./room/RoomView.js";
|
||||||
import SwitchView from "../general/SwitchView.js";
|
import {SwitchView} from "../general/SwitchView.js";
|
||||||
import RoomPlaceholderView from "./RoomPlaceholderView.js";
|
import {RoomPlaceholderView} from "./RoomPlaceholderView.js";
|
||||||
import SyncStatusBar from "./SyncStatusBar.js";
|
import {SyncStatusBar} from "./SyncStatusBar.js";
|
||||||
import {tag} from "../general/html.js";
|
import {tag} from "../general/html.js";
|
||||||
|
|
||||||
export default class SessionView {
|
export class SessionView {
|
||||||
constructor(viewModel) {
|
constructor(viewModel) {
|
||||||
this._viewModel = viewModel;
|
this._viewModel = viewModel;
|
||||||
this._middleSwitcher = null;
|
this._middleSwitcher = null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import TemplateView from "../general/TemplateView.js";
|
import {TemplateView} from "../general/TemplateView.js";
|
||||||
|
|
||||||
export default class SyncStatusBar extends TemplateView {
|
export class SyncStatusBar extends TemplateView {
|
||||||
constructor(vm) {
|
constructor(vm) {
|
||||||
super(vm, true);
|
super(vm, true);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import TemplateView from "../../general/TemplateView.js";
|
import {TemplateView} from "../../general/TemplateView.js";
|
||||||
|
|
||||||
export default class MessageComposer extends TemplateView {
|
export class MessageComposer extends TemplateView {
|
||||||
constructor(viewModel) {
|
constructor(viewModel) {
|
||||||
super(viewModel);
|
super(viewModel);
|
||||||
this._input = null;
|
this._input = null;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import TemplateView from "../../general/TemplateView.js";
|
import {TemplateView} from "../../general/TemplateView.js";
|
||||||
import TimelineList from "./TimelineList.js";
|
import {TimelineList} from "./TimelineList.js";
|
||||||
import MessageComposer from "./MessageComposer.js";
|
import {MessageComposer} from "./MessageComposer.js";
|
||||||
|
|
||||||
export default class RoomView extends TemplateView {
|
export class RoomView extends TemplateView {
|
||||||
constructor(viewModel) {
|
constructor(viewModel) {
|
||||||
super(viewModel, true);
|
super(viewModel, true);
|
||||||
this._timelineList = null;
|
this._timelineList = null;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import ListView from "../../general/ListView.js";
|
import {ListView} from "../../general/ListView.js";
|
||||||
import GapView from "./timeline/GapView.js";
|
import {GapView} from "./timeline/GapView.js";
|
||||||
import TextMessageView from "./timeline/TextMessageView.js";
|
import {TextMessageView} from "./timeline/TextMessageView.js";
|
||||||
import AnnouncementView from "./timeline/AnnouncementView.js";
|
import {AnnouncementView} from "./timeline/AnnouncementView.js";
|
||||||
|
|
||||||
export default class TimelineList extends ListView {
|
export class TimelineList extends ListView {
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
options.className = "Timeline";
|
options.className = "Timeline";
|
||||||
super(options, entry => {
|
super(options, entry => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import TemplateView from "../../../general/TemplateView.js";
|
import {TemplateView} from "../../../general/TemplateView.js";
|
||||||
|
|
||||||
export default class AnnouncementView extends TemplateView {
|
export class AnnouncementView extends TemplateView {
|
||||||
render(t) {
|
render(t) {
|
||||||
return t.li({className: "AnnouncementView"}, t.div(vm => vm.announcement));
|
return t.li({className: "AnnouncementView"}, t.div(vm => vm.announcement));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import TemplateView from "../../../general/TemplateView.js";
|
import {TemplateView} from "../../../general/TemplateView.js";
|
||||||
|
|
||||||
export default class GapView extends TemplateView {
|
export class GapView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
const className = {
|
const className = {
|
||||||
GapView: true,
|
GapView: true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import TemplateView from "../../../general/TemplateView.js";
|
import {TemplateView} from "../../../general/TemplateView.js";
|
||||||
|
|
||||||
export default class TextMessageView extends TemplateView {
|
export class TextMessageView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
// no bindings ... should this be a template view?
|
// no bindings ... should this be a template view?
|
||||||
return t.li(
|
return t.li(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {tag} from "../../../general/html.js";
|
import {tag} from "../../../general/html.js";
|
||||||
|
|
||||||
export default class TimelineTile {
|
export class TimelineTile {
|
||||||
constructor(tileVM) {
|
constructor(tileVM) {
|
||||||
this._tileVM = tileVM;
|
this._tileVM = tileVM;
|
||||||
this._root = null;
|
this._root = null;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
export default function createEnum(...values) {
|
export function createEnum(...values) {
|
||||||
const obj = {};
|
const obj = {};
|
||||||
for (const value of values) {
|
for (const value of values) {
|
||||||
obj[value] = value;
|
obj[value] = value;
|
||||||
}
|
}
|
||||||
return Object.freeze(obj);
|
return Object.freeze(obj);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||||
*/
|
*/
|
||||||
export default function sortedIndex(array, value, comparator) {
|
export function sortedIndex(array, value, comparator) {
|
||||||
let low = 0;
|
let low = 0;
|
||||||
let high = array.length;
|
let high = array.length;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user