From 526a7799ec02656ba9fcb0a8a7415dca70beb8ba Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 15 Apr 2018 13:27:37 -0400 Subject: [PATCH] deprecate observe --- src/shared/index.js | 2 ++ .../dev-warning-missing-data-computed/_actual-bundle-v2.js | 2 ++ .../dev-warning-missing-data-computed/expected-bundle-v2.js | 2 ++ .../dev-warning-missing-data-computed/expected-bundle.js | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/shared/index.js b/src/shared/index.js index 3d3e8b56d0..3ff0a2d421 100644 --- a/src/shared/index.js +++ b/src/shared/index.js @@ -77,6 +77,8 @@ export function observe(key, callback, options) { } export function observeDev(key, callback, options) { + console.warn("this.observe(key, (newValue, oldValue) => {...}) is deprecated. Use\n\n // runs before DOM updates\n this.on('state', ({ changed, current, previous }) => {...});\n\n // runs after DOM updates\n this.on('update', ...);\n\n...or add the observe method from the svelte-extras package"); + var c = (key = '' + key).search(/[.[]/); if (c > -1) { var message = diff --git a/test/js/samples/dev-warning-missing-data-computed/_actual-bundle-v2.js b/test/js/samples/dev-warning-missing-data-computed/_actual-bundle-v2.js index 5ba9581cf5..b580ce1155 100644 --- a/test/js/samples/dev-warning-missing-data-computed/_actual-bundle-v2.js +++ b/test/js/samples/dev-warning-missing-data-computed/_actual-bundle-v2.js @@ -92,6 +92,8 @@ function observe(key, callback, options) { } function observeDev(key, callback, options) { + console.warn("this.observe(key, (newValue, oldValue) => {...}) is deprecated. Use\n\n // runs before DOM updates\n this.on('state', ({ changed, current, previous }) => {...});\n\n // runs after DOM updates\n this.on('update', ...);\n\n...or add the observe method from the svelte-extras package"); + var c = (key = '' + key).search(/[.[]/); if (c > -1) { var message = diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle-v2.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle-v2.js index 5ba9581cf5..b580ce1155 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle-v2.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle-v2.js @@ -92,6 +92,8 @@ function observe(key, callback, options) { } function observeDev(key, callback, options) { + console.warn("this.observe(key, (newValue, oldValue) => {...}) is deprecated. Use\n\n // runs before DOM updates\n this.on('state', ({ changed, current, previous }) => {...});\n\n // runs after DOM updates\n this.on('update', ...);\n\n...or add the observe method from the svelte-extras package"); + var c = (key = '' + key).search(/[.[]/); if (c > -1) { var message = diff --git a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js index 5ba9581cf5..b580ce1155 100644 --- a/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js +++ b/test/js/samples/dev-warning-missing-data-computed/expected-bundle.js @@ -92,6 +92,8 @@ function observe(key, callback, options) { } function observeDev(key, callback, options) { + console.warn("this.observe(key, (newValue, oldValue) => {...}) is deprecated. Use\n\n // runs before DOM updates\n this.on('state', ({ changed, current, previous }) => {...});\n\n // runs after DOM updates\n this.on('update', ...);\n\n...or add the observe method from the svelte-extras package"); + var c = (key = '' + key).search(/[.[]/); if (c > -1) { var message =