コード例 #1
0
ファイル: fileview.js プロジェクト: mikeblackstock/OS.js
  set(param, value, arg, arg2) {
    const el = this.$element;

    if ( param === 'type' ) {
      const firstChild = el.children[0];
      if ( firstChild && firstChild.tagName.toLowerCase() === value ) {
        return true;
      }

      el.setAttribute('data-type', value);
      this.buildChildView();

      if ( typeof arg === 'undefined' || arg === true ) {
        this.chdir({
          path: el.getAttribute('data-path')
        });
      }
      return this;
    } else if ( (['filter', 'dotfiles', 'filetype', 'extensions', 'defaultcolumns', 'sortby', 'sortdir']).indexOf(param) >= 0 ) {
      GUI.setProperty(el, param, value);
      return this;
    }

    const childView = this.getChildView();
    if ( childView ) {
      return childView.set.apply(childView, arguments);
    }
    return GUIDataView.prototype.set.apply(this, arguments);
  }
コード例 #2
0
ファイル: element.js プロジェクト: mikeblackstock/OS.js
 /**
  * Sets a parameter/property by name
  *
  * @param   {String}    param     Parameter name
  * @param   {*}         value     Parameter value
  * @param   {*}         [arg]     Extra argument ...
  * @param   {*}         [arg2]    Extra argument ...
  *
  * @return {GUIElement} The current instance (this)
  */
 set(param, value, arg, arg2) {
   if ( this.$element ) {
     GUI.setProperty(this.$element, param, value, arg, arg2);
   }
   return this;
 }