let timeout = null;
const handleClearTimeout = () => {
clearTimeout(timeout);
};
const handleSetTimeout = () => {
timeout = setTimeout(() => {
showModal();
window.removeEventListener('focus', handleSetTimeout);
window.removeEventListener('blur', handleClearTimeout);
}, 5000);
};
window.addEventListener('focus', handleSetTimeout);
window.addEventListener('blur', handleClearTimeout);
if (document.hasFocus()) {
handleSetTimeout();
}
const cors = require('cors');
const app = express();
app.use(cors());
const app = express();
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET, HEAD, OPTIONS, POST, PUT');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
next();
});
class Slider {
constructor() {
this.myOwnProp = 'some value';
}
someMethod() {
this.myOwnProp = 'some other value';
}
}
function Slider() {
this.myOwnProp = 'some value';
}
Slider.prototype.someMethod = function() {
this.myOwnProp = 'some other value';
}
const inputMaxMin = useCallback(
({ target: { value, name } }) => {
name === "maxPrice"
? setPrice(({ minPrice }) => ({ maxPrice: value, minPrice }))
: setPrice(({ maxPrice }) => ({ minPrice: value, maxPrice }));
},
[],
);
const store = configureStore();
store.dispatch(init());
const root = (
<Provider store={store}>
<App />
</Provider>
);
isInitializtion: true
и вместо контента показывать прелоадер или заглушку.