mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
Merged master to 1.0
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
|
||||
export function enumerateDevices() {
|
||||
if (navigator.mediaDevices
|
||||
&& typeof navigator.mediaDevices.enumerateDevices === 'function') {
|
||||
return navigator.mediaDevices.enumerateDevices();
|
||||
}
|
||||
return Promise.reject(new Error('enumerateDevices is not defined'));
|
||||
};
|
||||
|
||||
export function getUserMedia(constraints) {
|
||||
if (navigator.mediaDevices
|
||||
&& typeof navigator.mediaDevices.getUserMedia === 'function') {
|
||||
return navigator.mediaDevices
|
||||
.getUserMedia(constraints);
|
||||
}
|
||||
return Promise.reject(new Error('getUserMedia is not defined'));
|
||||
}
|
||||
@@ -24,3 +24,28 @@ Math.imul = Math.imul || function(a, b) {
|
||||
// the final |0 converts the unsigned value into a signed value
|
||||
return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
|
||||
};
|
||||
|
||||
if (typeof Object.assign !== 'function') {
|
||||
Object.assign = function(target) { // .length of function is 2
|
||||
'use strict';
|
||||
if (target === null) { // TypeError if undefined or null
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var to = Object(target);
|
||||
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var nextSource = arguments[index];
|
||||
|
||||
if (nextSource !== null) { // Skip over if undefined or null
|
||||
for (var nextKey in nextSource) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||
to[nextKey] = nextSource[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return to;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user