mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
f307e95459
Migrate formatting to prettier for zone.js from clang-format PR Close #55427
26 lines
885 B
TypeScript
26 lines
885 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
import {ZoneType} from '../zone-impl';
|
|
|
|
export function patchUserMedia(Zone: ZoneType): void {
|
|
Zone.__load_patch('getUserMedia', (global: any, Zone: any, api: _ZonePrivate) => {
|
|
function wrapFunctionArgs(func: Function, source?: string): Function {
|
|
return function (this: unknown) {
|
|
const args = Array.prototype.slice.call(arguments);
|
|
const wrappedArgs = api.bindArguments(args, source ? source : (func as any).name);
|
|
return func.apply(this, wrappedArgs);
|
|
};
|
|
}
|
|
let navigator = global['navigator'];
|
|
if (navigator && navigator.getUserMedia) {
|
|
navigator.getUserMedia = wrapFunctionArgs(navigator.getUserMedia);
|
|
}
|
|
});
|
|
}
|