16.06.2022
Дима Zerobias
01.03.2022
⛴➡️🍆
function Lock () { | |
var next = typeof setImmediate === 'undefined' ? setTimeout : setImmediate | |
var locked = {} | |
function _releaser (key, exec) { | |
return function (done) { | |
return function () { | |
_release(key, exec) |
16.06.2022
Дима Zerobias
01.03.2022
⛴➡️🍆
import { Component } from 'react'; | |
import { withRouter } from 'react-router'; | |
class ScrollToTop extends Component { | |
componentDidUpdate(prevProps) { | |
if (this.props.location !== prevProps.location) { | |
window.scrollTo(0, 0); | |
} | |
} | |
render() { |
import React, { Component } from "react"; | |
export default function asyncComponent(importComponent) { | |
class AsyncComponent extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
component: null | |
}; |
//@noflow | |
/* eslint-disable */ | |
'use strict'; | |
//prettier-ignore | |
(function () { | |
var $$0 = { | |
enumerable: false, | |
configurable: false | |
}; |
type idInt = int; | |
type countInt = int; | |
let nextId = { | |
let id: ref(idInt) = ref(0); | |
(.) => { | |
id := id^ + 1; | |
id^; |
type graph_term('a) = { | |
nodes: list('a), | |
edges: list(('a, 'a)), | |
}; | |
let example_graph = { | |
nodes: ['b', 'c', 'd', 'f', 'g', 'h', 'k'], | |
edges: [('h', 'g'), ('k', 'f'), ('f', 'b'), ('f', 'c'), ('c', 'b')], | |
}; |
//@flow | |
import { | |
createEvent, | |
createStore, | |
combine, | |
type Event, | |
type Store, | |
} from 'effector' |
//@flow | |
class Foo<Properties: Object> { | |
$key: $Keys<Properties> | 'c'; | |
$value: $Values<Properties>; | |
} |
//@flow | |
export type ExtractReturn<Fn> = $Call<<T>((...Iterable<any>) => T) => T, Fn>; | |
//example | |
const mapDispatchToProps = (dispatch: Dispatch) => ({ | |
actions: { | |
setCompany: ({ companyId, domainName }) => | |
dispatch( |