Skip to content

Commit afe14ee

Browse files
committed
Update ko.debug check to support ko 3.4.0+ in debug mode
Should fix #41
1 parent 87fa4c6 commit afe14ee

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

dist/ko-reactor.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ ko['watch'] = function (target, options, evaluatorCallback, context) {
198198

199199
// Subscriptions are stored under either the _subscriptions field for the debug version
200200
// or the F, H or M fields when minified depending on the version used.
201+
// NOTE: we used to use ko.DEBUG to detect the debug versionbut it was removed in 3.4.0+,
202+
// so we now check the existence of a "subscription" function.
201203
var subscriptionsField;
202-
switch (ko.DEBUG || ko.version) {
204+
switch (typeof ko.subscription == 'function' || ko.version) {
203205
case true: subscriptionsField = '_subscriptions'; break;
204206
case "3.0.0": subscriptionsField = 'F'; break;
205207
case "3.1.0": subscriptionsField = 'H'; break;

dist/ko-reactor.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ko-reactor",
33
"author": "Ziad Jeeroburkhan",
4-
"version": "1.3.8",
4+
"version": "1.3.9",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/ZiadJ/knockoutjs-reactor.git"

src/knockout.reactor.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@ ko['watch'] = function (target, options, evaluatorCallback, context) {
198198

199199
// Subscriptions are stored under either the _subscriptions field for the debug version
200200
// or the F, H or M fields when minified depending on the version used.
201+
// NOTE: we used to use ko.DEBUG to detect the debug versionbut it was removed in 3.4.0+,
202+
// so we now check the existence of a "subscription" function.
201203
var subscriptionsField;
202-
switch (ko.DEBUG || ko.version) {
204+
switch (typeof ko.subscription == 'function' || ko.version) {
203205
case true: subscriptionsField = '_subscriptions'; break;
204206
case "3.0.0": subscriptionsField = 'F'; break;
205207
case "3.1.0": subscriptionsField = 'H'; break;

0 commit comments

Comments
 (0)