- layout
- index.js
- [ComponentName]
- index.js
- ComponentName.js
- index.test.js
- index.mdx
- shared
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// workflow.js | |
import { | |
createReactCreator, | |
child, | |
// updateQueue is list of updates priority | |
// `updateQueue` from `immutablePreset` have `compute` property | |
// you must use it if you want change react own state before other reactions | |
updateQueue | |
} from "pathon/immutablePreset"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getAsyncType = (type, status) => `${type}_${status}`; | |
let index = 0; | |
export const getMasterActionCreator = description => { | |
const type = `${index++}__${description}`; | |
const reqType = getAsyncType(type, "REQUEST"); | |
const respType = getAsyncType(type, "SUCCESS"); | |
const errType = getAsyncType(type, "ERROR"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lib = require('../index'); | |
// ------------------------------------ | |
// -------------- HELPERS ------------- | |
// ------------------------------------ | |
const EFFECT_STATUS = { | |
idle: 'IDLE', | |
req: 'REQUEST', | |
res: 'RESPONSE', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createConcurrentRequest = () => { | |
let lastReq; | |
return async (request, ...params) => { | |
let myReq = (lastReq = request(...params)); | |
let response = null; | |
let error = null; | |
do { | |
try { | |
error = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// implicit cohesions | |
root = store({ data: { list: [] }, loading: false, error: null }) | |
.on(req, state => ({ ...state, error: null, loading: true })) | |
.on(res, (state, list) => ({ ...state, data: { list }, loading: false })) | |
.on(err, (state, error) => ({ ...state, error, loading: false })); | |
// explicit cohesions | |
export const data = store({ list: [] }) | |
.on(res, list => ({ list })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firstName$ = createCaller() | |
lastName$ = createCaller() | |
// not lazy | |
fullName$ = combine( | |
[firstName$, lastName$], | |
(_, fn, ln) => [fn, ln].join(' ') | |
); | |
displayName$ = combine( | |
[firstName$, fullName$], | |
(_, firstN, fullN) => firstN.length < 10 ? fullN : firstN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*[1]*/import {TextField} from 'material-ui' | |
// TextField merge props for inner components (outer props and internal props) | |
<TextField | |
ownProps={ownProps} | |
inputProps={{ style: { color: 'black' } }} | |
placeholderProps={{ style: { color: 'gray' } }} | |
/> | |
// VS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCaller() { | |
const stack = getStack(); | |
stack.shift(); // getStack | |
stack.shift(); // getCaller | |
// Return caller's caller | |
return stack; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* VT100 terminal reset (<ESC>c) */ | |
console.log('\033c'); | |
/* numbers comparations */ | |
/**/ '2' == 2; | |
//// true | |
/**/ '2' === 2; |