Socket
Socket
Sign inDemoInstall

subscribable-things

Package Overview
Dependencies
Maintainers
1
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

subscribable-things - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

build/es2019/factories/media-devices.d.ts

1

build/es2019/module.d.ts
export * from './interfaces/index';
export * from './types/index';
export declare const mediaDevices: import("./types").TMediaDevicesFunction;
export declare const mediaQueryMatch: import("./types").TMediaQueryMatchFunction;

@@ -4,0 +5,0 @@ export declare const mutations: import("./types").TMutationsFunction;

import { patch, toObserver } from 'rxjs-interop';
import { createMediaDevices } from './factories/media-devices';
import { createMediaQueryMatch } from './factories/media-query-match';

@@ -17,2 +18,3 @@ import { createMutations } from './factories/mutations';

const wrapSubscribeFunction = createWrapSubscribeFunction(patch, toObserver);
export const mediaDevices = createMediaDevices(emitNotSupportedError, window, wrapSubscribeFunction);
export const mediaQueryMatch = createMediaQueryMatch(emitNotSupportedError, window, wrapSubscribeFunction);

@@ -19,0 +21,0 @@ export const mutations = createMutations(emitNotSupportedError, window, wrapSubscribeFunction);

export * from './emit-not-supported-error-function';
export * from './flexible-subscribe-function';
export * from './media-devices-factory';
export * from './media-devices-function';
export * from './media-query-match-factory';

@@ -4,0 +6,0 @@ export * from './media-query-match-function';

export * from './emit-not-supported-error-function';
export * from './flexible-subscribe-function';
export * from './media-devices-factory';
export * from './media-devices-function';
export * from './media-query-match-factory';

@@ -4,0 +6,0 @@ export * from './media-query-match-function';

@@ -7,2 +7,36 @@ (function (global, factory) {

var createMediaDevices = function createMediaDevices(emitNotSupportedError, window, wrapSubscribeFunction) {
return function () {
return wrapSubscribeFunction(function (observer) {
if (window === null || window.navigator === undefined || window.navigator.mediaDevices === undefined || window.navigator.mediaDevices.enumerateDevices === undefined) {
return emitNotSupportedError(observer);
}
var isActive = true;
var enumerateDevices = function enumerateDevices() {
window.navigator.mediaDevices.enumerateDevices().then(function (mediaDevices) {
if (isActive) {
observer.next(mediaDevices);
}
})["catch"](function (err) {
if (isActive) {
unsubscribe();
observer.error(err);
}
});
};
var unsubscribe = function unsubscribe() {
isActive = false;
window.navigator.mediaDevices.removeEventListener('devicechange', enumerateDevices);
};
enumerateDevices();
window.navigator.mediaDevices.addEventListener('devicechange', enumerateDevices);
return unsubscribe;
});
};
};
var createMediaQueryMatch = function createMediaQueryMatch(emitNotSupportedError, window, wrapSubscribeFunction) {

@@ -149,2 +183,3 @@ return function (mediaQueryString) {

var wrapSubscribeFunction = createWrapSubscribeFunction(rxjsInterop.patch, rxjsInterop.toObserver);
var mediaDevices = createMediaDevices(emitNotSupportedError, window$1, wrapSubscribeFunction);
var mediaQueryMatch = createMediaQueryMatch(emitNotSupportedError, window$1, wrapSubscribeFunction);

@@ -155,2 +190,3 @@ var mutations = createMutations(emitNotSupportedError, window$1, wrapSubscribeFunction);

exports.mediaDevices = mediaDevices;
exports.mediaQueryMatch = mediaQueryMatch;

@@ -157,0 +193,0 @@ exports.mutations = mutations;

6

package.json

@@ -46,4 +46,4 @@ {

"mocha": "^7.1.0",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.3.3",
"rollup": "^2.0.2",
"rollup-plugin-babel": "^4.4.0",
"rxjs": "^6.5.4",

@@ -91,3 +91,3 @@ "sinon": "^9.0.0",

"types": "build/es2019/module.d.ts",
"version": "1.1.1"
"version": "1.2.0"
}

@@ -95,5 +95,9 @@ # subscribable-things

### mediaDevices(): SubscribableThing\<MediaDeviceInfo[]>
This function is a wrapper for the [`enumerateDevices()`](https://developer.mozilla.org/docs/Web/API/MediaDevices/enumerateDevices) method of the [Media Capture and Streams specification](https://w3c.github.io/mediacapture-main). It will also listen for the [`devicechange` event](https://developer.mozilla.org/docs/Web/API/MediaDevices/devicechange_event) to emit a fresh list of devices whenever they change.
### mediaQueryMatch(mediaQueryString: string): SubscribableThing\<boolean>
This function is a wrapper for the [`matchMedia()`](https://developer.mozilla.org/docs/Web/API/Window/matchMedia) method.
This function is a wrapper for the [`matchMedia()`](https://developer.mozilla.org/docs/Web/API/Window/matchMedia) method. It will emit a new value whenever the result of `matchMedia()` changes.

@@ -106,3 +110,3 @@ ### mutations(htmlElement: HTMLElement, options: MutationObserverInit): SubscribableThing\<MutationRecord[]>

This function is a wrapper for the [`query()`](https://developer.mozilla.org/docs/Web/API/Permissions/query) method of the [Permissions API](https://w3c.github.io/permissions).
This function is a wrapper for the [`query()`](https://developer.mozilla.org/docs/Web/API/Permissions/query) method of the [Permissions API](https://w3c.github.io/permissions). It will monitor the permission status to emit a new state whenever it gets updated.

@@ -109,0 +113,0 @@ ### reports(options: IReportingObserverOptions): SubscribableThing\<IReport[]>

import { patch, toObserver } from 'rxjs-interop';
import { createMediaDevices } from './factories/media-devices';
import { createMediaQueryMatch } from './factories/media-query-match';

@@ -20,2 +21,4 @@ import { createMutations } from './factories/mutations';

export const mediaDevices = createMediaDevices(emitNotSupportedError, window, wrapSubscribeFunction);
export const mediaQueryMatch = createMediaQueryMatch(emitNotSupportedError, window, wrapSubscribeFunction);

@@ -22,0 +25,0 @@

export * from './emit-not-supported-error-function';
export * from './flexible-subscribe-function';
export * from './media-devices-factory';
export * from './media-devices-function';
export * from './media-query-match-factory';

@@ -4,0 +6,0 @@ export * from './media-query-match-function';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc