齐山 created WEEX-40:
----------------------
Summary: Divide callNative,support DOM level API
Key: WEEX-40
URL: https://issues.apache.org/jira/browse/WEEX-40
Project: Weex
Issue Type: Improvement
Reporter: 齐山
# DOM Operation Top-Level API
`callNative` Segmentation,support native api as DOM level,it can improve
performence , because it can reduce js-native communication.
defalue `callNative` as follow:
[
// 0\. {String} document id ,usually app id
'3',
// 1\. {Array} task list
[
{
// {String} module name
module: 'dom',
// {String} method in module,such as: createBody 、 updateAttrs 、
removeEvent
method: 'addElement',
// {Array} task parameter
args: [
'23', // {String} element ref
... // other parameter
]
}
],
// 2\. {String} signal ,目前为 -1
'-1'
]
the design follow the standard that the first item is docId, the last item is
signal. the middle parameter designed by function. you can refer to
`callAddElement` to design other api
## createBody
Native provide: `callCreateBody` 。
function parameter:
[
docId,
// {Element} body
{
ref,
type,
attr,
...
},
'-1'
]
## addElement
Native provide: `callAddElement` 。(已经实现)
function parameter:
[
docId,
// {String} the element ref will be inserted
ref,
// {Element} the element will be inserted
{
ref,
type,
attr,
...
},
// {Number} insert index
index,
'-1'
]
## removeElement
Native provide: `callRemoveElement` 。
function parameter:
[
docId,
// {String} 待删除的节点的 ref
ref,
'-1'
]
## moveElement 任务
Native provide: `callMoveElement` 。
function parameter:
[
docId,
// {String} the ref will be move
targetRef,
// {String} parent ref
parentRef,
// {Number} the index will move to
index,
'-1'
]
## updateAttrs
Native should provide: `callUpdateAttrs` 。
function parameter:
[
docId,
// {String} the ref will update
ref,
// {Object} new attribute,JSON object
attrs,
'-1'
]
## updateStyle
Native should provide: `callUpdateStyle` 。
方法的参数格式:
[
docId,
// {String} the ref will update
ref,
// {Object} new style,JSON object
attrs,
'-1'
]
## addEvent
Native should provate: `callAddEvent` 。
function parameter:
[
docId,
// {String} the ref of element
ref,
// {String} event type, click | appear
eventType,
'-1'
]
## removeEvent
Native should provide method: `callRemoveEvent` 。
function parameter:
[
docId,
// {String} the ref of element whose event will remove
ref,
// {String} event type, click | appear
eventType,
'-1'
]
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)