knockout-decorators
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -121,3 +121,8 @@ (function (global, factory) { | ||
var observable = applyDecorators(this, key, ko.observable()); | ||
defProp(this, key, { configurable: true, get: observable, set: observable }); | ||
defProp(this, key, { | ||
configurable: true, | ||
enumerable: true, | ||
get: observable, | ||
set: observable, | ||
}); | ||
return observable(); | ||
@@ -127,3 +132,8 @@ }, | ||
var observable = applyDecorators(this, key, ko.observable()); | ||
defProp(this, key, { configurable: true, get: observable, set: observable }); | ||
defProp(this, key, { | ||
configurable: true, | ||
enumerable: true, | ||
get: observable, | ||
set: observable, | ||
}); | ||
observable(value); | ||
@@ -140,2 +150,3 @@ }, | ||
configurable: true, | ||
enumerable: true, | ||
get: obsArray, | ||
@@ -146,3 +157,2 @@ set: function (array) { | ||
configurable: true, | ||
enumerable: false, | ||
value: function () { | ||
@@ -160,3 +170,2 @@ if (insideObsArray) { | ||
configurable: true, | ||
enumerable: false, | ||
value: function () { | ||
@@ -199,3 +208,7 @@ insideObsArray = true; | ||
var computed = ko.pureComputed(get, this); | ||
defProp(this, key, { configurable: true, get: computed, set: set }); | ||
defProp(this, key, { | ||
configurable: true, | ||
get: computed, | ||
set: set | ||
}); | ||
return computed(); | ||
@@ -315,3 +328,2 @@ }; | ||
configurable: true, | ||
enumerable: false, | ||
value: bound, | ||
@@ -318,0 +330,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("knockout")):"function"==typeof define&&define.amd?define(["exports","knockout"],t):t(e.KnockoutDecorators=e.KnockoutDecorators||{},e.ko)}(this,function(e,t){"use strict";function o(e,o,n,r){return void 0===r&&(void 0===n?"object"!=typeof o||o.constructor!==Object||"require"in o||"element"in o||(r=o,o=void 0):"object"==typeof n&&(r=n,n=void 0)),function(n){t.components.register(e,h({viewModel:n.length<2?n:{createViewModel:function(e,t){var o=t.element,r=t.templateNodes;return new n(e,o,r)}},template:o||"<!---->",synchronous:!0},r))}}function n(e){var t=e[w];return e.hasOwnProperty(w)||(e[w]=t=h({},t),g(t,function(e,o){t[e]=o.slice()})),t}function r(e,t){return e[t]||(e[t]=[])}function i(e){return e[E]||(e[E]=[])}function u(e,t,o){var n=e[w],r=n&&n[t];return r&&r.forEach(function(t){switch(t.type){case y.Extend:var n=t.value instanceof Function?t.value.call(e):t.value;o=o.extend(n);break;case y.Subscribe:var r=o.subscribe(t.value,e,t.event);t.dispose&&i(e).push(r)}}),o}function c(e){if(!e[S]){e[S]=!0;var t=e.dispose;e.dispose=function(){var e=this[E];if(e&&e.forEach(function(e){e.dispose()}),t)return t.apply(this,arguments)}}}function s(e,o){m(e,o,{configurable:!0,get:function(){var e=u(this,o,t.observable());return m(this,o,{configurable:!0,get:e,set:e}),e()},set:function(e){var n=u(this,o,t.observable());m(this,o,{configurable:!0,get:n,set:n}),n(e)}})}function a(e,o){var n=u(e,o,t.observableArray()),r=!1;m(e,o,{configurable:!0,get:n,set:function(e){e&&(j.forEach(function(t){return m(e,t,{configurable:!0,enumerable:!1,value:function(){if(r)return Array.prototype[t].apply(e,arguments);r=!0;var o=n[t].apply(n,arguments);return r=!1,o}})}),x.forEach(function(t){return m(e,t,{configurable:!0,enumerable:!1,value:function(){r=!0;var e=n[t].apply(n,arguments);return r=!1,e}})})),r=!0,n(e),r=!1}})}function f(e,t){m(e,t,{configurable:!0,get:function(){return a(this,t),this[t]},set:function(e){return a(this,t),this[t]=e}})}function l(e,o,n){var r=n||(n=_(e,o)),i=r.get,u=r.set;return n.get=function(){var e=t.pureComputed(i,this);return m(this,o,{configurable:!0,get:e,set:u}),e()},n}function b(e,o,n){function r(e,o,n){var r=(n||(n=_(e,o))).value;return n.value=function(){var e=this,o=k(arguments),n=t.computed(function(){return r.apply(e,o)});return u&&i(this).push(n),n},u&&c(e),n}var u;if("boolean"==typeof e&&void 0===o)return u=e,r;if("object"!=typeof e||void 0===o)throw new Error("Can not use @observer decorator this way");u=!0,r(e,o,n)}function p(e){return function(t,o){r(n(t),o).push({type:y.Extend,value:e})}}function d(e,t,o){return void 0===o&&(o=!0),function(i,u,s){var a,f,l=s||(s=_(i,u)),b=l.value,p=l.get;if("function"==typeof b){if("string"!=typeof e&&"symbol"!=typeof e)throw new Error("Subscription target should be a key in decorated ViewModel");a=e,f=b}else if("function"==typeof p)if("function"==typeof e)a=u,f=e;else{if("string"!=typeof e&&"symbol"!=typeof e)throw new Error("Subscription callback should be a function or key in decorated ViewModel");a=u,f=i[e]}return r(n(i),a).push({type:y.Subscribe,value:f,event:t,dispose:o}),o&&c(i),s}}function v(e,t,o){var n=o||(o=_(e,t)),r=n.value,i=n.configurable,u=n.enumerable;return{configurable:i,enumerable:u,get:function(){if(this===e)return r;var o=r.bind(this);return m(this,t,{configurable:!0,enumerable:!1,value:o}),o}}}var y,h=t.utils.extend,g=t.utils.objectForEach,m=Object.defineProperty.bind(Object),_=Object.getOwnPropertyDescriptor.bind(Object),k=Function.prototype.call.bind(Array.prototype.slice),w="undefined"!=typeof Symbol?Symbol("ko_decorators"):"__ko_decorators_",E="undefined"!=typeof Symbol?Symbol("ko_decorators_subscriptions"):"__ko_decorators_subscriptions_",S="undefined"!=typeof Symbol?Symbol("ko_decorators_disposable"):"__ko_decorators_disposable_";!function(e){e[e.Extend=0]="Extend",e[e.Subscribe=1]="Subscribe"}(y||(y={}));var j=["pop","push","reverse","shift","sort","splice","unshift"],x=["remove","removeAll","destroy","destroyAll","replace","subscribe"];e.component=o,e.observable=s,e.observableArray=f,e.computed=l,e.observer=b,e.extend=p,e.subscribe=d,e.autobind=v,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("knockout")):"function"==typeof define&&define.amd?define(["exports","knockout"],t):t(e.KnockoutDecorators=e.KnockoutDecorators||{},e.ko)}(this,function(e,t){"use strict";function o(e,o,n,r){return void 0===r&&(void 0===n?"object"!=typeof o||o.constructor!==Object||"require"in o||"element"in o||(r=o,o=void 0):"object"==typeof n&&(r=n,n=void 0)),function(n){t.components.register(e,h({viewModel:n.length<2?n:{createViewModel:function(e,t){var o=t.element,r=t.templateNodes;return new n(e,o,r)}},template:o||"<!---->",synchronous:!0},r))}}function n(e){var t=e[w];return e.hasOwnProperty(w)||(e[w]=t=h({},t),g(t,function(e,o){t[e]=o.slice()})),t}function r(e,t){return e[t]||(e[t]=[])}function i(e){return e[E]||(e[E]=[])}function u(e,t,o){var n=e[w],r=n&&n[t];return r&&r.forEach(function(t){switch(t.type){case y.Extend:var n=t.value instanceof Function?t.value.call(e):t.value;o=o.extend(n);break;case y.Subscribe:var r=o.subscribe(t.value,e,t.event);t.dispose&&i(e).push(r)}}),o}function c(e){if(!e[S]){e[S]=!0;var t=e.dispose;e.dispose=function(){var e=this[E];if(e&&e.forEach(function(e){e.dispose()}),t)return t.apply(this,arguments)}}}function s(e,o){m(e,o,{configurable:!0,get:function(){var e=u(this,o,t.observable());return m(this,o,{configurable:!0,enumerable:!0,get:e,set:e}),e()},set:function(e){var n=u(this,o,t.observable());m(this,o,{configurable:!0,enumerable:!0,get:n,set:n}),n(e)}})}function a(e,o){var n=u(e,o,t.observableArray()),r=!1;m(e,o,{configurable:!0,enumerable:!0,get:n,set:function(e){e&&(j.forEach(function(t){return m(e,t,{configurable:!0,value:function(){if(r)return Array.prototype[t].apply(e,arguments);r=!0;var o=n[t].apply(n,arguments);return r=!1,o}})}),x.forEach(function(t){return m(e,t,{configurable:!0,value:function(){r=!0;var e=n[t].apply(n,arguments);return r=!1,e}})})),r=!0,n(e),r=!1}})}function f(e,t){m(e,t,{configurable:!0,get:function(){return a(this,t),this[t]},set:function(e){return a(this,t),this[t]=e}})}function l(e,o,n){var r=n||(n=_(e,o)),i=r.get,u=r.set;return n.get=function(){var e=t.pureComputed(i,this);return m(this,o,{configurable:!0,get:e,set:u}),e()},n}function b(e,o,n){function r(e,o,n){var r=(n||(n=_(e,o))).value;return n.value=function(){var e=this,o=k(arguments),n=t.computed(function(){return r.apply(e,o)});return u&&i(this).push(n),n},u&&c(e),n}var u;if("boolean"==typeof e&&void 0===o)return u=e,r;if("object"!=typeof e||void 0===o)throw new Error("Can not use @observer decorator this way");u=!0,r(e,o,n)}function p(e){return function(t,o){r(n(t),o).push({type:y.Extend,value:e})}}function d(e,t,o){return void 0===o&&(o=!0),function(i,u,s){var a,f,l=s||(s=_(i,u)),b=l.value,p=l.get;if("function"==typeof b){if("string"!=typeof e&&"symbol"!=typeof e)throw new Error("Subscription target should be a key in decorated ViewModel");a=e,f=b}else if("function"==typeof p)if("function"==typeof e)a=u,f=e;else{if("string"!=typeof e&&"symbol"!=typeof e)throw new Error("Subscription callback should be a function or key in decorated ViewModel");a=u,f=i[e]}return r(n(i),a).push({type:y.Subscribe,value:f,event:t,dispose:o}),o&&c(i),s}}function v(e,t,o){var n=o||(o=_(e,t)),r=n.value,i=n.configurable,u=n.enumerable;return{configurable:i,enumerable:u,get:function(){if(this===e)return r;var o=r.bind(this);return m(this,t,{configurable:!0,value:o}),o}}}var y,h=t.utils.extend,g=t.utils.objectForEach,m=Object.defineProperty.bind(Object),_=Object.getOwnPropertyDescriptor.bind(Object),k=Function.prototype.call.bind(Array.prototype.slice),w="undefined"!=typeof Symbol?Symbol("ko_decorators"):"__ko_decorators_",E="undefined"!=typeof Symbol?Symbol("ko_decorators_subscriptions"):"__ko_decorators_subscriptions_",S="undefined"!=typeof Symbol?Symbol("ko_decorators_disposable"):"__ko_decorators_disposable_";!function(e){e[e.Extend=0]="Extend",e[e.Subscribe=1]="Subscribe"}(y||(y={}));var j=["pop","push","reverse","shift","sort","splice","unshift"],x=["remove","removeAll","destroy","destroyAll","replace","subscribe"];e.component=o,e.observable=s,e.observableArray=f,e.computed=l,e.observer=b,e.extend=p,e.subscribe=d,e.autobind=v,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=knockout-decorators.min.js.map |
{ | ||
"name": "knockout-decorators", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Decorators for use Knockout JS in TypeScript and ESNext environments", | ||
@@ -5,0 +5,0 @@ "main": "dist/knockout-decorators.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81304
420