mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-04 15:07:02 +03:00
knockoutjs replaced slow obj.__proto__ with Object.setPrototypeOf()
This commit is contained in:
parent
d49916731f
commit
5a0215987a
7 changed files with 100 additions and 157 deletions
|
|
@ -59,14 +59,10 @@ ko.computed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, opt
|
|||
computedObservable.hasWriteFunction = typeof writeFunction === "function";
|
||||
|
||||
// Inherit from 'subscribable'
|
||||
if (!ko.utils.canSetPrototype) {
|
||||
// 'subscribable' won't be on the prototype chain unless we put it there directly
|
||||
ko.utils.extend(computedObservable, ko.subscribable['fn']);
|
||||
}
|
||||
ko.subscribable['fn'].init(computedObservable);
|
||||
|
||||
// Inherit from 'computed'
|
||||
ko.utils.setPrototypeOfOrExtend(computedObservable, computedFn);
|
||||
Object.setPrototypeOf(computedObservable, computedFn);
|
||||
|
||||
if (options['pure']) {
|
||||
state.pure = true;
|
||||
|
|
@ -485,9 +481,7 @@ var deferEvaluationOverrides = {
|
|||
|
||||
// Note that for browsers that don't support proto assignment, the
|
||||
// inheritance chain is created manually in the ko.computed constructor
|
||||
if (ko.utils.canSetPrototype) {
|
||||
ko.utils.setPrototypeOf(computedFn, ko.subscribable['fn']);
|
||||
}
|
||||
Object.setPrototypeOf(computedFn, ko.subscribable['fn']);
|
||||
|
||||
// Set the proto values for ko.computed
|
||||
var protoProp = ko.observable.protoProperty; // == "__ko_proto__"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue