mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 03:11:44 +02:00
Change export of "is-dev" to be a constant to improve code compilation
This commit is contained in:
@@ -9,7 +9,7 @@ import Leaf from './leaf'
|
|||||||
import Void from './void'
|
import Void from './void'
|
||||||
import scrollTo from '../utils/scroll-to'
|
import scrollTo from '../utils/scroll-to'
|
||||||
import warning from '../utils/warning'
|
import warning from '../utils/warning'
|
||||||
import isDev from '../utils/is-dev'
|
import IS_DEV from '../utils/is-dev'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug.
|
* Debug.
|
||||||
@@ -101,7 +101,7 @@ class Node extends React.Component {
|
|||||||
|
|
||||||
// If the node has changed, update.
|
// If the node has changed, update.
|
||||||
if (nextProps.node != this.props.node) {
|
if (nextProps.node != this.props.node) {
|
||||||
if (!isDev() || !Immutable.is(nextProps.node, this.props.node)) {
|
if (!IS_DEV || !Immutable.is(nextProps.node, this.props.node)) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
warning('Encountered different references for identical node values in "shouldComponentUpdate". Check that you are preserving references for the following node:\n', nextProps.node)
|
warning('Encountered different references for identical node values in "shouldComponentUpdate". Check that you are preserving references for the following node:\n', nextProps.node)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const __DEV__ = (
|
const IS_DEV = (
|
||||||
typeof process !== 'undefined' &&
|
typeof process !== 'undefined' &&
|
||||||
process.env &&
|
process.env &&
|
||||||
process.env.NODE_ENV !== 'production'
|
process.env.NODE_ENV !== 'production'
|
||||||
@@ -6,9 +6,7 @@ const __DEV__ = (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if running slate in development
|
* Return true if running slate in development
|
||||||
* @return {Boolean} dev
|
* @type {Boolean}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function isDev() {
|
export default IS_DEV
|
||||||
return __DEV__
|
|
||||||
}
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import isDev from './is-dev'
|
import IS_DEV from './is-dev'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a development warning.
|
* Log a development warning.
|
||||||
@@ -6,7 +6,7 @@ import isDev from './is-dev'
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default function warning(message, ...more) {
|
export default function warning(message, ...more) {
|
||||||
if (!isDev()) {
|
if (!IS_DEV) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user