How to use the @lumino/disposable.DisposableSet function in @lumino/disposable

To help you get started, we’ve selected a few @lumino/disposable 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-latex / src / index.ts View on Github external
function addSynctexCommands(
  app: JupyterFrontEnd,
  editorTracker: IEditorTracker,
  pdfTracker: IPDFJSTracker,
  serverSettings: ServerConnection.ISettings
): DisposableSet {
  const disposables = new DisposableSet();

  const hasPDFWidget = () => !!pdfTracker.currentWidget;
  const hasEditorWidget = () => !!editorTracker.currentWidget;

  // Add the command for the PDF-to-editor mapping.
  disposables.add(
    app.commands.addCommand(CommandIDs.synctexEdit, {
      execute: () => {
        // Get the pdf widget that had its contextMenu activated.
        let widget = pdfTracker.currentWidget;
        if (widget) {
          // Get the page number.
          const pos = widget.content.position;

          // Request the synctex position for the PDF
          return synctexEditRequest(
github jupyterlab / jupyterlab-latex / src / index.ts View on Github external
.then(([settings]) => {
      let disposables = new DisposableSet();
      const onSettingsUpdated = (settings: ISettingRegistry.ISettings) => {
        // Get the new value of the synctex setting.
        const val = settings.get('synctex').composite as boolean | null;
        synctex = val === true || val === false ? val : true;
        // Trash any existing synctex commands
        disposables.dispose();

        // If SyncTeX is enabled, add the commands.
        if (synctex) {
          disposables = addSynctexCommands(
            app,
            editorTracker,
            pdfTracker,
            serverSettings
          );
        }

@lumino/disposable

Lumino Disposable

BSD-3-Clause
Latest version published 4 months ago

Package Health Score

80 / 100
Full package analysis

Similar packages