UNPKG

luy

Version:

所谓类```React```框架就是**和React用法一模一样**的框架。其实当初制造这个框架的目的是为了能更好的学习React内部结构,了解其原理而制作的玩具。但是随着框架的渐渐成长,代码越来越多,我还是决定将其发展下去. ![](https://github.com/215566435/Luy/blob/master/luy%20icon2.jpg?raw=true)

49 lines (45 loc) 1.29 kB
export const int = (number) => { if (number === '') { return 0 } return parseInt(number, 10) } export const innerWidth = (node) => { let width = node.clientWidth; const computedStyle = node.style width -= int(computedStyle.paddingLeft); width -= int(computedStyle.paddingRight); return width; } export const outerWidth = (node) => { let width = node.clientWidth; const computedStyle = node.style width += int(computedStyle.borderLeftWidth); width += int(computedStyle.borderRightWidth); return width; } export const innerHeight = (node) => { let height = node.clientHeight; const computedStyle = node.style height -= int(computedStyle.paddingTop); height -= int(computedStyle.paddingBottom); return height; } export const outerHeight = (node) => { let height = node.clientHeight; const computedStyle = node.style height += int(computedStyle.borderTopWidth); height += int(computedStyle.borderBottomWidth); return height; } export const parseBounds = (bounds) => { return { left: bounds.left, top: bounds.top, right: bounds.right, bottom: bounds.bottom } } export const isNumber = (things) => { return typeof things === 'number' ? true : false }