deprecate get with string argument

pull/1347/head
Rich Harris 7 years ago
parent 424bb1a5de
commit 5ebd43898c

@ -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