Comparing version 1.3.0 to 1.3.1
@@ -0,1 +1,8 @@ | ||
## [1.3.1](https://github.com/streamich/use-media/compare/v1.3.0...v1.3.1) (2019-07-27) | ||
### Bug Fixes | ||
* make useMedia work on server ([2349f0c](https://github.com/streamich/use-media/commit/2349f0c)) | ||
# [1.3.0](https://github.com/streamich/use-media/compare/v1.2.0...v1.3.0) (2019-03-13) | ||
@@ -2,0 +9,0 @@ |
@@ -8,2 +8,12 @@ "use strict"; | ||
}; | ||
var noWindowMatches = { | ||
media: '', | ||
addListener: noop, | ||
removeListener: noop, | ||
matches: false, | ||
onchange: noop, | ||
addEventListener: noop, | ||
removeEventListener: noop, | ||
dispatchEvent: function (_) { return true; } | ||
}; | ||
var objectToString = function (query) { | ||
@@ -32,3 +42,5 @@ if (typeof query === 'string') | ||
var mounted = true; | ||
var mql = window.matchMedia(query); | ||
var mql = typeof window === 'undefined' | ||
? noWindowMatches | ||
: window.matchMedia(query); | ||
var onChange = function () { | ||
@@ -48,4 +60,5 @@ if (!mounted) | ||
}; }; | ||
function noop() { } | ||
exports.useMedia = createUseMedia(useEffect); | ||
exports.useMediaLayout = createUseMedia(useLayoutEffect); | ||
exports.default = exports.useMedia; |
{ | ||
"name": "use-media", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "useMedia React hook", | ||
@@ -28,8 +28,8 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@semantic-release/changelog": "^3.0.2", | ||
"@semantic-release/git": "^7.0.8", | ||
"@semantic-release/npm": "^5.1.4", | ||
"@types/react": "^16.8.2", | ||
"semantic-release": "^15.13.3", | ||
"typescript": "^3.1.3" | ||
"@semantic-release/changelog": "3.0.4", | ||
"@semantic-release/git": "7.0.16", | ||
"@semantic-release/npm": "5.1.13", | ||
"@types/react": "16.8.23", | ||
"semantic-release": "15.13.18", | ||
"typescript": "3.5.3" | ||
}, | ||
@@ -36,0 +36,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5704
67