当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript signaling.defineSignal函数代码示例

本文整理汇总了TypeScript中phosphor/lib/core/signaling.defineSignal函数的典型用法代码示例。如果您正苦于以下问题:TypeScript defineSignal函数的具体用法?TypeScript defineSignal怎么用?TypeScript defineSignal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了defineSignal函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: onAfterAttach

   */
  protected onAfterAttach(msg: Message): void {
    this.selectNode.addEventListener('change', this);
  }

  /**
   * Handle `before-detach` messages for the widget.
   */
  protected onBeforeDetach(msg: Message): void {
    this.selectNode.removeEventListener('change', this);
  }
}


// Define the signals for the `CSVToolbar` class.
defineSignal(CSVToolbar.prototype, 'delimiterChanged');


/**
 * A namespace for `CSVToolbar` statics.
 */
export
namespace CSVToolbar {
  /**
   * The instantiation options for a CSV toolbar.
   */
  export
  interface IOptions {
    /**
     * The initially selected delimiter.
     */
开发者ID:danielballan,项目名称:jupyterlab,代码行数:31,代码来源:toolbar.ts

示例2: defineSignal

  _collapsed: boolean;
  _content: Panel;
  _widget: Widget;
  _header: Widget;
}

export
namespace Collapse {
  export
  interface IOptions extends Widget.IOptions {
    widget: Widget;
  }
}

// Define the signals for the `Widget` class.
defineSignal(Collapse.prototype, 'collapseChanged');


/**
 * The class name added to Accordion instances.
 */
const ACCORDION_CLASS = 'p-Accordion';

/**
 * The class name added to an Accordion child.
 */
const ACCORDION_CHILD_CLASS = 'p-Accordion-child';

const ACCORDION_CHILD_ACTIVE_CLASS = 'p-Accordion-child-active';

/**
开发者ID:cameronoelsen,项目名称:ipywidgets,代码行数:31,代码来源:accordion.ts

示例3: defineSignal

} from 'phosphor/lib/core/signaling';

import {
  ActivityMonitor
} from '../../../lib/common/activitymonitor';



class TestObject {
  one: ISignal<TestObject, number>;

  two: ISignal<TestObject, string[]>;
}


defineSignal(TestObject.prototype, 'one');
defineSignal(TestObject.prototype, 'two');



describe('common/activitymonitor', () => {

  describe('ActivityMonitor()', () => {

    let testObj: TestObject;
    let signal: ISignal<TestObject, number>;

    beforeEach(() => {
      testObj = new TestObject();
      signal = testObj.one;
    });
开发者ID:Carreau,项目名称:jupyterlab,代码行数:31,代码来源:activitymonitor.spec.ts

示例4: onChildAdded

   */
  protected onChildAdded(msg: ChildMessage): void {
    msg.child.addClass(CHILD_CLASS);
  }

  /**
   * A message handler invoked on a `'child-removed'` message.
   */
  protected onChildRemoved(msg: ChildMessage): void {
    msg.child.removeClass(CHILD_CLASS);
    this.widgetRemoved.emit(msg.child);
  }
}

// Define the signals for the `EventedPanel` class.
defineSignal(EventedPanel.prototype, 'widgetRemoved');



/**
 * A widget which combines a `TabBar` and a `EventedPanel`.
 *
 * #### Notes
 * This is a simple panel which handles the common case of a tab bar
 * placed next to a content area. The selected tab controls the widget
 * which is shown in the content area.
 *
 * For use cases which require more control than is provided by this
 * panel, the `TabBar` widget may be used independently.
 * 
 * TODO: Support setting the direction??
开发者ID:cameronoelsen,项目名称:ipywidgets,代码行数:31,代码来源:tabpanel.ts

示例5: defineSignal

    // A completion request signal should only be emitted if the current
    // character or a preceding character is not whitespace.
    //
    // Otherwise, the default tab action of creating a tab character should be
    // allowed to propagate.
    if (!currentLine.substring(0, ch).match(/\S/)) {
      return;
    }

    event.preventDefault();
    event.stopPropagation();
    event.stopImmediatePropagation();

    const chHeight = editor.defaultTextHeight();
    const chWidth = editor.defaultCharWidth();
    const coords = editor.charCoords({ line, ch }, 'page') as ICoords;
    const position = editor.getDoc().indexFromPos({ line, ch });
    let data = {
      line, ch, chHeight, chWidth, coords, position, currentValue
    };
    this.completionRequested.emit(data as ICompletionRequest);
  }

}

// Define the signals for the `CompletableCodeMirrorCellEditorWidget` class.
defineSignal(CodeMirrorCellEditorWidget.prototype, 'textChanged');
defineSignal(CodeMirrorCellEditorWidget.prototype, 'completionRequested');

开发者ID:TypeFox,项目名称:jupyterlab,代码行数:28,代码来源:editor.ts

示例6: defineSignal

    let maximum = DISPLAY_LIMIT;
    if (available > maximum) {
      // Mutate the array instead of slicing in order to conserve memory.
      output.splice(maximum);
      this.maxExceeded.emit({ available, maximum });
    }
    return output;
  }

  private _content: string;
  private _delimiter: string;
}


// Define the signals for the `CSVModel` class.
defineSignal(CSVModel.prototype, 'maxExceeded');


/**
 * A namespace for `CSVModel` statics.
 */
export
namespace CSVModel {
  /**
   * The value emitted when there are more data rows than what can be displayed.
   */
  export
  interface IOverflow {
    /**
     * The actual number of rows in the data.
     */
开发者ID:danielballan,项目名称:jupyterlab,代码行数:31,代码来源:table.ts

示例7: setValue

    if (this.presenter) {
      this.presenter.dispose();
      this.presenter = null
    }
  }

  setValue(value: string) {
    super.setValue(value);
    this.editor.getDoc().clearHistory();
  }

  /**
   * Handle keydown events from the editor.
   */
  protected onEditorKeydown(editor: CodeMirror.Editor, event: KeyboardEvent): void {
    if (event.shiftKey) {
      return;
    }
    if (event.keyCode === UP_ARROW) {
      this.presenter.onPositionUp(this);
    } else if (event.keyCode === DOWN_ARROW) {
      this.presenter.onPositionDown(this);
    }
  }

}

// Define the signals for the `CodeMirrorCellEditorWidget` class.
defineSignal(CodeMirrorCellEditorWidget.prototype, 'edgeRequested');
开发者ID:TypeFox,项目名称:jupyterlab,代码行数:29,代码来源:editor.ts

示例8: _norm

   */
  private _norm(i: number): number {
    return i < 0 ? Math.floor(i) + this.internal.length : Math.floor(i);
  }

  /**
   * Check whether a normalized index is in range.
   */
  private _check(i: number): boolean {
    return i >= 0 && i < this.internal.length;
  }

  /**
   * Normalize and clamp an index to the list bounds.
   */
  private _clamp(i: number): number {
    return Math.max(0, Math.min(this._norm(i), this.internal.length));
  }

  /**
   * Normalize and limit a count to the length of the list.
   */
  private _limit(c: number): number {
    return Math.max(0, Math.min(Math.floor(c), this.internal.length));
  }
}


// Define the signals for the `ObservableList` class.
defineSignal(ObservableList.prototype, 'changed');
开发者ID:TypeFox,项目名称:jupyterlab,代码行数:30,代码来源:observablelist.ts


注:本文中的phosphor/lib/core/signaling.defineSignal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。