Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support weex #1163

Merged
merged 2 commits into from
Sep 19, 2017
Merged

Support weex #1163

merged 2 commits into from
Sep 19, 2017

Conversation

xcodebuild
Copy link
Contributor

@xcodebuild xcodebuild commented Sep 11, 2017

About this PR

Weex is a framework like ReactNative. It runs javascript in JavaScriptCore/V8 runtime and freezed Array.prototype.

Mobx is a awesome library so I want make it works in weex. ObservableArray in mobx override push/sort/etc could not run in weex. We'd better make this original array method writeable in StubArray.prorotype.

See alibaba/weex#1529

PR checklist:

  • Added unit tests
  • Updated changelog
  • Updated docs (either in the description of this PR as markdown, or as separate PR on the gh-pages branch. Please refer to this PR). For new functionality, at least API.md should be updated
  • Added typescript typings
  • Verified that there is no significant performance drop (npm run perf)

ezgif-4-d59f90397f

@coveralls
Copy link

Coverage Status

Coverage increased (+0.004%) to 94.69% when pulling 262d9ba on CodeFalling:master into 953710b on mobxjs:master.

@@ -119,6 +119,29 @@ function inherit(ctor, proto) {
}
inherit(StubArray, Array.prototype)

// Weex freeze Array.prototype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

Could you make the patch conditional? That is, only apply the patch if the properties are actually not writable (such as in the weex case)? This avoids putting more methods in the prototype chain when it is not really needed.

@xcodebuild
Copy link
Contributor Author

Done. Now the patch only works when Array.prototype has been freezen.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 94.608% when pulling 6e963c6 on CodeFalling:master into 953710b on mobxjs:master.

@mweststrate mweststrate merged commit 5151eb8 into mobxjs:master Sep 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants