當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。