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


TypeScript signaling.ISignal类代码示例

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


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

示例1: onTabEvent

  /**
   * Handle a tab key press.
   */
  protected onTabEvent(event: KeyboardEvent, ch: number, line: number): void {
    const editor = this.editor;
    const doc = editor.getDoc();

    // If there is a text selection, no completion requests should be emitted.
    if (doc.getSelection()) {
      return;
    }

    const currentValue = doc.getValue();
    const currentLine = currentValue.split('\n')[line];

    // 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);
  }
开发者ID:TypeFox,项目名称:jupyterlab,代码行数:37,代码来源:editor.ts

示例2: _collapse

 private _collapse() {
   this._collapsed = true;
   if (this._content) {
     this._content.hide();
   }
   this.removeClass(COLLAPSE_CLASS_OPEN);
   this.collapseChanged.emit(void 0);
 }
开发者ID:cameronoelsen,项目名称:ipywidgets,代码行数:8,代码来源:accordion.ts

示例3: _uncollapse

 private _uncollapse() {
   this._collapsed = false;
   if (this._content) {
     this._content.show();
   }
   this.addClass(COLLAPSE_CLASS_OPEN);
   this.collapseChanged.emit(void 0);
 }
开发者ID:cameronoelsen,项目名称:ipywidgets,代码行数:8,代码来源:accordion.ts

示例4: handleEvent

 /**
  * Handle the DOM events for the widget.
  *
  * @param event - The DOM event sent to the widget.
  *
  * #### Notes
  * This method implements the DOM `EventListener` interface and is
  * called in response to events on the dock panel's node. It should
  * not be called directly by user code.
  */
 handleEvent(event: Event): void {
   switch (event.type) {
   case 'change':
     this.delimiterChanged.emit(this.selectNode.value);
     break;
   default:
     break;
   }
 }
开发者ID:danielballan,项目名称:jupyterlab,代码行数:19,代码来源:toolbar.ts

示例5: parse

 /**
  * Parse the content using the model's delimiter.
  *
  * #### Notes
  * This method will always return parsed content that has at most the display
  * limit worth of rows, currently maxing out at 1000 rows.
  */
 parse(): dsv.DSVParsedArray<dsv.DSVRowString> {
   let output = dsv.dsvFormat(this._delimiter).parse(this._content);
   let available = output.length;
   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;
 }
开发者ID:danielballan,项目名称:jupyterlab,代码行数:18,代码来源:table.ts

示例6: removeItem

 /**
  * Remove the item from the list at the specified index.
  *
  * @param index - The index of the item to remove. This must be
  *   an integer in the range `[0, internal.length)`.
  *
  * @returns The item removed from the list.
  *
  * #### Notes
  * This may be reimplemented by subclasses to customize the behavior.
  */
 protected removeItem(index: number): T {
   let item = this.internal.removeAt(index);
   this.changed.emit({
     type: 'remove',
     newIndex: -1,
     newValue: void 0,
     oldIndex: index,
     oldValue: item,
   });
   return item;
 }
开发者ID:TypeFox,项目名称:jupyterlab,代码行数:22,代码来源:observablelist.ts

示例7: addItem

 /**
  * Add an item to the list at the specified index.
  *
  * @param index - The index at which to add the item. This must be
  *   an integer in the range `[0, internal.length]`.
  *
  * @param item - The item to add at the specified index.
  *
  * @returns The index at which the item was added.
  *
  * #### Notes
  * This may be reimplemented by subclasses to customize the behavior.
  */
 protected addItem(index: number, item: T): number {
   this.internal.insert(index, item);
   this.changed.emit({
     type: 'add',
     newIndex: index,
     newValue: item,
     oldIndex: -1,
     oldValue: void 0,
   });
   return index;
 }
开发者ID:TypeFox,项目名称:jupyterlab,代码行数:24,代码来源:observablelist.ts

示例8: setItem

 /**
  * Set the item at a specific index in the list.
  *
  * @param index - The index of interest. This must be an integer in
  *   the range `[0, internal.length)`.
  *
  * @param item - The item to set at the index.
  *
  * @returns The item which previously occupied the specified index.
  *
  * #### Notes
  * This may be reimplemented by subclasses to customize the behavior.
  */
 protected setItem(index: number, item: T): T {
   let old = this.internal.at(index);
   this.internal.set(index, item);
   this.changed.emit({
     type: 'set',
     newIndex: index,
     newValue: item,
     oldIndex: index,
     oldValue: old,
   });
   return old;
 }
开发者ID:TypeFox,项目名称:jupyterlab,代码行数:25,代码来源:observablelist.ts

示例9: Date

 let firstPass = () => {
   let now = (new Date()).getTime();
   let delta = now - start;
   if (delta > timeout) {
     expect(called).to.be(true);
     expect(emission).to.be(firstEmission);
     done();
     return;
   }
   signal.emit(secondEmission);
   // Restart the clock.
   start = (new Date()).getTime();
   setTimeout(secondPass, timeout - 100);
 };
开发者ID:Carreau,项目名称:jupyterlab,代码行数:14,代码来源:activitymonitor.spec.ts

示例10: it

 it('should be emitted after the signal has fired and a timeout', (done) => {
   let called = false;
   let monitor = new ActivityMonitor({ signal, timeout: 100 });
   monitor.activityStopped.connect((sender, args) => {
     expect(sender).to.be(monitor);
     expect(args.sender).to.be(testObj);
     expect(args.args).to.be(10);
     called = true;
   });
   signal.emit(10);
   expect(called).to.be(false);
   setTimeout(() => {
     expect(called).to.be(true);
     done();
   }, 100);
 });
开发者ID:Carreau,项目名称:jupyterlab,代码行数:16,代码来源:activitymonitor.spec.ts


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