@angular-helpers/browser-web-apis 21.0.1 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +156 -0
- package/README.md +19 -26
- package/fesm2022/angular-helpers-browser-web-apis.mjs +1504 -0
- package/package.json +1 -6
- package/types/angular-helpers-browser-web-apis.d.ts +537 -0
package/package.json
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-helpers/browser-web-apis",
|
|
3
|
-
"version": "21.0
|
|
3
|
+
"version": "21.1.0",
|
|
4
4
|
"description": "Sistema de servicios Angular para acceso formalizado a Browser Web APIs (cámara, permisos, geolocalización, etc.)",
|
|
5
|
-
"main": "dist/browser-web-apis/browser-web-apis.d.ts",
|
|
6
|
-
"types": "dist/browser-web-apis/browser-web-apis.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
10
5
|
"keywords": [
|
|
11
6
|
"angular",
|
|
12
7
|
"typescript",
|
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { DestroyRef, EnvironmentProviders } from '@angular/core';
|
|
4
|
+
import { CanActivateFn } from '@angular/router';
|
|
5
|
+
|
|
6
|
+
type PermissionNameExt = PermissionName | 'clipboard-read' | 'clipboard-write';
|
|
7
|
+
interface PermissionRequest {
|
|
8
|
+
name: PermissionNameExt;
|
|
9
|
+
state: PermissionState;
|
|
10
|
+
}
|
|
11
|
+
interface BrowserPermissions {
|
|
12
|
+
query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
|
|
13
|
+
isSupported(): boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class PermissionsService implements BrowserPermissions {
|
|
17
|
+
query(descriptor: PermissionDescriptor): Promise<PermissionStatus>;
|
|
18
|
+
isSupported(): boolean;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PermissionsService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PermissionsService>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Base class for all Browser Web API services
|
|
25
|
+
* Provides common functionality for:
|
|
26
|
+
* - Support checking
|
|
27
|
+
* - Permission management
|
|
28
|
+
* - Error handling
|
|
29
|
+
* - Lifecycle management with destroyRef
|
|
30
|
+
* - Logging
|
|
31
|
+
*/
|
|
32
|
+
declare abstract class BrowserApiBaseService {
|
|
33
|
+
protected permissionsService: PermissionsService;
|
|
34
|
+
protected destroyRef: DestroyRef;
|
|
35
|
+
protected platformId: Object;
|
|
36
|
+
/**
|
|
37
|
+
* Abstract method that must be implemented by child services
|
|
38
|
+
* Returns the API name for support checking
|
|
39
|
+
*/
|
|
40
|
+
protected abstract getApiName(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Check if running in browser environment using Angular's platform detection
|
|
43
|
+
*/
|
|
44
|
+
protected isBrowserEnvironment(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Check if running in server environment using Angular's platform detection
|
|
47
|
+
*/
|
|
48
|
+
protected isServerEnvironment(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Request a permission
|
|
51
|
+
*/
|
|
52
|
+
protected requestPermission(permission: PermissionNameExt): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* Create an error with proper cause chaining
|
|
55
|
+
*/
|
|
56
|
+
protected createError(message: string, cause?: unknown): Error;
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrowserApiBaseService, never>;
|
|
58
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BrowserApiBaseService>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare class CameraService extends BrowserApiBaseService {
|
|
62
|
+
private currentStream;
|
|
63
|
+
protected getApiName(): string;
|
|
64
|
+
private ensureCameraSupport;
|
|
65
|
+
startCamera(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
66
|
+
stopCamera(): void;
|
|
67
|
+
switchCamera(deviceId: string, constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
68
|
+
getCameraCapabilities(deviceId: string): Promise<MediaTrackCapabilities | null>;
|
|
69
|
+
getCurrentStream(): MediaStream | null;
|
|
70
|
+
isStreaming(): boolean;
|
|
71
|
+
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
72
|
+
getNativeMediaDevices(): MediaDevices;
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CameraService, never>;
|
|
74
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CameraService>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare class GeolocationService extends BrowserApiBaseService {
|
|
78
|
+
protected getApiName(): string;
|
|
79
|
+
private ensureGeolocationSupport;
|
|
80
|
+
getCurrentPosition(options?: PositionOptions): Promise<GeolocationPosition>;
|
|
81
|
+
watchPosition(options?: PositionOptions): Observable<GeolocationPosition>;
|
|
82
|
+
clearWatch(watchId: number): void;
|
|
83
|
+
getNativeGeolocation(): Geolocation;
|
|
84
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GeolocationService, never>;
|
|
85
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GeolocationService>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface DisplayMediaConstraints {
|
|
89
|
+
video?: boolean | MediaTrackConstraints;
|
|
90
|
+
audio?: boolean | MediaTrackConstraints;
|
|
91
|
+
}
|
|
92
|
+
declare class MediaDevicesService extends BrowserApiBaseService {
|
|
93
|
+
protected getApiName(): string;
|
|
94
|
+
private ensureMediaDevicesSupport;
|
|
95
|
+
getDevices(): Promise<MediaDeviceInfo[]>;
|
|
96
|
+
getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
|
|
97
|
+
getDisplayMedia(constraints?: DisplayMediaConstraints): Promise<MediaStream>;
|
|
98
|
+
watchDeviceChanges(): Observable<MediaDeviceInfo[]>;
|
|
99
|
+
getVideoInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
100
|
+
getAudioInputDevices(): Promise<MediaDeviceInfo[]>;
|
|
101
|
+
getAudioOutputDevices(): Promise<MediaDeviceInfo[]>;
|
|
102
|
+
private getDevicesByKind;
|
|
103
|
+
private handleMediaError;
|
|
104
|
+
getNativeMediaDevices(): MediaDevices;
|
|
105
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MediaDevicesService, never>;
|
|
106
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MediaDevicesService>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare class NotificationService extends BrowserApiBaseService {
|
|
110
|
+
protected getApiName(): string;
|
|
111
|
+
get permission(): NotificationPermission;
|
|
112
|
+
isSupported(): boolean;
|
|
113
|
+
requestNotificationPermission(): Promise<NotificationPermission>;
|
|
114
|
+
showNotification(title: string, options?: NotificationOptions): Promise<Notification>;
|
|
115
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
|
|
116
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class ClipboardService extends BrowserApiBaseService {
|
|
120
|
+
protected getApiName(): string;
|
|
121
|
+
private ensureClipboardPermission;
|
|
122
|
+
writeText(text: string): Promise<void>;
|
|
123
|
+
readText(): Promise<string>;
|
|
124
|
+
writeTextSecure(text: string): Promise<void>;
|
|
125
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ClipboardService, never>;
|
|
126
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ClipboardService>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
type BrowserCapabilityId = 'permissions' | 'geolocation' | 'clipboard' | 'notification' | 'mediaDevices' | 'camera' | 'webWorker' | 'regexSecurity' | 'webStorage' | 'webShare' | 'battery' | 'webSocket';
|
|
130
|
+
declare class BrowserCapabilityService {
|
|
131
|
+
getCapabilities(): readonly [{
|
|
132
|
+
readonly id: "permissions";
|
|
133
|
+
readonly label: "Permissions API";
|
|
134
|
+
readonly requiresSecureContext: false;
|
|
135
|
+
}, {
|
|
136
|
+
readonly id: "geolocation";
|
|
137
|
+
readonly label: "Geolocation API";
|
|
138
|
+
readonly requiresSecureContext: true;
|
|
139
|
+
}, {
|
|
140
|
+
readonly id: "clipboard";
|
|
141
|
+
readonly label: "Clipboard API";
|
|
142
|
+
readonly requiresSecureContext: true;
|
|
143
|
+
}, {
|
|
144
|
+
readonly id: "notification";
|
|
145
|
+
readonly label: "Notification API";
|
|
146
|
+
readonly requiresSecureContext: true;
|
|
147
|
+
}, {
|
|
148
|
+
readonly id: "mediaDevices";
|
|
149
|
+
readonly label: "MediaDevices API";
|
|
150
|
+
readonly requiresSecureContext: true;
|
|
151
|
+
}, {
|
|
152
|
+
readonly id: "camera";
|
|
153
|
+
readonly label: "Camera API";
|
|
154
|
+
readonly requiresSecureContext: true;
|
|
155
|
+
}, {
|
|
156
|
+
readonly id: "webWorker";
|
|
157
|
+
readonly label: "Web Worker API";
|
|
158
|
+
readonly requiresSecureContext: false;
|
|
159
|
+
}, {
|
|
160
|
+
readonly id: "regexSecurity";
|
|
161
|
+
readonly label: "Regex Security";
|
|
162
|
+
readonly requiresSecureContext: false;
|
|
163
|
+
}, {
|
|
164
|
+
readonly id: "webStorage";
|
|
165
|
+
readonly label: "Web Storage";
|
|
166
|
+
readonly requiresSecureContext: false;
|
|
167
|
+
}, {
|
|
168
|
+
readonly id: "webShare";
|
|
169
|
+
readonly label: "Web Share";
|
|
170
|
+
readonly requiresSecureContext: true;
|
|
171
|
+
}, {
|
|
172
|
+
readonly id: "battery";
|
|
173
|
+
readonly label: "Battery API";
|
|
174
|
+
readonly requiresSecureContext: false;
|
|
175
|
+
}, {
|
|
176
|
+
readonly id: "webSocket";
|
|
177
|
+
readonly label: "WebSocket API";
|
|
178
|
+
readonly requiresSecureContext: false;
|
|
179
|
+
}];
|
|
180
|
+
isSecureContext(): boolean;
|
|
181
|
+
isSupported(capability: BrowserCapabilityId): boolean;
|
|
182
|
+
getAllStatuses(): {
|
|
183
|
+
id: "camera" | "geolocation" | "permissions" | "mediaDevices" | "clipboard" | "notification" | "webWorker" | "regexSecurity" | "webStorage" | "webShare" | "battery" | "webSocket";
|
|
184
|
+
label: "Permissions API" | "Geolocation API" | "Clipboard API" | "Notification API" | "MediaDevices API" | "Camera API" | "Web Worker API" | "Regex Security" | "Web Storage" | "Web Share" | "Battery API" | "WebSocket API";
|
|
185
|
+
supported: boolean;
|
|
186
|
+
secureContext: boolean;
|
|
187
|
+
requiresSecureContext: boolean;
|
|
188
|
+
}[];
|
|
189
|
+
getPermissionState(permission: PermissionName): Promise<PermissionState | 'unknown'>;
|
|
190
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrowserCapabilityService, never>;
|
|
191
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BrowserCapabilityService>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface BatteryInfo {
|
|
195
|
+
charging: boolean;
|
|
196
|
+
chargingTime: number;
|
|
197
|
+
dischargingTime: number;
|
|
198
|
+
level: number;
|
|
199
|
+
}
|
|
200
|
+
interface BatteryManager extends EventTarget {
|
|
201
|
+
readonly charging: boolean;
|
|
202
|
+
readonly chargingTime: number;
|
|
203
|
+
readonly dischargingTime: number;
|
|
204
|
+
readonly level: number;
|
|
205
|
+
addEventListener(type: 'chargingchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
|
|
206
|
+
addEventListener(type: 'levelchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
|
|
207
|
+
addEventListener(type: 'chargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
|
|
208
|
+
addEventListener(type: 'dischargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | AddEventListenerOptions): void;
|
|
209
|
+
removeEventListener(type: 'chargingchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
|
|
210
|
+
removeEventListener(type: 'levelchange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
|
|
211
|
+
removeEventListener(type: 'chargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
|
|
212
|
+
removeEventListener(type: 'dischargingtimechange', listener: (this: BatteryManager, ev: Event) => void, options?: boolean | EventListenerOptions): void;
|
|
213
|
+
}
|
|
214
|
+
declare global {
|
|
215
|
+
interface Navigator {
|
|
216
|
+
getBattery?: () => Promise<BatteryManager>;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
declare class BatteryService extends BrowserApiBaseService {
|
|
221
|
+
private batteryManager;
|
|
222
|
+
protected getApiName(): string;
|
|
223
|
+
private ensureBatterySupport;
|
|
224
|
+
initialize(): Promise<BatteryInfo>;
|
|
225
|
+
getBatteryInfo(): BatteryInfo;
|
|
226
|
+
watchBatteryInfo(): Observable<BatteryInfo>;
|
|
227
|
+
private setupEventListeners;
|
|
228
|
+
getNativeBatteryManager(): BatteryManager;
|
|
229
|
+
isCharging(): boolean;
|
|
230
|
+
getLevel(): number;
|
|
231
|
+
getChargingTime(): number;
|
|
232
|
+
getDischargingTime(): number;
|
|
233
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BatteryService, never>;
|
|
234
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BatteryService>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface ShareResult {
|
|
238
|
+
shared: boolean;
|
|
239
|
+
error?: string;
|
|
240
|
+
}
|
|
241
|
+
declare class WebShareService extends BrowserApiBaseService {
|
|
242
|
+
protected getApiName(): string;
|
|
243
|
+
private ensureWebShareSupport;
|
|
244
|
+
share(data: ShareData): Promise<ShareResult>;
|
|
245
|
+
canShare(): boolean;
|
|
246
|
+
canShareFiles(): boolean;
|
|
247
|
+
getNativeShare(): typeof navigator.share;
|
|
248
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WebShareService, never>;
|
|
249
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WebShareService>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
type BrowserError = Error & {
|
|
253
|
+
name?: string;
|
|
254
|
+
message?: string;
|
|
255
|
+
};
|
|
256
|
+
type EventHandler<T = Event> = (event: T) => void;
|
|
257
|
+
type StorageValue = string | number | boolean | object | null;
|
|
258
|
+
type ErrorCallback = (error: BrowserError) => void;
|
|
259
|
+
|
|
260
|
+
interface StorageOptions {
|
|
261
|
+
prefix?: string;
|
|
262
|
+
serialize?: (value: StorageValue) => string;
|
|
263
|
+
deserialize?: (value: string) => StorageValue;
|
|
264
|
+
}
|
|
265
|
+
interface StorageEvent {
|
|
266
|
+
key: string;
|
|
267
|
+
newValue: StorageValue | null;
|
|
268
|
+
oldValue: StorageValue | null;
|
|
269
|
+
storageArea: 'localStorage' | 'sessionStorage';
|
|
270
|
+
}
|
|
271
|
+
declare class WebStorageService extends BrowserApiBaseService {
|
|
272
|
+
private storageEvents;
|
|
273
|
+
protected destroyRef: DestroyRef;
|
|
274
|
+
constructor();
|
|
275
|
+
protected getApiName(): string;
|
|
276
|
+
private ensureStorageSupport;
|
|
277
|
+
private setupEventListeners;
|
|
278
|
+
private serializeValue;
|
|
279
|
+
private deserializeValue;
|
|
280
|
+
private getKey;
|
|
281
|
+
setLocalStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
|
|
282
|
+
getLocalStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
|
|
283
|
+
removeLocalStorage(key: string, options?: StorageOptions): boolean;
|
|
284
|
+
clearLocalStorage(options?: StorageOptions): boolean;
|
|
285
|
+
setSessionStorage<T extends StorageValue>(key: string, value: T, options?: StorageOptions): boolean;
|
|
286
|
+
getSessionStorage<T extends StorageValue>(key: string, defaultValue?: T | null, options?: StorageOptions): T | null;
|
|
287
|
+
removeSessionStorage(key: string, options?: StorageOptions): boolean;
|
|
288
|
+
clearSessionStorage(options?: StorageOptions): boolean;
|
|
289
|
+
getLocalStorageSize(options?: StorageOptions): number;
|
|
290
|
+
getSessionStorageSize(options?: StorageOptions): number;
|
|
291
|
+
getStorageEvents(): Observable<StorageEvent>;
|
|
292
|
+
watchLocalStorage<T extends StorageValue>(key: string, options?: StorageOptions): Observable<T | null>;
|
|
293
|
+
watchSessionStorage<T extends StorageValue>(key: string, options?: StorageOptions): Observable<T | null>;
|
|
294
|
+
getNativeLocalStorage(): Storage;
|
|
295
|
+
getNativeSessionStorage(): Storage;
|
|
296
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WebStorageService, never>;
|
|
297
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WebStorageService>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface WebSocketConfig {
|
|
301
|
+
url: string;
|
|
302
|
+
protocols?: string | string[];
|
|
303
|
+
reconnectInterval?: number;
|
|
304
|
+
maxReconnectAttempts?: number;
|
|
305
|
+
heartbeatInterval?: number;
|
|
306
|
+
heartbeatMessage?: unknown;
|
|
307
|
+
}
|
|
308
|
+
interface WebSocketMessage<T = unknown> {
|
|
309
|
+
type: string;
|
|
310
|
+
data: T;
|
|
311
|
+
timestamp?: number;
|
|
312
|
+
}
|
|
313
|
+
interface WebSocketStatus {
|
|
314
|
+
connected: boolean;
|
|
315
|
+
connecting: boolean;
|
|
316
|
+
reconnecting: boolean;
|
|
317
|
+
error?: string;
|
|
318
|
+
reconnectAttempts: number;
|
|
319
|
+
}
|
|
320
|
+
declare class WebSocketService extends BrowserApiBaseService {
|
|
321
|
+
private webSocket;
|
|
322
|
+
private statusSubject;
|
|
323
|
+
private messageSubject;
|
|
324
|
+
private reconnectAttempts;
|
|
325
|
+
private reconnectTimer;
|
|
326
|
+
private heartbeatTimer;
|
|
327
|
+
protected getApiName(): string;
|
|
328
|
+
private ensureWebSocketSupport;
|
|
329
|
+
connect(config: WebSocketConfig): Observable<WebSocketStatus>;
|
|
330
|
+
disconnect(): void;
|
|
331
|
+
send<T>(message: WebSocketMessage<T>): void;
|
|
332
|
+
sendRaw(data: string): void;
|
|
333
|
+
getStatus(): Observable<WebSocketStatus>;
|
|
334
|
+
getMessages<T = unknown>(): Observable<WebSocketMessage<T>>;
|
|
335
|
+
private setupWebSocketHandlers;
|
|
336
|
+
private startHeartbeat;
|
|
337
|
+
private attemptReconnect;
|
|
338
|
+
private updateStatus;
|
|
339
|
+
private getCurrentStatus;
|
|
340
|
+
getNativeWebSocket(): WebSocket | null;
|
|
341
|
+
isConnected(): boolean;
|
|
342
|
+
getReadyState(): number;
|
|
343
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WebSocketService, never>;
|
|
344
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WebSocketService>;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
interface WorkerMessage<T = unknown> {
|
|
348
|
+
id: string;
|
|
349
|
+
type: string;
|
|
350
|
+
data: T;
|
|
351
|
+
timestamp: number;
|
|
352
|
+
}
|
|
353
|
+
interface WorkerStatus {
|
|
354
|
+
initialized: boolean;
|
|
355
|
+
running: boolean;
|
|
356
|
+
error?: string;
|
|
357
|
+
messageCount: number;
|
|
358
|
+
}
|
|
359
|
+
interface WorkerTask<T = unknown> {
|
|
360
|
+
id: string;
|
|
361
|
+
type: string;
|
|
362
|
+
data: T;
|
|
363
|
+
transferable?: Transferable[];
|
|
364
|
+
}
|
|
365
|
+
declare class WebWorkerService extends BrowserApiBaseService {
|
|
366
|
+
protected destroyRef: DestroyRef;
|
|
367
|
+
private workers;
|
|
368
|
+
private workerStatuses;
|
|
369
|
+
private workerMessages;
|
|
370
|
+
private currentWorkerStatuses;
|
|
371
|
+
protected getApiName(): string;
|
|
372
|
+
private ensureWorkerSupport;
|
|
373
|
+
createWorker(name: string, scriptUrl: string): Observable<WorkerStatus>;
|
|
374
|
+
terminateWorker(name: string): void;
|
|
375
|
+
terminateAllWorkers(): void;
|
|
376
|
+
postMessage(workerName: string, task: WorkerTask): void;
|
|
377
|
+
getMessages(workerName: string): Observable<WorkerMessage>;
|
|
378
|
+
getStatus(workerName: string): Observable<WorkerStatus>;
|
|
379
|
+
getCurrentStatus(workerName: string): WorkerStatus | undefined;
|
|
380
|
+
getAllStatuses(): Map<string, WorkerStatus>;
|
|
381
|
+
isWorkerRunning(workerName: string): boolean;
|
|
382
|
+
private setupWorker;
|
|
383
|
+
private updateWorkerStatus;
|
|
384
|
+
getNativeWorker(name: string): Worker | undefined;
|
|
385
|
+
getAllWorkers(): Map<string, Worker>;
|
|
386
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WebWorkerService, never>;
|
|
387
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WebWorkerService>;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface MediaDevice {
|
|
391
|
+
deviceId: string;
|
|
392
|
+
groupId: string;
|
|
393
|
+
kind: MediaDeviceKind;
|
|
394
|
+
label: string;
|
|
395
|
+
}
|
|
396
|
+
type MediaDeviceKind = 'videoinput' | 'audioinput' | 'audiooutput';
|
|
397
|
+
interface MediaStreamConstraints$1 {
|
|
398
|
+
video?: boolean | MediaTrackConstraints$1;
|
|
399
|
+
audio?: boolean | MediaTrackConstraints$1;
|
|
400
|
+
}
|
|
401
|
+
interface MediaTrackConstraints$1 {
|
|
402
|
+
width?: number | ConstrainULong;
|
|
403
|
+
height?: number | ConstrainULong;
|
|
404
|
+
facingMode?: string | ConstrainDOMString;
|
|
405
|
+
deviceId?: string | ConstrainDOMString;
|
|
406
|
+
groupId?: string | ConstrainDOMString;
|
|
407
|
+
frameRate?: number | ConstrainDouble;
|
|
408
|
+
aspectRatio?: number | ConstrainDouble;
|
|
409
|
+
sampleRate?: number | ConstrainULong;
|
|
410
|
+
sampleSize?: number | ConstrainULong;
|
|
411
|
+
echoCancellation?: boolean | ConstrainBoolean;
|
|
412
|
+
noiseSuppression?: boolean | ConstrainBoolean;
|
|
413
|
+
autoGainControl?: boolean | ConstrainBoolean;
|
|
414
|
+
}
|
|
415
|
+
interface CameraCapabilities {
|
|
416
|
+
width: {
|
|
417
|
+
min: number;
|
|
418
|
+
max: number;
|
|
419
|
+
step: number;
|
|
420
|
+
};
|
|
421
|
+
height: {
|
|
422
|
+
min: number;
|
|
423
|
+
max: number;
|
|
424
|
+
step: number;
|
|
425
|
+
};
|
|
426
|
+
aspectRatio: {
|
|
427
|
+
min: number;
|
|
428
|
+
max: number;
|
|
429
|
+
step: number;
|
|
430
|
+
};
|
|
431
|
+
frameRate: {
|
|
432
|
+
min: number;
|
|
433
|
+
max: number;
|
|
434
|
+
step: number;
|
|
435
|
+
};
|
|
436
|
+
facingMode: string[];
|
|
437
|
+
}
|
|
438
|
+
interface CameraInfo {
|
|
439
|
+
deviceId: string;
|
|
440
|
+
label: string;
|
|
441
|
+
capabilities?: CameraCapabilities;
|
|
442
|
+
kind: 'videoinput';
|
|
443
|
+
}
|
|
444
|
+
interface MediaDevicesInfo {
|
|
445
|
+
videoInputs: CameraInfo[];
|
|
446
|
+
audioInputs: MediaDevice[];
|
|
447
|
+
audioOutputs: MediaDevice[];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface GeolocationPosition$1 {
|
|
451
|
+
coords: GeolocationCoordinates;
|
|
452
|
+
timestamp: number;
|
|
453
|
+
}
|
|
454
|
+
interface GeolocationCoordinates {
|
|
455
|
+
latitude: number;
|
|
456
|
+
longitude: number;
|
|
457
|
+
altitude: number | null;
|
|
458
|
+
accuracy: number;
|
|
459
|
+
altitudeAccuracy: number | null;
|
|
460
|
+
heading: number | null;
|
|
461
|
+
speed: number | null;
|
|
462
|
+
}
|
|
463
|
+
interface GeolocationOptions {
|
|
464
|
+
enableHighAccuracy?: boolean;
|
|
465
|
+
timeout?: number;
|
|
466
|
+
maximumAge?: number;
|
|
467
|
+
}
|
|
468
|
+
interface GeolocationError {
|
|
469
|
+
code: number;
|
|
470
|
+
message: string;
|
|
471
|
+
PERMISSION_DENIED: number;
|
|
472
|
+
POSITION_UNAVAILABLE: number;
|
|
473
|
+
TIMEOUT: number;
|
|
474
|
+
}
|
|
475
|
+
interface GeolocationWatchOptions extends GeolocationOptions {
|
|
476
|
+
maximumAge?: number;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
declare class BrowserSupportUtil {
|
|
480
|
+
static isSupported(feature: string): boolean;
|
|
481
|
+
static getUnsupportedFeatures(): string[];
|
|
482
|
+
static isSecureContext(): boolean;
|
|
483
|
+
static getUserAgent(): string;
|
|
484
|
+
static isMobile(): boolean;
|
|
485
|
+
static isDesktop(): boolean;
|
|
486
|
+
static getBrowserInfo(): {
|
|
487
|
+
name: string;
|
|
488
|
+
version: string;
|
|
489
|
+
isChrome: boolean;
|
|
490
|
+
isFirefox: boolean;
|
|
491
|
+
isSafari: boolean;
|
|
492
|
+
isEdge: boolean;
|
|
493
|
+
};
|
|
494
|
+
private static getBrowserName;
|
|
495
|
+
private static getBrowserVersion;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Functional guard that checks if the user has the required permission.
|
|
500
|
+
* Usage in routes: { canActivate: [permissionGuard('camera')] }
|
|
501
|
+
*/
|
|
502
|
+
declare const permissionGuard: (permission: PermissionNameExt) => CanActivateFn;
|
|
503
|
+
|
|
504
|
+
interface BrowserWebApisConfig {
|
|
505
|
+
enableCamera?: boolean;
|
|
506
|
+
enableGeolocation?: boolean;
|
|
507
|
+
enableNotifications?: boolean;
|
|
508
|
+
enableClipboard?: boolean;
|
|
509
|
+
enableMediaDevices?: boolean;
|
|
510
|
+
enableBattery?: boolean;
|
|
511
|
+
enableWebShare?: boolean;
|
|
512
|
+
enableWebStorage?: boolean;
|
|
513
|
+
enableWebSocket?: boolean;
|
|
514
|
+
enableWebWorker?: boolean;
|
|
515
|
+
}
|
|
516
|
+
declare const defaultBrowserWebApisConfig: BrowserWebApisConfig;
|
|
517
|
+
declare function provideBrowserWebApis(config?: BrowserWebApisConfig): EnvironmentProviders;
|
|
518
|
+
declare function provideCamera(): EnvironmentProviders;
|
|
519
|
+
declare function provideGeolocation(): EnvironmentProviders;
|
|
520
|
+
declare function provideNotifications(): EnvironmentProviders;
|
|
521
|
+
declare function provideClipboard(): EnvironmentProviders;
|
|
522
|
+
declare function provideMediaDevices(): EnvironmentProviders;
|
|
523
|
+
declare function provideBattery(): EnvironmentProviders;
|
|
524
|
+
declare function provideWebShare(): EnvironmentProviders;
|
|
525
|
+
declare function provideWebStorage(): EnvironmentProviders;
|
|
526
|
+
declare function provideWebSocket(): EnvironmentProviders;
|
|
527
|
+
declare function provideWebWorker(): EnvironmentProviders;
|
|
528
|
+
declare function providePermissions(): EnvironmentProviders;
|
|
529
|
+
declare function provideMediaApis(): EnvironmentProviders;
|
|
530
|
+
declare function provideLocationApis(): EnvironmentProviders;
|
|
531
|
+
declare function provideStorageApis(): EnvironmentProviders;
|
|
532
|
+
declare function provideCommunicationApis(): EnvironmentProviders;
|
|
533
|
+
|
|
534
|
+
declare const version = "0.1.0";
|
|
535
|
+
|
|
536
|
+
export { BatteryService, BrowserApiBaseService, BrowserCapabilityService, BrowserSupportUtil, CameraService, ClipboardService, GeolocationService, MediaDevicesService, NotificationService, PermissionsService, WebShareService, WebSocketService, WebStorageService, WebWorkerService, permissionGuard as createPermissionGuard, defaultBrowserWebApisConfig, permissionGuard, provideBattery, provideBrowserWebApis, provideCamera, provideClipboard, provideCommunicationApis, provideGeolocation, provideLocationApis, provideMediaApis, provideMediaDevices, provideNotifications, providePermissions, provideStorageApis, provideWebShare, provideWebSocket, provideWebStorage, provideWebWorker, version };
|
|
537
|
+
export type { BatteryInfo, BatteryManager, BrowserCapabilityId, BrowserError, BrowserPermissions, BrowserWebApisConfig, CameraCapabilities, CameraInfo, ErrorCallback, EventHandler, GeolocationCoordinates, GeolocationError, GeolocationOptions, GeolocationPosition$1 as GeolocationPosition, GeolocationWatchOptions, MediaDevice, MediaDeviceKind, MediaDevicesInfo, MediaStreamConstraints$1 as MediaStreamConstraints, MediaTrackConstraints$1 as MediaTrackConstraints, PermissionNameExt, PermissionRequest, StorageEvent, StorageOptions, StorageValue, WebSocketConfig, WebSocketMessage, WebSocketStatus, WorkerMessage, WorkerStatus, WorkerTask };
|