Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mqfunctions

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mqfunctions - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

3

dist/index.d.ts
export { createMqFunctions } from './createMqFunctions';
export { addMqFunction } from './addMqFunction';
export { removeMqFunction } from './removeMqFunction';
export { runMqFunction } from './runMqFunction';
export type { MqFunctions, HandlerEvent, HandlerFunction, } from './types/MqFunctions';

54

dist/index.es.js
/*!
Mqfunctions.js v0.1.0
Mqfunctions.js v0.2.0
https://github.com/kimulaco/mqfunctions
Released under the MIT License.
*/
const createMqFunctions = (query) => {
if (!query) {
throw new Error('required query');
}
const functions = new Map();
return {
functions,
mql: window.matchMedia(query),
_handleChange: (event) => {
if (functions.size <= 0) {
return;
}
for (const [, fn] of functions) {
fn(event);
}
},
};
};
const addEventListener = (mql, handler) => {

@@ -81,3 +62,32 @@ if (typeof mql.addEventListener === 'function') {

export { addMqFunction, createMqFunctions, removeMqFunction, runMqFunction };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZXMuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVNcUZ1bmN0aW9ucy50cyIsIi4uL3NyYy91dGlscy9ldmVudExpc3RlbmVyLnRzIiwiLi4vc3JjL2FkZE1xRnVuY3Rpb24udHMiLCIuLi9zcmMvcmVtb3ZlTXFGdW5jdGlvbi50cyIsIi4uL3NyYy9ydW5NcUZ1bmN0aW9uLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHtcbiAgTXFGdW5jdGlvbnMsXG4gIEhhbmRsZXJGdW5jdGlvbixcbiAgSGFuZGxlckV2ZW50LFxufSBmcm9tICcuL3R5cGVzL01xRnVuY3Rpb25zJ1xuXG5leHBvcnQgY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sR0FBRyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDLEVBQUU7QUFDMUIsUUFBQSxNQUFNLElBQUksS0FBSyxDQUFDLEdBQUcsRUFBRSxDQUFBLGVBQUEsQ0FBaUIsQ0FBQyxDQUFBO0FBQ3hDLEtBQUE7SUFFRCxNQUFNLEVBQUUsR0FBRyxHQUFHLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsQ0FBQTtBQUNoQyxJQUFBLE1BQU0sYUFBYSxHQUFHLENBQUMsSUFBa0IsS0FBVTtBQUNqRCxRQUFBLElBQUksT0FBTyxFQUFFLEtBQUssVUFBVSxFQUFFO1lBQzVCLEVBQUUsQ0FBQyxJQUFJLENBQUMsQ0FBQTtBQUNULFNBQUE7QUFDSCxLQUFDLENBQUE7QUFFRCxJQUFBLGFBQWEsQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7QUFDeEI7Ozs7In0=
const createMqFunctions = (query) => {
if (!query) {
throw new Error('required query');
}
const functions = new Map();
const mqf = {
functions,
mql: window.matchMedia(query),
add(id, fn) {
addMqFunction(mqf, id, fn);
},
remove(id) {
removeMqFunction(mqf, id);
},
run(id) {
runMqFunction(mqf, id);
},
_handleChange: (event) => {
if (functions.size <= 0) {
return;
}
for (const [, fn] of functions) {
fn(event);
}
},
};
return mqf;
};
export { createMqFunctions };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZXMuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlscy9ldmVudExpc3RlbmVyLnRzIiwiLi4vc3JjL2FkZE1xRnVuY3Rpb24udHMiLCIuLi9zcmMvcmVtb3ZlTXFGdW5jdGlvbi50cyIsIi4uL3NyYy9ydW5NcUZ1bmN0aW9uLnRzIiwiLi4vc3JjL2NyZWF0ZU1xRnVuY3Rpb25zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIm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BQyxHQUFHLEVBQUUsRUFBRSxFQUFFLEVBQUUsQ0FBQyxDQUFBO1NBQzNCO0FBRUQsUUFBQSxNQUFNLENBQUMsRUFBVSxFQUFBO0FBQ2YsWUFBQSxnQkFBZ0IsQ0FBQyxHQUFHLEVBQUUsRUFBRSxDQUFDLENBQUE7U0FDMUI7QUFFRCxRQUFBLEdBQUcsQ0FBQyxFQUFVLEVBQUE7QUFDWixZQUFBLGFBQWEsQ0FBQyxHQUFHLEVBQUUsRUFBRSxDQUFDLENBQUE7U0FDdkI7QUFFRCxRQUFBLGFBQWEsRUFBRSxDQUFDLEtBQW1CLEtBQVU7QUFDM0MsWUFBQSxJQUFJLFNBQVMsQ0FBQyxJQUFJLElBQUksQ0FBQyxFQUFFO2dCQUN2QixPQUFNO0FBQ1AsYUFBQTtBQUVELFlBQUEsS0FBSyxNQUFNLEdBQUcsRUFBRSxDQUFDLElBQUksU0FBUyxFQUFFO2dCQUM5QixFQUFFLENBQUMsS0FBSyxDQUFDLENBQUE7QUFDVixhQUFBO1NBQ0Y7S0FDRixDQUFBO0FBRUQsSUFBQSxPQUFPLEdBQUcsQ0FBQTtBQUNaOzs7OyJ9
/*!
Mqfunctions.js v0.1.0
Mqfunctions.js v0.2.0
https://github.com/kimulaco/mqfunctions

@@ -8,21 +8,2 @@ Released under the MIT License.

const createMqFunctions = (query) => {
if (!query) {
throw new Error('required query');
}
const functions = new Map();
return {
functions,
mql: window.matchMedia(query),
_handleChange: (event) => {
if (functions.size <= 0) {
return;
}
for (const [, fn] of functions) {
fn(event);
}
},
};
};
const addEventListener = (mql, handler) => {

@@ -84,10 +65,34 @@ if (typeof mql.addEventListener === 'function') {

var mqfunctions = {
createMqFunctions,
addMqFunction,
removeMqFunction,
runMqFunction,
const createMqFunctions = (query) => {
if (!query) {
throw new Error('required query');
}
const functions = new Map();
const mqf = {
functions,
mql: window.matchMedia(query),
add(id, fn) {
addMqFunction(mqf, id, fn);
},
remove(id) {
removeMqFunction(mqf, id);
},
run(id) {
runMqFunction(mqf, id);
},
_handleChange: (event) => {
if (functions.size <= 0) {
return;
}
for (const [, fn] of functions) {
fn(event);
}
},
};
return mqf;
};
var mqfunctions = { createMqFunctions };
module.exports = mqfunctions;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVNcUZ1bmN0aW9ucy50cyIsIi4uL3NyYy91dGlscy9ldmVudExpc3RlbmVyLnRzIiwiLi4vc3JjL2FkZE1xRnVuY3Rpb24udHMiLCIuLi9zcmMvcmVtb3ZlTXFGdW5jdGlvbi50cyIsIi4uL3NyYy9ydW5NcUZ1bmN0aW9uLnRzIiwiLi4vc3JjL21xZnVuY3Rpb25zLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB0eXBlIHtcbiAgTXFGdW5jdGlvbnMsXG4gIEhhbmRsZXJGdW5jdGlvbixcbiAgSGFuZGxlckV2ZW50LFxufSBmcm9tICcuL3R5cGVzL01xRnVuY3Rpb25zJ1xuXG5leHBvcnQgY29uc3QgY3JlYXRlTXFGdW5jdGlvbnMgPSAocXVlcnk6IHN0cmluZyk6IE1xRnVuY3Rpb25zID0+IHtcbiAgaWYgKCFxdWVyeSkge1xuICAgIHRocm93IG5ldyBFcnJvcigncmVxdWlyZWQgcXVlcnknKVxuICB9XG5cbiAgY29uc3QgZnVuY3Rpb25zID0gbmV3IE1hcDxzdHJpbmcsIEhhbmRsZXJGdW5jdGlvbj4oKVxuXG4gIHJldHVybiB7XG4gICAgZnVuY3Rpb25zLFxuICAgIG1xbDogd2luZG93Lm1hdGNoTWVkaWEocXVlcnkpLFxuICAgIF9oYW5kbGVDaGFuZ2U6IChldmVudDogSGFuZGxlckV2ZW50KTogdm9pZCA9PiB7XG4gICAgICBpZiAoZnVuY3Rpb25zLnNpemUgPD0gMCkge1xuICAgICAgICByZXR1cm5cbiAgICAgIH1cblxuICAgIC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TUFBTSxJQUFJLEtBQUssQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ2xDLEtBQUE7QUFFRCxJQUFBLE1BQU0sU0FBUyxHQUFHLElBQUksR0FBRyxFQUEyQixDQUFBO0FBRXBELElBQUEsTUFBTSxHQUFHLEdBQWdCO1FBQ3ZCLFNBQVM7QUFFVCxRQUFBLEdBQUcsRUFBRSxNQUFNLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQztRQUU3QixHQUFHLENBQUMsRUFBVSxFQUFFLEVBQW1CLEVBQUE7QUFDakMsWUFBQSxhQUFhLENBQUMsR0FBRyxFQUFFLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0FBQTtTQUMzQjtBQUVELFFBQUEsTUFBTSxDQUFDLEVBQVUsRUFBQTtBQUNmLFlBQUEsZ0JBQWdCLENBQUMsR0FBRyxFQUFFLEVBQUUsQ0FBQyxDQUFBO1NBQzFCO0FBRUQsUUFBQSxHQUFHLENBQUMsRUFBVSxFQUFBO0FBQ1osWUFBQSxhQUFhLENBQUMsR0FBRyxFQUFFLEVBQUUsQ0FBQyxDQUFBO1NBQ3ZCO0FBRUQsUUFBQSxhQUFhLEVBQUUsQ0FBQyxLQUFtQixLQUFVO0FBQzNDLFlBQUEsSUFBSSxTQUFTLENBQUMsSUFBSSxJQUFJLENBQUMsRUFBRTtnQkFDdkIsT0FBTTtBQUNQLGFBQUE7QUFFRCxZQUFBLEtBQUssTUFBTSxHQUFHLEVBQUUsQ0FBQyxJQUFJLFNBQVMsRUFBRTtnQkFDOUIsRUFBRSxDQUFDLEtBQUssQ0FBQyxDQUFBO0FBQ1YsYUFBQTtTQUNGO0tBQ0YsQ0FBQTtBQUVELElBQUEsT0FBTyxHQUFHLENBQUE7QUFDWixDQUFDOztBQ3JDRCxrQkFBZSxFQUFFLGlCQUFpQixFQUFFOzs7OyJ9
export type { MqFunctions, HandlerEvent, HandlerFunction, } from './types/MqFunctions';
declare const _default: {
createMqFunctions: (query: string) => import("./types/MqFunctions").MqFunctions;
addMqFunction: (mqf: import("./types/MqFunctions").MqFunctions, id: string, fn: import("./types/MqFunctions").HandlerFunction) => void;
removeMqFunction: (mqf: import("./types/MqFunctions").MqFunctions, id: string) => void;
runMqFunction: (mqf: import("./types/MqFunctions").MqFunctions, id: string) => void;
};
export default _default;
/*!
Mqfunctions.js v0.1.0
Mqfunctions.js v0.2.0
https://github.com/kimulaco/mqfunctions

@@ -9,21 +9,2 @@ Released under the MIT License.

const createMqFunctions = (query) => {
if (!query) {
throw new Error('required query');
}
const functions = new Map();
return {
functions,
mql: window.matchMedia(query),
_handleChange: (event) => {
if (functions.size <= 0) {
return;
}
for (const [, fn] of functions) {
fn(event);
}
},
};
};
const addEventListener = (mql, handler) => {

@@ -85,12 +66,36 @@ if (typeof mql.addEventListener === 'function') {

var mqfunctions = {
createMqFunctions,
addMqFunction,
removeMqFunction,
runMqFunction,
const createMqFunctions = (query) => {
if (!query) {
throw new Error('required query');
}
const functions = new Map();
const mqf = {
functions,
mql: window.matchMedia(query),
add(id, fn) {
addMqFunction(mqf, id, fn);
},
remove(id) {
removeMqFunction(mqf, id);
},
run(id) {
runMqFunction(mqf, id);
},
_handleChange: (event) => {
if (functions.size <= 0) {
return;
}
for (const [, fn] of functions) {
fn(event);
}
},
};
return mqf;
};
var mqfunctions = { createMqFunctions };
return mqfunctions;
})();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXFmdW5jdGlvbnMuanMiLCJzb3VyY2VzIjpbIi4uL3NyYy9jcmVhdGVNcUZ1bmN0aW9ucy50cyIsIi4uL3NyYy91dGlscy9ldmVudExpc3RlbmVyLnRzIiwiLi4vc3JjL2FkZE1xRnVuY3Rpb24udHMiLCIuLi9zcmMvcmVtb3ZlTXFGdW5jdGlvbi50cyIsIi4uL3NyYy9ydW5NcUZ1bmN0aW9uLnRzIiwiLi4vc3JjL21xZnVuY3Rpb25zLnRzIl0sInNvdXJjZXND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Q0FBQyxHQUFHLEVBQUUsRUFBRSxDQUFDLENBQUE7YUFDMUI7SUFFRCxRQUFBLEdBQUcsQ0FBQyxFQUFVLEVBQUE7SUFDWixZQUFBLGFBQWEsQ0FBQyxHQUFHLEVBQUUsRUFBRSxDQUFDLENBQUE7YUFDdkI7SUFFRCxRQUFBLGFBQWEsRUFBRSxDQUFDLEtBQW1CLEtBQVU7SUFDM0MsWUFBQSxJQUFJLFNBQVMsQ0FBQyxJQUFJLElBQUksQ0FBQyxFQUFFO29CQUN2QixPQUFNO0lBQ1AsYUFBQTtJQUVELFlBQUEsS0FBSyxNQUFNLEdBQUcsRUFBRSxDQUFDLElBQUksU0FBUyxFQUFFO29CQUM5QixFQUFFLENBQUMsS0FBSyxDQUFDLENBQUE7SUFDVixhQUFBO2FBQ0Y7U0FDRixDQUFBO0lBRUQsSUFBQSxPQUFPLEdBQUcsQ0FBQTtJQUNaLENBQUM7O0FDckNELHNCQUFlLEVBQUUsaUJBQWlCLEVBQUU7Ozs7Ozs7OyJ9
/*!
Mqfunctions.js v0.1.0
Mqfunctions.js v0.2.0
https://github.com/kimulaco/mqfunctions
Released under the MIT License.
*/
var Mqfunctions=function(){"use strict";const n=(n,e)=>{"function"!=typeof n.addEventListener?n.addListener(e):n.addEventListener("change",e)},e=(n,e)=>{"function"==typeof n.addEventListener&&n.removeEventListener("change",e),n.removeListener(e)};return{createMqFunctions:n=>{if(!n)throw new Error("required query");const e=new Map;return{functions:e,mql:window.matchMedia(n),_handleChange:n=>{if(!(e.size<=0))for(const[,r]of e)r(n)}}},addMqFunction:(r,t,i)=>{if(!t)throw new Error("required function id");if(r.functions.has(t))throw new Error(`${t} has already been added`);r.functions.set(t,i),e(r.mql,r._handleChange.bind(r)),n(r.mql,r._handleChange.bind(r))},removeMqFunction:(r,t)=>{if(!t)throw new Error("required function id");if(!r.functions.has(t))throw new Error(`${t} does not exist`);r.functions.delete(t),e(r.mql,r._handleChange.bind(r)),n(r.mql,r._handleChange.bind(r))},runMqFunction:(n,e)=>{if(!e)throw new Error("required function id");if(!n.functions.has(e))throw new Error(`${e} does not exist`);const r=n.functions.get(e);var t;t=n.mql,"function"==typeof r&&r(t)}}}();
var Mqfunctions=function(){"use strict";const n=(n,e)=>{"function"!=typeof n.addEventListener?n.addListener(e):n.addEventListener("change",e)},e=(n,e)=>{"function"==typeof n.addEventListener&&n.removeEventListener("change",e),n.removeListener(e)};return{createMqFunctions:r=>{if(!r)throw new Error("required query");const t=new Map,i={functions:t,mql:window.matchMedia(r),add(r,t){((r,t,i)=>{if(!t)throw new Error("required function id");if(r.functions.has(t))throw new Error(`${t} has already been added`);r.functions.set(t,i),e(r.mql,r._handleChange.bind(r)),n(r.mql,r._handleChange.bind(r))})(i,r,t)},remove(r){((r,t)=>{if(!t)throw new Error("required function id");if(!r.functions.has(t))throw new Error(`${t} does not exist`);r.functions.delete(t),e(r.mql,r._handleChange.bind(r)),n(r.mql,r._handleChange.bind(r))})(i,r)},run(n){((n,e)=>{if(!e)throw new Error("required function id");if(!n.functions.has(e))throw new Error(`${e} does not exist`);const r=n.functions.get(e);var t;t=n.mql,"function"==typeof r&&r(t)})(i,n)},_handleChange:n=>{if(!(t.size<=0))for(const[,e]of t)e(n)}};return i}}}();

@@ -9,3 +9,6 @@ export declare type HandlerEvent = {

readonly mql: MediaQueryList;
readonly add: (id: string, fn: HandlerFunction) => void;
readonly remove: (id: string) => void;
readonly run: (id: string) => void;
readonly _handleChange: (event: HandlerEvent) => void;
};
{
"name": "mqfunctions",
"version": "0.1.0",
"version": "0.2.0",
"description": "JavaScript library to manage matchMedia handlers.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -6,2 +6,3 @@ # mqfunctions

[![npm version](https://badge.fury.io/js/mqfunctions.svg)](https://badge.fury.io/js/mqfunctions)
[![codecov](https://codecov.io/gh/kimulaco/mqfunctions/branch/main/graph/badge.svg?token=OK88TDWT9B)](https://codecov.io/gh/kimulaco/mqfunctions)

@@ -19,8 +20,3 @@ JavaScript library to manage matchMedia handlers.

```js
import {
createMqFunctions,
addMqFunction,
runMqFunction,
removeMqFunction,
} from 'mqfunctions'
import { createMqFunctions } from 'mqfunctions'

@@ -30,3 +26,3 @@ const mqf = createMqFunctions('(min-width: 768px)')

// Add matchMedia handler
addMqFunction(mqf, 'function-01', (event) => {
mqf.add('function-01', (event) => {
if (event.matches) {

@@ -40,6 +36,6 @@ console.log('Resized window to PC size!')

// Run handler arbitrarily
runMqFunction(mqf, 'function-01')
mqf.run('function-01')
// Remove handler
removeMqFunction(mqf, 'function-01')
mqf.remove('function-01')
```

@@ -46,0 +42,0 @@

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