Constructor
new Cursor(query, data, adapterDestroyed, idopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
query |
Query resolves current cursor .We keep it just in case. Suddenly, to work with data, you need to compare them with the query? |
||
data |
Any data by resolved query. |
||
adapterDestroyed |
Cursor~adapterDestroyed
|
||
id |
string
|
number
|
<optional> |
Methods
destroy()
Destroy current cursor.
If cursor constructed with adapterDestroyed method, then call this.adapterDestroyed
method. If cursor constructed from CursorManager
, it remove cursor from this.manager.cursors
and unset this.id
.
Has no other effects.
get(path, handleropt)
Getter from data. Handler can observe changes by current path in data.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path |
string
|
Array.<string>
|
null | ||
handler |
Cursor~handler
|
<optional> |
Notify you about changes in data by path. |
Returns:
data - Returns someting from data by spcefied path.
on(path, handleropt) → {function}
Handle event changed, as get handler argument, but returns stop method.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path |
string
|
Array.<string>
|
null | ||
handler |
Cursor~handler
|
<optional> |
Notify you about changes in data by path. |
Returns:
- Type:
-
function
stop
once(path, handleropt)
Adds a one time listener function for the data by path changes. The next time changes is triggered, this listener is removed after invoked.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path |
string
|
Array.<string>
|
null | ||
handler |
Cursor~handler
|
<optional> |
Notify you about changes in data by path. |
set(path, current)
Way to change data changes in specified path.
Parameters:
Name | Type | Description |
---|---|---|
path |
string
|
Array.<string>
|
|
current |
splice(path, start, deleteCount, …itemsopt)
Way to change array data in specified path. Unlike the standard splice, all arguments are required, except items.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string
|
Array.<string>
|
||
start |
number
|
||
deleteCount |
number
|
||
items |
*
|
<optional> <repeatable> |
Type Definitions
adapterDestroyed(cursor)
Parameters:
Name | Type | Description |
---|---|---|
cursor |
Cursor
|
handler(old, current, stop, changes, isClone, cursor)
Attention! If the path leads to a higher level of data from the changed, the link to the data old
the change will lead to the same location as link current
the change. If the path leads to a changed level or deeper, then old
and current
will differ.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
old |
Link to this data old the change. |
||||||||||||||||
current |
Link to this data current the change. |
||||||||||||||||
stop |
function
|
||||||||||||||||
changes |
Object
|
|
|||||||||||||||
isClone |
boolean
|
True if changed path deeper then event path. For details, read attention. |
|||||||||||||||
cursor |
Cursor
|