Skip to content

Commit

Permalink
Merge pull request #1163 from CodeFalling/master
Browse files Browse the repository at this point in the history
Added support for weex
  • Loading branch information
mweststrate authored Sep 19, 2017
2 parents 061481e + 6e963c6 commit 5151eb8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/types/observablearray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,32 @@ function inherit(ctor, proto) {
}
inherit(StubArray, Array.prototype)

// Weex freeze Array.prototype
// Make them writeable and configurable in prototype chain
// https://github.com/alibaba/weex/pull/1529
if (Object.isFrozen(Array)) {
;[
"constructor",
"push",
"shift",
"concat",
"pop",
"unshift",
"replace",
"find",
"findIndex",
"splice",
"reverse",
"sort"
].forEach(function (key) {
Object.defineProperty(StubArray.prototype, key, {
configurable: true,
writable: true,
value: Array.prototype[key]
})
})
}

class ObservableArrayAdministration<T>
implements IInterceptable<IArrayWillChange<T> | IArrayWillSplice<T>>, IListenable {
atom: BaseAtom
Expand Down

0 comments on commit 5151eb8

Please sign in to comment.