breakdancer
Advanced tools
Comparing version
18
index.js
@@ -1,5 +0,5 @@ | ||
'use strict'; | ||
import get from 'propget'; | ||
/** | ||
* Small fallback for when the `window` glabal is not accessible in a given | ||
* Small fallback for when the `window` global is not accessible in a given | ||
* environment. This allows the module to still be used in a regular `node` | ||
@@ -65,5 +65,6 @@ * environment. | ||
width () { | ||
return this.window.innerWidth | ||
|| this.window.document.documentElement.clientWidth | ||
|| this.window.document.body.clientWidth; | ||
return get(this.window, 'innerWidth') | ||
|| get(this.window, 'document.documentElement.clientWidth') | ||
|| get(this.window, 'document.body.clientWidth') | ||
|| 0; | ||
} | ||
@@ -78,5 +79,6 @@ | ||
height () { | ||
return this.window.innerHeight | ||
|| this.window.document.documentElement.clientHeight | ||
|| this.window.document.body.clientHeight; | ||
return get(this.window, 'innerHeight') | ||
|| get(this.window, 'document.documentElement.clientHeight') | ||
|| get(this.window, 'document.body.clientHeight') | ||
|| 0; | ||
} | ||
@@ -83,0 +85,0 @@ |
{ | ||
"name": "breakdancer", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A breakpoint tracking utility", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha --compilers js:babel/register ./test.js", | ||
"test": "mocha --compilers js:babel-register ./test.js", | ||
"lint": "godaddy-js-style-lint index.js test.js" | ||
@@ -24,9 +24,6 @@ }, | ||
"devDependencies": { | ||
"assume": "1.3.x", | ||
"babel": "5.8.x", | ||
"eslint-plugin-json": "1.2.x", | ||
"eslint-plugin-mocha": "1.1.x", | ||
"eslint-plugin-react": "3.16.x", | ||
"godaddy-style": "1.0.x", | ||
"mocha": "2.4.x", | ||
"assume": "1.4.x", | ||
"babel-register": "6.9.x", | ||
"godaddy-style": "3.1.x", | ||
"mocha": "2.5.x", | ||
"pre-commit": "1.1.x" | ||
@@ -39,3 +36,13 @@ }, | ||
] | ||
}, | ||
"dependencies": { | ||
"babel-preset-es2015": "6.9.x", | ||
"babelify": "7.3.x", | ||
"propget": "1.0.x" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"babel-preset-es2015" | ||
] | ||
} | ||
} |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
import Breakdancer from './index'; | ||
@@ -34,2 +32,9 @@ import assume from 'assume'; | ||
it('safely works without existing windows object', function () { | ||
breakdancer = new Breakdancer(specification, {}); | ||
assume(breakdancer.height()).equals(0); | ||
assume(breakdancer.width()).equals(0); | ||
}); | ||
describe('constructor', function () { | ||
@@ -36,0 +41,0 @@ it('stores the specification as arrays', function () { |
14980
2.46%5
-37.5%272
2.26%3
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added