Namespace: history

Drupal. history

Methods

staticDrupal.history.fetchTimestamps(nodeIDs, callback)

Fetch "last read" timestamps for the given nodes.

Name Type Description
nodeIDs Array

An array of node IDs.

callback function

A callback that is called after the requested timestamps were fetched.

staticDrupal.history.getLastRead(nodeID){number}

Get the last read timestamp for the given node.

Name Type Description
nodeID number | string

A node ID.

Returns:
Type Description
number A UNIX timestamp.

staticDrupal.history.markAsRead(nodeID)

Marks a node as read, store the last read timestamp client-side.

Name Type Description
nodeID number | string

A node ID.

staticDrupal.history.needsServerCheck(nodeID, contentTimestamp){bool}

Determines whether a server check is necessary.

Any content that is >30 days old never gets a "new" or "updated" indicator. Any content that was published before the oldest known reading also never gets a "new" or "updated" indicator, because it must've been read already.

Name Type Description
nodeID number | string

A node ID.

contentTimestamp number

The time at which some content (e.g. a comment) was published.

Returns:
Type Description
bool Whether a server check is necessary for the given node and its timestamp.