You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by "sospartan (JIRA)" <ji...@apache.org> on 2017/06/21 07:10:00 UTC
[jira] [Resolved] (WEEX-40) Divide callNative,support DOM level API
[ https://issues.apache.org/jira/browse/WEEX-40?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
sospartan resolved WEEX-40.
---------------------------
Resolution: Fixed
> Divide callNative,support DOM level API
> ---------------------------------------
>
> Key: WEEX-40
> URL: https://issues.apache.org/jira/browse/WEEX-40
> Project: Weex
> Issue Type: Improvement
> Components: Android
> Reporter: kfeagle
> Fix For: 0.14
>
>
> # 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
> 1. createBody
> Native provide: `callCreateBody` 。
> function parameter:
> [
> docId,
> // {Element} body
> {
> ref,
> type,
> attr,
> ...
> },
> '-1'
> ]
> 2. addElement
> Native provide: `callAddElement` 。(finished)
> 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'
> ]
> 3. removeElement
> Native provide: `callRemoveElement` 。
> function parameter:
> [
> docId,
> // {String} the ref will be delete
> ref,
> '-1'
> ]
> 4. 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'
> ]
> 6. updateAttrs
> Native should provide: `callUpdateAttrs` 。
> function parameter:
> [
> docId,
> // {String} the ref will update
> ref,
> // {Object} new attribute,JSON object
> attrs,
> '-1'
> ]
> 8. updateStyle
> Native should provide: `callUpdateStyle` 。
> function parameter:
> [
> docId,
> // {String} the ref will update
> ref,
> // {Object} new style,JSON object
> attrs,
> '-1'
> ]
> 9. addEvent
> Native should provate: `callAddEvent` 。
> function parameter:
> [
> docId,
> // {String} the ref of element
> ref,
> // {String} event type, click | appear
> eventType,
> '-1'
> ]
> 10. 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.4.14#64029)