Skip to content

Commit

Permalink
feat(wx-react): add unstable_batchedUpdates api
Browse files Browse the repository at this point in the history
  • Loading branch information
ykforerlang committed Jul 2, 2019
1 parent f89ce7a commit fd559ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/wx-react/miniprogram_dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import tackleWithStyleObj from './tackleWithStyleObj'
import styleType from './styleType'
import instanceManager from './InstanceManager'
import {getPropsMethod, getRootContext, rootUuid} from './util'
import {unstable_batchedUpdates} from './unstable'


export default {
Expand All @@ -33,7 +34,8 @@ export default {
instanceManager,
getPropsMethod,
getRootContext,
rootUuid
rootUuid,
unstable_batchedUpdates
}

export {
Expand All @@ -51,6 +53,7 @@ export {
instanceManager,
getPropsMethod,
getRootContext,
rootUuid
rootUuid,
unstable_batchedUpdates
}
export const h = createElement
15 changes: 15 additions & 0 deletions packages/wx-react/miniprogram_dist/unstable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright (c) Areslabs.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import reactUpdate from './ReactUpdate'

export function unstable_batchedUpdates(func) {
reactUpdate.setFlag(true)
func()
reactUpdate.setFlag(false)
reactUpdate.finalUpdate()
}

0 comments on commit fd559ed

Please sign in to comment.