16 lines
312 B
JavaScript
16 lines
312 B
JavaScript
import getWindow from './getWindow';
|
|
import getOffset from './getOffset';
|
|
export default (function (node, client) {
|
|
var win = getWindow(node);
|
|
|
|
if (win) {
|
|
return win.innerWidth;
|
|
}
|
|
|
|
if (client) {
|
|
return node.clientWidth;
|
|
}
|
|
|
|
var offset = getOffset(node);
|
|
return offset ? offset.width : 0;
|
|
}); |