Skip to content

Many decks referencing each other: is it possible for clients to follow via Multiplex? #3861

@jmuheim

Description

@jmuheim

I have many different Reveal.js slide decks living next to each other (in folders and sub folders).

I love the Multiplex feature of Reveal.js, and I wonder: is it somehow possible to make clients follow the master when a link to an external slide deck was clicked? So, for example, I could have an overview-deck, from which I could step deeper into specific decks.

ChatGPT has the following idea: Broadcast URL Navigation Event (Multiplex Extension)

Extend the Multiplex plugin to support a custom “navigate” event that broadcasts a target URL to all connected clients.
Clients receiving the event automatically update window.location to the new presentation.

// Master
document.querySelectorAll('.sync-link').forEach(link => {
  link.addEventListener('click', function(e) {
    e.preventDefault();
    const target = this.getAttribute('href');

    Reveal.getPlugin('multiplex').socket.emit('multiplex-statechanged', {
      url: target
    });
  });
});

// Clients
Reveal.getPlugin('multiplex').socket.on('multiplex-statechanged', function(data) {
  if (data.url) {
    window.location.href = data.url;
  }
});

Is this possible? Or would you recommend a different approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions