Memento JavaScript Library: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 1: Line 1:
{{Stamp|2017-03-03|4.3.0|1.1.0}}
{{Stamp|2017-03-04|4.3.0|1.1.0}}


Memento includes the capability for users to use JavaScript to accomplish complex tasks beyond the capabilities of the normal Memento user interface. Examples include JavaScript fields, Triggers, Actions, and Data Sources. The Memento JavaScript Library may be used to access Memento facilities.
Memento includes the capability for users to use JavaScript to accomplish complex tasks beyond the capabilities of the normal Memento user interface. Examples include JavaScript fields, Triggers, Actions, and Data Sources. The Memento JavaScript Library may be used to access Memento facilities.
Line 49: Line 49:
===== find(query) =====
===== find(query) =====
: Search field values within entries in the library matching the given query. This search is similar to searching via Memento's user interface.
: Search field values within entries in the library matching the given query. This search is similar to searching via Memento's user interface.
:; Argument: '''query''' — the search string
: '''Argument'''
::; query: the search string
:; Result: Array object containing matching entries. Entries are sorted by the time of their creation, from newest to oldest.
:; Result: Array object containing matching entries. Entries are sorted by the time of their creation, from newest to oldest.


===== findByKey(name) =====
===== findByKey(name) =====
: Search all entries by the Entry Name. The library must be set for unique Entry Names.
: Search all entries by the Entry Name. The library must be set for unique Entry Names.
:; Argument: '''name''' — the Entry Name field value
: '''Argument'''
::; name: the Entry Name field value
:; Result: [[#Object Entry|'''''Entry''''' object]], if found. Otherwise, ''null''.
:; Result: [[#Object Entry|'''''Entry''''' object]], if found. Otherwise, ''null''.


===== create(values) =====
===== create(values) =====
: Create a new entry in the library
: Create a new entry in the library
:; Argument: '''values''' — [[https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object '''''Object'''''] containing the field values
: '''Argument'''
:; values: [[https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object '''''Object'''''] containing the field values
:; Result: [[#Object entry|'''''Entry''''' object]] — the new entry in the library
:; Result: [[#Object entry|'''''Entry''''' object]] — the new entry in the library