How to use the phovea_core/src/session.retrieve function in phovea_core

To help you get started, we’ve selected a few phovea_core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Caleydo / ordino / src / form / internal / FormInputText.ts View on Github external
protected build() {
    super.build();
    this.$input = this.$node.append('input').attr('type', (this.desc.options || {}).type || 'text');
    this.setAttributes(this.$input, this.desc.attributes);

    const defaultValue = (this.desc.options || {}).type === 'number' ? '0' : '';
    if (this.desc.useSession) {
      this.$input.property('value', session.retrieve(this.id + '_value', defaultValue));
    } else {
      this.$input.property('value', defaultValue);
    }

    this.handleShowIf();

    // propagate change action with the data of the selected option
    this.$input.on('change.propagate', () => {
      if (this.desc.useSession) {
        session.store(this.id+'_value', this.value);
      }
      this.fire('change', this.value, this.$input);
    });
  }
github Caleydo / ordino / src / form / internal / FormCheckBox.ts View on Github external
protected build() {
    super.build();
    const $label = this.$node.select('label');
    if ($label.empty()) {
      this.$input = this.$node.append('input').attr('type', 'checkbox');
    } else {
      this.$input = $label.html(`<input type="checkbox">${$label.text()}`).select('input');
    }
    this.setAttributes(this.$input, this.desc.attributes);
    this.$input.classed('form-control', false); //remove falsy class again

    const options = this.desc.options;
    if (this.desc.useSession) {
      this.$input.property('checked', session.retrieve(this.id + '_value', options.unchecked) === options.checked);
    } else {
      this.$input.property('checked', false);
    }

    this.handleShowIf();

    // propagate change action with the data of the selected option
    this.$input.on('change.propagate', () =&gt; {
      if (this.desc.useSession) {
        session.store(this.id+'_value', this.value);
      }
      this.fire('change', this.value, this.$input);
    });
  }
github Caleydo / ordino / src / storage.ts View on Github external
    sets = sets.filter((d) => d.creator === retrieve('username'));
    return sets;
github Caleydo / ordino / src / storage.ts View on Github external
export function saveNamedSet(name: string, idType: IDType|string, ids: RangeLike, subType: {key:string, value:string}, description = '') {
  const data = {
    name,
    type: ENamedSetType.NAMEDSET,
    creator: retrieve('username', 'Anonymous'),
    idType: resolve(idType).id,
    ids: parse(ids).toString(),
    subTypeKey: subType.key,
    subTypeValue: subType.value,
    description
  };
  return sendAPI('/targid/storage/namedsets/', data, 'POST');
}