web-dev-knowledge-graph

Up to App level requirements

Dialogus module requirements

This document holds requirements for the dialogus.js file

It should export a dialogus object that is an instance of EventTarget with the following methods:

Also dialogus object is expected to dispatch the following custom events:

Back to top

Methods

init()

Back to top

open(name, ?data)

This function (method) is to be used for side effects only. It should open the dialog with the given name. If data is provided, it should be used to prepare the dialog.

If data.canClose is true, the dialog buttons like Cancel, Close, Continue and OK (class close) should close the dialog until it is closed once. Also the dialog should be closed if the user clicks outside of it or presses the ESC key. But again, only until the dialog is closed once.

It supposed to recognize the following dialog names:

Back to top

close(name)

This function (method) is to be used for side effects only. It should close the dialog with the given name.

It supposed to recognize the same dialog names as open(...).

Back to top

swapDirections(name)

This function (method) is to be used for side effects only. It should swap the values in the from and to fields of the dialog with the given name.

It supposed to recognize the following dialog names:

Back to top

Custom events

splashtigger

This event should be dispatched when the “About” button is clicked in “Menu” dialog.

Back to top

addnodetrigger

This event should be dispatched when the “Add” button is clicked in “Add node” dialog. It should carry the event.detail.node object of the following shape:

{
  name: trimmed string,
  description: trimmed string,
}

Back to top

addlinktrigger

This event should be dispatched when the “Add” button is clicked in “Add Link” dialog. It should carry the event.detail.link object of the following shape:

{
  from: trimmed string,
  to: trimmed string,
  description: trimmed string,
}

Back to top

savelinktrigger

This event should be dispatched when the “Save” button is clicked in “Edit link” dialog. It should carry the event.detail.link object of the following shape:

{
  id {
    from: positive integer,
    to: different positive integer,
  },
  from: trimmed string,
  to: trimmed string,
  description: trimmed string,
}

Back to top

savenodetrigger

This event should be dispatched when the “Save” button is clicked in “Edit node” dialog. It should carry the event.detail.node object of the following shape:

{
  id: positive integer,
  name: trimmed string,
  description: trimmed string,
}

Back to top

deletenodetrigger

This event should be dispatched when the “Delete” button is clicked in “Delete node” dialog. It should contain the node information as event.detail.id. Right after the event is dispatched, the “Delete node” dialog should be closed.

Back to top

deletelinktrigger

This event should be dispatched when the “Delete” button is clicked in “Delete link” dialog. It should contain the link information as event.detail.id object of the following shape:

{
  from: positive integer,
  to: different positive integer,
}

Right after the event is dispatched, the “Delete link” dialog should be closed.

Back to tops

swapdirectionstrigger

This event should be dispatched when the “Swap” button is clicked in “Add link” or “Edit link” dialog. It should contain the dialog name as event.detail.name. Dialogus should also listen for this event and call the swapDirections(event.detail.name) method on itself.

Back to top