mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 00:19:55 +03:00
prettier
This commit is contained in:
parent
1dc970c333
commit
3187a40483
|
@ -5,20 +5,28 @@
|
|||
## Usage
|
||||
|
||||
Install:
|
||||
|
||||
```
|
||||
npm install --save redux-devtools-extension
|
||||
```
|
||||
|
||||
and use like that:
|
||||
|
||||
```js
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
|
||||
const store = createStore(reducer, composeWithDevTools(
|
||||
applyMiddleware(...middleware),
|
||||
const store = createStore(
|
||||
reducer,
|
||||
composeWithDevTools(
|
||||
applyMiddleware(...middleware)
|
||||
// other store enhancers if any
|
||||
));
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
or if needed to apply [extension’s options](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#windowdevtoolsextensionconfig):
|
||||
|
||||
```js
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
|
@ -26,11 +34,15 @@
|
|||
const composeEnhancers = composeWithDevTools({
|
||||
// Specify here name, actionsBlacklist, actionsCreators and other options
|
||||
});
|
||||
const store = createStore(reducer, composeEnhancers(
|
||||
applyMiddleware(...middleware),
|
||||
const store = createStore(
|
||||
reducer,
|
||||
composeEnhancers(
|
||||
applyMiddleware(...middleware)
|
||||
// other store enhancers if any
|
||||
));
|
||||
)
|
||||
);
|
||||
```
|
||||
|
||||
There’re just [few lines of code](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/index.js). If you don’t want to allow the extension in production, just use ‘redux-devtools-extension/developmentOnly’ instead of ‘redux-devtools-extension’.
|
||||
|
||||
## License
|
||||
|
|
|
@ -1 +1 @@
|
|||
export * from "redux-devtools-extension";
|
||||
export * from 'redux-devtools-extension';
|
||||
|
|
|
@ -1,22 +1,26 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var compose = require('redux').compose;
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.composeWithDevTools = (
|
||||
process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ :
|
||||
function() {
|
||||
exports.composeWithDevTools =
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
: function () {
|
||||
if (arguments.length === 0) return undefined;
|
||||
if (typeof arguments[0] === 'object') return compose;
|
||||
return compose.apply(null, arguments);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports.devToolsEnhancer = (
|
||||
process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ ?
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ :
|
||||
function() { return function(noop) { return noop; } }
|
||||
);
|
||||
exports.devToolsEnhancer =
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
: function () {
|
||||
return function (noop) {
|
||||
return noop;
|
||||
};
|
||||
};
|
||||
|
|
14
packages/redux-devtools-extension/index.d.ts
vendored
14
packages/redux-devtools-extension/index.d.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import {Action, ActionCreator, StoreEnhancer, compose} from "redux";
|
||||
import { Action, ActionCreator, StoreEnhancer, compose } from 'redux';
|
||||
|
||||
export interface EnhancerOptions {
|
||||
/**
|
||||
|
@ -33,7 +33,9 @@ export interface EnhancerOptions {
|
|||
* For `function` key you can also specify a custom function which handles serialization.
|
||||
* See [`jsan`](https://github.com/kolodny/jsan) for more details.
|
||||
*/
|
||||
serialize?: boolean | {
|
||||
serialize?:
|
||||
| boolean
|
||||
| {
|
||||
date?: boolean;
|
||||
regex?: boolean;
|
||||
undefined?: boolean;
|
||||
|
@ -128,11 +130,11 @@ export interface EnhancerOptions {
|
|||
/**
|
||||
* export history of actions in a file
|
||||
*/
|
||||
export?: boolean | "custom";
|
||||
export?: boolean | 'custom';
|
||||
/**
|
||||
* import history of actions from a file
|
||||
*/
|
||||
import?: boolean | "custom";
|
||||
import?: boolean | 'custom';
|
||||
/**
|
||||
* jump back and forth (time travelling)
|
||||
*/
|
||||
|
@ -165,6 +167,8 @@ export interface EnhancerOptions {
|
|||
traceLimit?: number;
|
||||
}
|
||||
|
||||
export function composeWithDevTools<StoreExt, StateExt>(...funcs: Array<StoreEnhancer<StoreExt>>): StoreEnhancer<StoreExt>;
|
||||
export function composeWithDevTools<StoreExt, StateExt>(
|
||||
...funcs: Array<StoreEnhancer<StoreExt>>
|
||||
): StoreEnhancer<StoreExt>;
|
||||
export function composeWithDevTools(options: EnhancerOptions): typeof compose;
|
||||
export function devToolsEnhancer(options: EnhancerOptions): StoreEnhancer<any>;
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var compose = require('redux').compose;
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.composeWithDevTools = (
|
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ :
|
||||
function() {
|
||||
exports.composeWithDevTools =
|
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
: function () {
|
||||
if (arguments.length === 0) return undefined;
|
||||
if (typeof arguments[0] === 'object') return compose;
|
||||
return compose.apply(null, arguments);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports.devToolsEnhancer = (
|
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ?
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ :
|
||||
function() { return function(noop) { return noop; } }
|
||||
);
|
||||
exports.devToolsEnhancer =
|
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
: function () {
|
||||
return function (noop) {
|
||||
return noop;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
export * from "redux-devtools-extension";
|
||||
export * from 'redux-devtools-extension';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var assign = require('./utils/assign');
|
||||
var compose = require('redux').compose;
|
||||
|
@ -26,21 +26,22 @@ function enhancer() {
|
|||
|
||||
if (Object.assign) return Object.assign(store, { dispatch: dispatch });
|
||||
return assign(store, 'dispatch', dispatch);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function composeWithEnhancer(config) {
|
||||
return function () {
|
||||
return compose(compose.apply(null, arguments), enhancer(config));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.composeWithDevTools = function () {
|
||||
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
|
||||
if (arguments.length === 0) return enhancer();
|
||||
if (typeof arguments[0] === 'object') return composeWithEnhancer(arguments[0]);
|
||||
if (typeof arguments[0] === 'object')
|
||||
return composeWithEnhancer(arguments[0]);
|
||||
return composeWithEnhancer().apply(null, arguments);
|
||||
}
|
||||
|
||||
|
@ -49,8 +50,11 @@ exports.composeWithDevTools = function() {
|
|||
return compose.apply(null, arguments);
|
||||
};
|
||||
|
||||
exports.devToolsEnhancer = (
|
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__ ?
|
||||
enhancer :
|
||||
function() { return function(noop) { return noop; } }
|
||||
);
|
||||
exports.devToolsEnhancer =
|
||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
? enhancer
|
||||
: function () {
|
||||
return function (noop) {
|
||||
return noop;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
export * from "redux-devtools-extension";
|
||||
export * from 'redux-devtools-extension';
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var compose = require('redux').compose;
|
||||
var logOnly = require('./logOnly');
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.composeWithDevTools = (
|
||||
process.env.NODE_ENV === 'production' ? logOnly.composeWithDevTools :
|
||||
typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ?
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ :
|
||||
function() {
|
||||
exports.composeWithDevTools =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? logOnly.composeWithDevTools
|
||||
: typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||
: function () {
|
||||
if (arguments.length === 0) return undefined;
|
||||
if (typeof arguments[0] === 'object') return compose;
|
||||
return compose.apply(null, arguments);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports.devToolsEnhancer = (
|
||||
process.env.NODE_ENV === 'production' ? logOnly.devToolsEnhancer :
|
||||
typeof window !== 'undefined' &&
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ ?
|
||||
window.__REDUX_DEVTOOLS_EXTENSION__ :
|
||||
function() { return function(noop) { return noop; } }
|
||||
);
|
||||
exports.devToolsEnhancer =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? logOnly.devToolsEnhancer
|
||||
: typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
? window.__REDUX_DEVTOOLS_EXTENSION__
|
||||
: function () {
|
||||
return function (noop) {
|
||||
return noop;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
var objectKeys = Object.keys || function (obj) {
|
||||
var objectKeys =
|
||||
Object.keys ||
|
||||
function (obj) {
|
||||
var keys = [];
|
||||
for (var key in obj) {
|
||||
if ({}.hasOwnProperty.call(obj, key)) keys.push(key);
|
||||
|
|
Loading…
Reference in New Issue
Block a user