web-dev-knowledge-graph

Up to App level requirements

Linkus module requirements

This document holds requirements for the linkus.js file

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

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

Back to top

Methods

init()

Back to top

This function (method) is to be used for side effects only. It should show the link list presenting the given links array between two nodes, considering the point of view based on the id of the current node. List items should have the class corresponding to their direction (outgoing or incoming). Outgoing links should be shown first.

See the graphus.getLinksById(id) method for the expected shape of the links array.

Back to top

This function (method) is to be used for side effects only. It should show the link list presenting the given links array in unrelated mode. All list items should have outgoing class.

See the graphus.getLinks() method for the expected shape of the links array.

Back to top

This function (method) should return an array of links that are currently shown in the right panel. Expected shape of result is:

[ 0 or more elements like the one below
  {
    from: positive integer,
    to: different positive integer,
  },
]

Back to top

updateLink(from, to, description)

This function (method) should update the description of the link with the given from and to ids on the page. It should be called for side effects only.

Back to top

removeLink(from, to)

This function (method) should remove the link with the given from and to ids from the list on the page. It should be called for side effects only.

Custom events

gotolinktrigger

This event should be dispatched when the “Go to link” button is clicked next to a specific link in unrelated mode. It should carry the event.detail.id property with the following data:

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

Back to top

editlinktrigger

This event should be dispatched when the “Edit link” button is clicked next to a specific link. It should carry the event.detail.id property with the following data:

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

Back to top

deletelinktrigger

This event should be dispatched when the “Delete link” button is clicked next to a specific link. It should carry such link detail as id property with the following data:

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

Back to top