mobx#ObservableMap TypeScript Examples

The following examples show how to use mobx#ObservableMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Layout.ts    From revite with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
     * Construct new Layout store.
     */
    constructor() {
        this.lastSection = "home";
        this.lastHomePath = "/";
        this.lastDiscoverPath = "/discover/servers";
        this.lastOpened = new ObservableMap();
        this.openSections = new ObservableMap();

        this.getLastHomePath = this.getLastHomePath.bind(this);

        makeAutoObservable(this);
    }
Example #2
Source File: ChannelList.stories.tsx    From lightning-terminal with MIT License 6 votes vote down vote up
channelSubset = (channels: ObservableMap<string, Channel>) => {
  const few = values(channels)
    .slice(0, 20)
    .reduce((result, c) => {
      result[c.chanId] = c;
      return result;
    }, {} as Record<string, Channel>);
  return observable.map(few);
}
Example #3
Source File: Unreads.ts    From revolt.js with MIT License 6 votes vote down vote up
/**
     * Construct new Unreads store.
     */
    constructor(client: Client) {
        this.channels = new ObservableMap();
        this.loaded = false;
        makeAutoObservable(this);
        this.client = client;
    }
Example #4
Source File: Auth.ts    From revite with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
     * Construct new Auth store.
     */
    constructor() {
        this.sessions = new ObservableMap();
        this.current = null;

        // Inject session token if it is provided.
        if (import.meta.env.VITE_SESSION_TOKEN) {
            this.sessions.set("0", {
                session: {
                    name: "0",
                    user_id: "0",
                    token: import.meta.env.VITE_SESSION_TOKEN as string,
                },
            });

            this.current = "0";
        }

        makeAutoObservable(this);
    }
Example #5
Source File: Sync.ts    From revite with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
     * Construct new Sync store.
     */
    constructor(state: State) {
        this.state = state;
        this.disabled = new ObservableSet();
        this.revision = new ObservableMap();
        makeAutoObservable(this);
        this.isEnabled = this.isEnabled.bind(this);
    }
Example #6
Source File: Settings.ts    From revite with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
     * Construct new Settings store.
     */
    constructor() {
        this.data = new ObservableMap();
        makeAutoObservable(this);

        this.theme = new STheme(this);
        this.sounds = new SAudio(this);
        this.security = new SSecurity(this);
    }
Example #7
Source File: Plugins.ts    From revite with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
     * Construct new Draft store.
     */
    constructor(state: State) {
        this.plugins = new ObservableMap();
        this.instances = new Map();
        makeAutoObservable(this);

        this.state = state;
    }
Example #8
Source File: Plugins.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private plugins: ObservableMap<string, Plugin>;
Example #9
Source File: Layout.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
     * Map of last channels viewed in servers.
     */
    private lastOpened: ObservableMap<string, string>;
Example #10
Source File: Layout.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
     * Map of section IDs to their current state.
     */
    private openSections: ObservableMap<string, boolean>;
Example #11
Source File: NotificationOptions.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
     * Construct new Experiments store.
     */
    constructor() {
        this.server = new ObservableMap();
        this.channel = new ObservableMap();
        makeAutoObservable(this);
    }
Example #12
Source File: NotificationOptions.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private server: ObservableMap<string, NotificationState>;
Example #13
Source File: NotificationOptions.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private channel: ObservableMap<string, NotificationState>;
Example #14
Source File: Draft.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
     * Construct new Draft store.
     */
    constructor() {
        this.drafts = new ObservableMap();
        makeAutoObservable(this);
    }
Example #15
Source File: Settings.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private data: ObservableMap<string, unknown>;
Example #16
Source File: Sync.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private revision: ObservableMap<string, number>;
Example #17
Source File: Collection.ts    From revolt.js with MIT License 5 votes vote down vote up
export default class Collection<K, V> extends ObservableMap<K, V> {
    client: Client;

    constructor(client: Client) {
        super();
        this.client = client;
    }
}
Example #18
Source File: Unreads.ts    From revolt.js with MIT License 5 votes vote down vote up
private channels: ObservableMap<string, Omit<ChannelUnread, "_id">>;
Example #19
Source File: Draft.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private drafts: ObservableMap<string, string>;
Example #20
Source File: Security.ts    From jmix-frontend with Apache License 2.0 5 votes vote down vote up
attrPermissionCache: ObservableMap<string, EntityAttrPermissionValue> = new ObservableMap();
Example #21
Source File: Auth.ts    From revite with GNU Affero General Public License v3.0 5 votes vote down vote up
private sessions: ObservableMap<string, Account>;
Example #22
Source File: swapStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** a list of channels used in pending swaps. mapping of chanId to an array of swap IDs */
  swappedChannels: ObservableMap<string, string[]> = observable.map();
Example #23
Source File: swapStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of swaps */
  swaps: ObservableMap<string, Swap> = observable.map();
Example #24
Source File: sessionStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of sessions */
  sessions: ObservableMap<string, Session> = observable.map();
Example #25
Source File: orderStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of leases */
  leases: ObservableMap<string, Lease> = observable.map();
Example #26
Source File: orderStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of orders */
  orders: ObservableMap<string, Order> = observable.map();
Example #27
Source File: channelStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of pending channels mapped by channelPoint */
  pendingChannels: ObservableMap<string, Channel> = observable.map();
Example #28
Source File: channelStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of open channels mapped by chanId */
  channels: ObservableMap<string, Channel> = observable.map();
Example #29
Source File: batchStore.ts    From lightning-terminal with MIT License 5 votes vote down vote up
/** the collection of markets (batches grouped by lease duration) */
  markets: ObservableMap<LeaseDuration, Market> = observable.map();