Skip to content

Commit

Permalink
v0.0.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bsonntag committed Feb 2, 2019
1 parent 42a2a75 commit 6f4b680
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d =
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function useUserMedia(constraints) {
var _usePromise = (0, _reactUsePromise.default)(function () {
var _usePromise = (0, _reactUsePromise.default)((0, _react.useMemo)(function () {
return navigator.mediaDevices.getUserMedia(constraints);
}),
_usePromise2 = _slicedToArray(_usePromise, 2),
}, [constraints])),
_usePromise2 = _slicedToArray(_usePromise, 3),
stream = _usePromise2[0],
error = _usePromise2[1];
error = _usePromise2[1],
state = _usePromise2[2];

(0, _react.useEffect)(function () {
return function () {
Expand All @@ -36,6 +37,7 @@ function useUserMedia(constraints) {
}, [stream]);
return {
error: error,
state: state,
stream: stream
};
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-use-user-media",
"version": "0.0.0-alpha.1",
"version": "0.0.0-alpha.2",
"description": "React hook for accessing user media.",
"keywords": [
"hook",
Expand Down

0 comments on commit 6f4b680

Please sign in to comment.