Merge pull request #1347 from sveltejs/deprecate-get-with-string

deprecate get with string argument
pull/1350/head
Rich Harris 7 years ago committed by GitHub
commit 27f6241ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -51,6 +51,11 @@ export function fire(eventName, data) {
}
}
export function getDev(key) {
if (key) console.warn("`let x = component.get('x')` is deprecated. Use `let { x } = component.get()` instead");
return get.call(this, key);
}
export function get(key) {
return key ? this._state[key] : this._state;
}
@ -204,7 +209,7 @@ export var proto = {
export var protoDev = {
destroy: destroyDev,
get: get,
get: getDev,
fire: fire,
observe: observeDev,
on: onDev,

@ -66,6 +66,11 @@ function fire(eventName, data) {
}
}
function getDev(key) {
if (key) console.warn("`let x = component.get('x')` is deprecated. Use `let { x } = component.get()` instead");
return get.call(this, key);
}
function get(key) {
return key ? this._state[key] : this._state;
}
@ -188,7 +193,7 @@ function _unmount() {
var protoDev = {
destroy: destroyDev,
get: get,
get: getDev,
fire: fire,
observe: observeDev,
on: onDev,

@ -66,6 +66,11 @@ function fire(eventName, data) {
}
}
function getDev(key) {
if (key) console.warn("`let x = component.get('x')` is deprecated. Use `let { x } = component.get()` instead");
return get.call(this, key);
}
function get(key) {
return key ? this._state[key] : this._state;
}
@ -188,7 +193,7 @@ function _unmount() {
var protoDev = {
destroy: destroyDev,
get: get,
get: getDev,
fire: fire,
observe: observeDev,
on: onDev,

@ -66,6 +66,11 @@ function fire(eventName, data) {
}
}
function getDev(key) {
if (key) console.warn("`let x = component.get('x')` is deprecated. Use `let { x } = component.get()` instead");
return get.call(this, key);
}
function get(key) {
return key ? this._state[key] : this._state;
}
@ -188,7 +193,7 @@ function _unmount() {
var protoDev = {
destroy: destroyDev,
get: get,
get: getDev,
fire: fire,
observe: observeDev,
on: onDev,

Loading…
Cancel
Save