score:1
await wait for a promise... try this to make a promise
let devicedetected = ()=>{
return new promise((resolve,reject)=>{
navigator.mediadevices.enumeratedevices()
.then((devices) => {
let res = (devices.map((device) =>
(device.kind + ": " + device.label)));
resolve(res)
})
.catch(function(err) {
reject(err)
console.log(err.name + ": " + err.message);
}));
})
}
Source: stackoverflow.com
Related Query
- how to get value of promise and use it in selector
- How do I create css class in createMuiTheme() and use them directly without having to get its value from component "classes" props?
- How can I get the value of an input field and use it in URL in React
- How to get the value from interface and use it on another function
- How to fetch the Promise object value from an array and use it
- React/Typescript - which type to use for router props and how to get query value from it
- How to correctly use a value returned by a promise and map through it
- How can I get the value of an element onClick in React and use it as condition
- How to get this value in a variable and use it in a conditional in React?
- How do I use React and forms to get an array of checked checkbox values?
- How to use react ref to get value from html select element?
- How can I invoke lodash/fp get and use a default value?
- How to use setFieldValue and pass the value as props between components
- how to get key and value of object whose values are not equal to null?
- React: How to pass State value to another component and use it to render a component
- how to get value from a fulfilled promise in react
- How copy state of react-table to use value of page and pageSize
- Get value from input and use on the button
- Reactjs How to get the value of Start date and End date?
- How to reduce and get value from object array using javascript
- How to set and get value of redux-form field
- How to get and output a value from the select tag
- how to get the promise value of return promise
- How to assign a value to state and use setState in ReactJs with Typescript
- How to get only one value in a variable of parent component, by selecting and switching to any of the option in reactjs?
- How to get promise value to react component?
- How can I get value from TextFields and Select by click on button?
- How to get start and end date value in React date range picker?
- Use params in react Link and get the value of it in another component?
- How to use filter and save value in state in React?
More Query from same tag
- React render madness
- React passing array subcomponent as a prop or importing it in each array item
- Calculated total and subtotal using field array on redux-form
- How can I delay useEffect Hook
- React rebuild tree with HOC components (causing input field focus loss)
- how do i use a jwt token?
- Pass props between three components
- React doesn't recognize function
- react - is it possible to globalize some variables and use them everywhere without import
- How can I access the redux store in mapDispachToProps?
- how to test if button click fired then it update the state or not?
- How to set state in React after successful Firebase set?
- react-router-dom <Link> changes route but doesn't render until user clicks page
- React: Toggle content in another component
- Binder.bindToState, link input as string
- ReactJs: Filtering nested objects
- Array manipulation/mapping returning undefined
- ReactJS: Each child in a list should have a unique "key" prop
- How to populate Select box dynamically from API response
- Div is created upon submitting a form
- Material-UI not styling components when used with NextJS
- Use tippyjs-react inside table cells
- React router bootstrap LinkContainer returns TypeError: (0 , _reactRouterDom.withRouter) is not a function
- Object doesn't support property or method 'scrollBy' in IE11 in React
- Animate toggle menu dropdown
- Best practice for combining React useContext and one-time data load (React hooks)?
- applyMiddleware() ignored? redux-thunk never fires callback, redux-logger won't log, everything done right
- Gettting React.createElement: type is invalid -- expected a string ... but got: undefined
- Javascript : How to display a variable in real time?
- 404 error GET bad request Rapid API React.js, get sneakerId from the api url