How to use the @lumino/signaling.Signal function in @lumino/signaling

To help you get started, we’ve selected a few @lumino/signaling 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 jupyterlab / jupyterlab / tests / test-console / src / foreign.spec.ts View on Github external
contentFactory
    }).initializeState();
    return cell;
  }

  getCell(msgId: string) {
    return this._cells.get(msgId);
  }

  private _cells = new Map();
}

class TestHandler extends ForeignHandler {
  injected = new Signal(this);

  received = new Signal(this);

  rejected = new Signal(this);

  methods: string[] = [];

  protected onIOPubMessage(
    sender: IClientSession,
    msg: KernelMessage.IIOPubMessage
  ): boolean {
    const injected = super.onIOPubMessage(sender, msg);
    this.received.emit(msg);
    if (injected) {
      this.injected.emit(msg);
    } else {
      // If the message was not injected but otherwise would have been, emit
      // a rejected signal. This should only happen if `enabled` is `false`.
github jupyterlab / jupyterlab / packages / application / src / router.ts View on Github external
const result = await commands.execute(command, current);
        if (result === stop) {
          queue.length = 0;
          console.log(`Routing ${request} was short-circuited by ${command}`);
        }
      } catch (reason) {
        console.warn(`Routing ${request} to ${command} failed`, reason);
      }
      void next();
    };
    void next();

    return done.promise;
  }

  private _routed = new Signal(this);
  private _rules = new Map();
}

/**
 * A namespace for `Router` class statics.
 */
export namespace Router {
  /**
   * The options for instantiating a JupyterLab URL router.
   */
  export interface IOptions {
    /**
     * The fully qualified base URL for the router.
     */
    base: string;
github jupyterlab / jupyterlab / packages / apputils / src / collapse.ts View on Github external
this.addClass('jp-Collapse-open');
    this._collapseChanged.emit(void 0);
  }

  private _evtClick(event: MouseEvent) {
    this.toggle();
  }

  /**
   * Handle the `changed` signal of a title object.
   */
  private _onTitleChanged(sender: Title): void {
    this._header.node.textContent = this._widget.title.label;
  }

  private _collapseChanged = new Signal(this);
  private _collapsed: boolean;
  private _content: Panel;
  private _header: Widget;
  private _widget: T;
}

export namespace Collapse {
  export interface IOptions extends Widget.IOptions {
    widget: T;
    collapsed?: boolean;
  }
}
github jupyterlab / jupyterlab / packages / services / src / kernelspec / manager.ts View on Github external
return;
    }
    if (!JSONExt.deepEqual(specs, this._specs)) {
      this._specs = specs;
      this._specsChanged.emit(specs);
    }
  }

  private _isReady = false;
  private _connectionFailure = new Signal(this);

  private _pollSpecs: Poll;
  private _ready: Promise;

  private _specs: restapi.ISpecModels | null = null;
  private _specsChanged = new Signal(this);
}

/**
 * The namespace for `KernelManager` class statics.
 */
export namespace KernelSpecManager {
  /**
   * The options used to initialize a KernelManager.
   */
  export interface IOptions extends BaseManager.IOptions {
    /**
     * When the manager stops polling the API. Defaults to `when-hidden`.
     */
    standby?: Poll.Standby;
  }
}
github jupyterlab / jupyterlab / packages / coreutils / src / activitymonitor.ts View on Github external
this._sender = sender;
    this._args = args;
    this._timer = setTimeout(() => {
      this._activityStopped.emit({
        sender: this._sender,
        args: this._args
      });
    }, this._timeout);
  }

  private _timer: any = -1;
  private _timeout = -1;
  private _sender: Sender;
  private _args: Args;
  private _isDisposed = false;
  private _activityStopped = new Signal<
    this,
    ActivityMonitor.IArguments
  >(this);
}

/**
 * The namespace for `ActivityMonitor` statics.
 */
export namespace ActivityMonitor {
  /**
   * The options used to construct a new `ActivityMonitor`.
   */
  export interface IOptions {
    /**
     * The signal to monitor.
     */
github jupyterlab / lumino / packages / widgets / src / focustracker.ts View on Github external
}

  /**
   * Handle the `disposed` signal for a tracked widget.
   */
  private _onWidgetDisposed(sender: T): void {
    this.remove(sender);
  }

  private _counter = 0;
  private _widgets: T[] = [];
  private _activeWidget: T | null = null;
  private _currentWidget: T | null = null;
  private _numbers = new Map();
  private _nodes = new Map();
  private _activeChanged = new Signal>(this);
  private _currentChanged = new Signal>(this);
}


/**
 * The namespace for the `FocusTracker` class statics.
 */
export
namespace FocusTracker {
  /**
   * An arguments object for the changed signals.
   */
  export
  interface IChangedArgs {
    /**
     * The old value for the widget.
github jupyterlab / jupyterlab / packages / services / src / session / default.ts View on Github external
}

  private _id = '';
  private _path = '';
  private _name = '';
  private _type = '';
  private _kernel: Kernel.IKernel;
  private _isDisposed = false;
  private _updating = false;
  private _kernelChanged = new Signal(this);
  private _statusChanged = new Signal(this);
  private _iopubMessage = new Signal(this);
  private _unhandledMessage = new Signal(this);
  private _anyMessage = new Signal(this);
  private _propertyChanged = new Signal(this);
  private _terminated = new Signal(this);
}

/**
 * The namespace for `DefaultSession` statics.
 */
export namespace DefaultSession {
  /**
   * List the running sessions.
   */
  export function listRunning(
    settings?: ServerConnection.ISettings
  ): Promise {
    return Private.listRunning(settings);
  }

  /**
github jupyterlab / lumino / packages / widgets / src / tabbar.ts View on Github external
}

  /**
   * Handle the `changed` signal of a title object.
   */
  private _onTitleChanged(sender: Title): void {
    this.update();
  }

  private _currentIndex = -1;
  private _titles: Title[] = [];
  private _orientation: TabBar.Orientation;
  private _previousTitle: Title | null = null;
  private _dragData: Private.IDragData | null = null;
  private _tabMoved = new Signal>(this);
  private _currentChanged = new Signal>(this);
  private _tabCloseRequested = new Signal>(this);
  private _tabDetachRequested = new Signal>(this);
  private _tabActivateRequested = new Signal>(this);
}


/**
 * The namespace for the `TabBar` class statics.
 */
export
namespace TabBar {
  /**
   * A type alias for a tab bar orientation.
   */
  export
  type Orientation = (
github jupyterlab / jupyterlab / docs / source / developer / virtualdom.usesignal.tsx View on Github external
import { Widget } from '@lumino/widgets';

function MyComponent() {
  return <div>My Widget</div>;
}

function UseSignalComponent(props: { signal: ISignal }) {
  return {() =&gt; };
}

class MyWidget extends ReactWidget {
  render() {
    return ;
  }

  private _signal = new Signal(this);
}

const myWidget: Widget = new MyWidget();
github jupyterlab / lumino / packages / datastore / src / datastore.ts View on Github external
* @throws An exception if no transaction is in progress.
   */
  private _finalizeTransaction(): void {
    let context = this._context as Private.MutableContext;
    if (!context.inTransaction) {
      throw new Error('No transaction in progress.');
    }
    context.inTransaction = false;
  }

  private _adapter: IServerAdapter | null;
  private _cemetery: { [id: string]: number } = {};
  private _disposed = false;
  private _tables: BPlusTree&gt;;
  private _context: Datastore.Context;
  private _changed = new Signal(this);
  private _transactionIdFactory: Datastore.TransactionIdFactory;
  private _transactionQueue = new LinkedList&lt;[
    Datastore.Transaction,
    Datastore.TransactionType
  ]&gt;();
}


/**
 * The namespace for the `Datastore` class statics.
 */
export
namespace Datastore {
  /**
   * A type alias for kinds of transactions.
   */

@lumino/signaling

Lumino Signals and Slots

BSD-3-Clause
Latest version published 5 months ago

Package Health Score

83 / 100
Full package analysis

Similar packages