{"id":26519063,"url":"https://github.com/maroun-baydoun/mediaq","last_synced_at":"2025-06-13T01:05:39.286Z","repository":{"id":31839458,"uuid":"35406490","full_name":"maroun-baydoun/mediaq","owner":"maroun-baydoun","description":"Listen to media query updates in JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-07T03:55:51.000Z","size":1809,"stargazers_count":10,"open_issues_count":13,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T03:15:51.788Z","etag":null,"topics":["css","javascript","media-queries","responsive","typescript"],"latest_commit_sha":null,"homepage":"https://dev.maroun-baydoun.com/mediaq/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maroun-baydoun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-11T06:33:41.000Z","updated_at":"2021-10-05T02:22:31.000Z","dependencies_parsed_at":"2023-01-14T19:53:06.693Z","dependency_job_id":null,"html_url":"https://github.com/maroun-baydoun/mediaq","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/maroun-baydoun/mediaq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maroun-baydoun%2Fmediaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maroun-baydoun%2Fmediaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maroun-baydoun%2Fmediaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maroun-baydoun%2Fmediaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maroun-baydoun","download_url":"https://codeload.github.com/maroun-baydoun/mediaq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maroun-baydoun%2Fmediaq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259559690,"owners_count":22876499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","javascript","media-queries","responsive","typescript"],"created_at":"2025-03-21T10:17:39.199Z","updated_at":"2025-06-13T01:05:39.249Z","avatar_url":"https://github.com/maroun-baydoun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mediaq\nListen to media query updates in JavaScript\n\n[![npm version](https://badge.fury.io/js/mediaq.svg)](https://badge.fury.io/js/mediaq)\n\n\n#### Install\n\n```\nnpm i mediaq\n```\nOr\n\n```\nyarn add mediaq\n```\n\n#### Use\n\n```js\nimport { Mediaq } from \"mediaq\";\n\nconst mediaq = Mediaq({\n  onUpdate: (e) =\u003e console.log(e.name, e.media, e.matches),\n  mediaQueries: [{\n    name: \"mobile\",\n    media: \"only screen and (max-width: 600px)\"\n  }, {\n    name: \"desktop\",\n    media: \"only screen and (min-width: 600px)\"\n  }]\n});\n\n\nmediaq.start();\n\n// When done listening \nmediaq.stop();\n```\n\n\n#### API\n\n The `Mediaq` function expects a single object argument with `onUpdate` and `mediaQueries` keys.\n\n * `onUpdate` takes one argument having the `media`, `name` and `matches` properties.\n * `mediaQueries` is an array of objects having the `name` and `media` keys.\n\nIt returns an object having the `start` and `stop` methods.\n\n* `start` calls `onUpdate` with the current state of mediaquery matches and listens for future updates. Calling this method repeatedly has no effect.\n* `stop` ceases listening for mediaquery updates. Calling this method repeatedly has no effect.\n\n\n#### Demo\n\nSee it running in action in this [demo](https://dev.maroun-baydoun.com/mediaq/#demo).\n\n\n#### License\nMIT\nCopyright (c) [Maroun Baydoun](https://maroun-baydoun.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaroun-baydoun%2Fmediaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaroun-baydoun%2Fmediaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaroun-baydoun%2Fmediaq/lists"}