mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-02 18:38:48 +03:00
KnockoutJS to ES2015/ES6
TODO: use the new Proxy for ko.observable
This commit is contained in:
parent
a0f8ac0dad
commit
72ed2b08b2
56 changed files with 941 additions and 1873 deletions
|
|
@ -1,6 +1,6 @@
|
|||
var observableLatestValue = Symbol('_latestValue');
|
||||
|
||||
ko.observable = function (initialValue) {
|
||||
ko.observable = initialValue => {
|
||||
function observable() {
|
||||
if (arguments.length > 0) {
|
||||
// Write
|
||||
|
|
@ -59,7 +59,7 @@ if (ko.utils.canSetPrototype) {
|
|||
var protoProperty = ko.observable.protoProperty = '__ko_proto__';
|
||||
observableFn[protoProperty] = ko.observable;
|
||||
|
||||
ko.isObservable = function (instance) {
|
||||
ko.isObservable = instance => {
|
||||
var proto = typeof instance == 'function' && instance[protoProperty];
|
||||
if (proto && proto !== observableFn[protoProperty] && proto !== ko.computed['fn'][protoProperty]) {
|
||||
throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
|
||||
|
|
@ -67,7 +67,7 @@ ko.isObservable = function (instance) {
|
|||
return !!proto;
|
||||
};
|
||||
|
||||
ko.isWriteableObservable = function (instance) {
|
||||
ko.isWriteableObservable = instance => {
|
||||
return (typeof instance == 'function' && (
|
||||
(instance[protoProperty] === observableFn[protoProperty]) || // Observable
|
||||
(instance[protoProperty] === ko.computed['fn'][protoProperty] && instance.hasWriteFunction))); // Writable computed observable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue