Skip to content
Snippets Groups Projects
Select Git revision
  • eb8fe6a28be96fa6d6659e67e8ccf15f594eb1b3
  • master default protected
  • ci-megalinter-speedup
  • e-infra2
  • egi-fixes
  • e-infra
  • envri-hub-new-aai
  • egi-b2drop-no-collapse
  • lfs
  • gpu_staging
  • resurrect-testing-ownloud
  • experiments/collab
  • update_claim_group_keys
  • envri-hub
  • enable_rtc
  • eosc-ui
  • future/jupyterhub-5.x
  • versioning
  • eosc-templating
  • staging1-raw-image
  • token-exchange
21 results

ansible.cfg

Blame
  • controller.ts 1.18 KiB
    /*
     * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * Adapted from LiteMol
     * Copyright (c) 2016 - now David Sehnal, licensed under Apache 2.0, See LICENSE file for more info.
     */
    
    import { BehaviorSubject } from 'rxjs';
    import { merge } from 'mol-util';
    import { Context } from '../context/context'
    import { LayoutRegion } from './layout';
    
    export class Controller<State> {
    
        private _state = new BehaviorSubject<State>(<any>void 0);
        private _latestState: State = <any>void 0;
    
        get dispatcher() {
            return this.context.dispatcher;
        }
    
        setState(...states: Partial<State>[]) {
            let s = merge(this._latestState, ...states);
            if (s !== this._latestState) {
                this._latestState = s;
                this._state.next(s);
            }
        }
    
        get state() {
            return this._state;
        }
    
        get latestState() {
            return this._latestState;
        }
    
        constructor(public context: Context, initialState: State) {
            this._latestState = initialState;
        }
    }
    
    export interface ControllerInfo {
        key: string;
        controller: Controller<any>;
        view: any;
        region: LayoutRegion;
        isStatic?: boolean;
    }