How to use the @rmwc/base.ArrayEmitter function in @rmwc/base

To help you get started, we’ve selected a few @rmwc/base 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 jamesmfriedman / rmwc / src / snackbar / snackbar-queue.tsx View on Github external
export const createSnackbarQueue = (): {
  messages: ArrayEmitter;
  notify: (message: SnackbarQueueMessage) => void;
} => {
  const messages = new ArrayEmitter();

  return {
    messages,
    notify: (message: SnackbarQueueMessage) => {
      messages.push(message);
    }
  };
};
github jamesmfriedman / rmwc / src / dialog / dialog-queue.tsx View on Github external
export const createDialogQueue = (): {
  dialogs: ArrayEmitter;
  alert: (dialog: DialogQueueInput) => Promise;
  confirm: (dialog: DialogQueueInput) => Promise;
  prompt: (dialog: DialogQueueInput) => Promise;
} => {
  const dialogs = new ArrayEmitter();

  return {
    dialogs,
    alert: dialogFactory(alertFactory, dialogs),
    confirm: dialogFactory(confirmFactory, dialogs),
    prompt: dialogFactory(promptFactory, dialogs)
  };
};