{"_id":"@288-toolkit/device","_rev":"9-88a78a9342d2d112f3bf781d909f6e24","name":"@288-toolkit/device","dist-tags":{"latest":"5.0.0"},"versions":{"1.0.0":{"name":"@288-toolkit/device","version":"1.0.0","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@1.0.0","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"dd3e3e5a56609edad75ffaa8b7f92e69153996b9","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-1.0.0.tgz","fileCount":20,"integrity":"sha512-GoKLlPLqzkfEhVY3yMPtVdoXIjX41a6QUTfIqFLKGPlc2DeeltIqT8JxmqPavTUhNHmT3ZiEC3yEqooAOeAbGA==","signatures":[{"sig":"MEUCIQDwZhXYEJ6HBMqCGtNtlzptkZoz1kBZdZnQ8yFoNQW/mgIgCwmg/XWLnYul+2XUhMOy9Nxm/XPw1reAwuS0uRz3Gac=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7134},"type":"module","_from":"file:288-toolkit-device-1.0.0.tgz","exports":{"./media":{"default":"./src/media/index.ts"},"./window":{"default":"./src/window/index.ts"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/c2c960fa111cec020a5e7edfcdac33ef/288-toolkit-device-1.0.0.tgz","_integrity":"sha512-GoKLlPLqzkfEhVY3yMPtVdoXIjX41a6QUTfIqFLKGPlc2DeeltIqT8JxmqPavTUhNHmT3ZiEC3yEqooAOeAbGA==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"1.3.2"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_1.0.0_1713968297435_0.7018892938126757","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@288-toolkit/device","version":"1.0.1","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@1.0.1","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"241cfeb41798bc20addb0590d1c636f4ac470b81","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-1.0.1.tgz","fileCount":17,"integrity":"sha512-SrKp5HbxOxpE/99vB4AEFpreBRGTwmAHb5/y0Pz1Z0kMQ/KjkFmHn38Gc8nDaNhc6qg68eArKaJ/2F4EQWYX3g==","signatures":[{"sig":"MEQCIBE0I4im3HraAPHza5XuD5Fvw3aMqs95xiQbtjBqRm6YAiAkuuuJmD+3AB9dKNs91Iq943eI3kRoHDRRnMHq0p++og==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6746},"type":"module","_from":"file:288-toolkit-device-1.0.1.tgz","exports":{"./media":{"default":"./src/media/index.ts"},"./window":{"default":"./src/window/index.ts"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/e4c390e9dd3d1dfe36903449d3bedda7/288-toolkit-device-1.0.1.tgz","_integrity":"sha512-SrKp5HbxOxpE/99vB4AEFpreBRGTwmAHb5/y0Pz1Z0kMQ/KjkFmHn38Gc8nDaNhc6qg68eArKaJ/2F4EQWYX3g==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"1.3.3"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_1.0.1_1714076110846_0.9896976716599746","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@288-toolkit/device","version":"1.1.0","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@1.1.0","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"733eec8e3e63a7e2bfd3c0851704bf71a0327615","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-1.1.0.tgz","fileCount":18,"integrity":"sha512-l6JmfYpbNsIcvDNsG53VMwzJs1LxDzMnoI12nyazO7BURR7s7Kbv/CQCenwMCgfL/WQeQ0mnA2Cwgyz5dcQYSw==","signatures":[{"sig":"MEQCIG0yzRMl+gXM0uLE9pgTS8q7+irlC+2VmeLIqMvfxxCpAiBjR9z9yNWl+TnOArMqM1qWwPYcgl4mQmJUQLy3YHZOmg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10788},"type":"module","_from":"file:288-toolkit-device-1.1.0.tgz","exports":{"./media":{"default":"./src/media/index.ts"},"./window":{"default":"./src/window/index.ts"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/2344d61352dc7042a0b03ee40c2b8d8c/288-toolkit-device-1.1.0.tgz","_integrity":"sha512-l6JmfYpbNsIcvDNsG53VMwzJs1LxDzMnoI12nyazO7BURR7s7Kbv/CQCenwMCgfL/WQeQ0mnA2Cwgyz5dcQYSw==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"1.3.3"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_1.1.0_1714417498547_0.06936826630879067","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@288-toolkit/device","version":"1.2.0","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@1.2.0","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"b6fe4363e77a29bccb9b9d5729e6ce90ba795437","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-1.2.0.tgz","fileCount":18,"integrity":"sha512-szMjw8kzc038bXxzSpliBWPn0wDqaIygTuM5jzTnomOJBrGYPwZLFs40U+KGAgBmbgADVRrudl2xvReFs2EecQ==","signatures":[{"sig":"MEYCIQCvZeyb1NC/Sks+ENg+mHKKxhCrgkv6u4RrwHB90DoK5gIhAK8aDJ5KajPwNVtP09NlvhC5yElziGSE5cMpsvE5hcTs","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10823},"type":"module","_from":"file:288-toolkit-device-1.2.0.tgz","exports":{"./media":{"default":"./src/media/index.ts"},"./window":{"default":"./src/window/index.ts"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/f219d3d02a9bd03315943ca919a93a2f/288-toolkit-device-1.2.0.tgz","_integrity":"sha512-szMjw8kzc038bXxzSpliBWPn0wDqaIygTuM5jzTnomOJBrGYPwZLFs40U+KGAgBmbgADVRrudl2xvReFs2EecQ==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"1.3.3"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_1.2.0_1714418044758_0.1284436514971974","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"@288-toolkit/device","version":"3.0.0","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@3.0.0","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"06e0c362551fb570d6cd2c47a6717c138647d516","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-3.0.0.tgz","fileCount":34,"integrity":"sha512-f985bDfwyc3qJxhCHcx6KqO2G6dHZ8+/b8NEa/cQ/w+a15Jv0c4cs7CxVm//0lkQ4Qir+3XLhsBj4dQ0p0DsXQ==","signatures":[{"sig":"MEUCIQCgi8SEw63gVCWFKjac802zNiqzeSMJRlCE7TAC99oZDQIgeI2KOFLXDcUu58mYUE4ieNYWRyPp6mYKeLk7VgNZN/c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15345},"type":"module","_from":"file:288-toolkit-device-3.0.0.tgz","exports":{"./media":{"types":"./dist/media/index.d.ts","default":"./dist/media/index.js"},"./window":{"types":"./dist/window/index.d.ts","default":"./dist/window/index.js"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","build":"svelte-package","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/fdbbfe54bdbe3c9d2ee789b10695b0b3/288-toolkit-device-3.0.0.tgz","_integrity":"sha512-f985bDfwyc3qJxhCHcx6KqO2G6dHZ8+/b8NEa/cQ/w+a15Jv0c4cs7CxVm//0lkQ4Qir+3XLhsBj4dQ0p0DsXQ==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"3.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_3.0.0_1714509587326_0.853403905546418","host":"s3://npm-registry-packages"}},"4.0.0":{"name":"@288-toolkit/device","version":"4.0.0","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@4.0.0","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"3d25ded40dfafab6fe38d344ddefe97c1c1f092d","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-4.0.0.tgz","fileCount":34,"integrity":"sha512-PcdUV17r3YFsX91GDQncNn85yp6ok6czU7kc1npfVY+/YDUYCFM4pE53lSoH8WAle9VuHLGnLJUdpsEKl09+8A==","signatures":[{"sig":"MEUCIHkxBDKgg6iYYz/9t8s1+MprsErt5qHu001TRy9A4A4TAiEA+q0G7m+HLOb0yfRh/5xJ5EtnffFouhmYU9ip+d+cxpo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15462},"type":"module","_from":"file:288-toolkit-device-4.0.0.tgz","exports":{"./media":{"types":"./dist/media/index.d.ts","default":"./dist/media/index.js"},"./window":{"types":"./dist/window/index.d.ts","default":"./dist/window/index.js"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","build":"svelte-package","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/32602188dd49b5f2bd178cfcb053ae8b/288-toolkit-device-4.0.0.tgz","_integrity":"sha512-PcdUV17r3YFsX91GDQncNn85yp6ok6czU7kc1npfVY+/YDUYCFM4pE53lSoH8WAle9VuHLGnLJUdpsEKl09+8A==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"3.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_4.0.0_1714522075239_0.23338428676029088","host":"s3://npm-registry-packages"}},"4.0.1":{"name":"@288-toolkit/device","version":"4.0.1","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@4.0.1","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"62b3bb1c63f4eae8a44560fafc2b6e206a49c291","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-4.0.1.tgz","fileCount":34,"integrity":"sha512-EMfRsfSyYL+YmIA3ioW0JjxZUhLkWP3x2IM5brT9baygsRkUdLNaZF1y1D0ilJy3td/z1raEvxYZRIJpzhLZPQ==","signatures":[{"sig":"MEUCIBG+IyjO6HXcyIJN+sEU5lBZtm1YlPx5TFJO3chlXY6AAiEA5rGb6EMWXjlzsRfU++VEM0/9/0i3YpZcPdGqkZHggI4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15521},"type":"module","_from":"file:288-toolkit-device-4.0.1.tgz","exports":{"./media":{"types":"./dist/media/index.d.ts","default":"./dist/media/index.js"},"./window":{"types":"./dist/window/index.d.ts","default":"./dist/window/index.js"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","build":"svelte-package","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/tmp/8fbddce83f47805e2bad82ef44184161/288-toolkit-device-4.0.1.tgz","_integrity":"sha512-EMfRsfSyYL+YmIA3ioW0JjxZUhLkWP3x2IM5brT9baygsRkUdLNaZF1y1D0ilJy3td/z1raEvxYZRIJpzhLZPQ==","_npmVersion":"10.5.2","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.13.1","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"3.1.0"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_4.0.1_1715871150389_0.9980406300479427","host":"s3://npm-registry-packages"}},"5.0.0":{"name":"@288-toolkit/device","version":"5.0.0","author":{"name":"DeuxHuitHuit"},"license":"MIT","_id":"@288-toolkit/device@5.0.0","maintainers":[{"name":"nitriques","email":"open-source@deuxhuithuit.com"},{"name":"f-elix","email":"guerinfelix08@gmail.com"}],"dist":{"shasum":"647608fc690f331c64f273a3103ad354a4699868","tarball":"https://registry.npmjs.org/@288-toolkit/device/-/device-5.0.0.tgz","fileCount":34,"integrity":"sha512-XauiuSvAMGlm3gT6DZ8gHpdcbRSnH8BYtlc7t6lTyTQvy9V3kh3ltkaMRwTil1ZzU3D9lKeMPW59FrPsjauVVQ==","signatures":[{"sig":"MEQCIEsmqMTq8qVMpQ+ZuYW1v9+w8F9p+7yujboM9WI8hn+OAiBcbagx+YuW7Skw33T3TnazZYgidnLKNjjkJkrnigCgsg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15528},"type":"module","_from":"file:288-toolkit-device-5.0.0.tgz","exports":{"./media":{"types":"./dist/media/index.d.ts","default":"./dist/media/index.js"},"./window":{"types":"./dist/window/index.d.ts","default":"./dist/window/index.js"}},"scripts":{"lc":"npm run lint && npm run check","lint":"eslint --max-warnings=0 --cache .","test":"vitest run","build":"svelte-package","check":"svelte-check --tsconfig ./tsconfig.json --fail-on-warnings","format":"npm run format:file .","lc:watch":"npm run lint && npm run check -- --watch","lint:fix":"npm run lint -- --fix","test:watch":"vitest","check:watch":"npm run check -- --watch","format:file":"npm run format:prettier -- --write","format:prettier":"prettier --config ./.prettierrc"},"_npmUser":{"name":"f-elix","email":"guerinfelix08@gmail.com"},"_resolved":"/private/var/folders/k6/gmpb3s_x4kb4v14gmbp18y_40000gs/T/315b01e8d47b636125db48cf274d70b1/288-toolkit-device-5.0.0.tgz","_integrity":"sha512-XauiuSvAMGlm3gT6DZ8gHpdcbRSnH8BYtlc7t6lTyTQvy9V3kh3ltkaMRwTil1ZzU3D9lKeMPW59FrPsjauVVQ==","_npmVersion":"10.5.0","description":"A collection of functions, stores and actions to work with the user's device.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"esm-env":"1.0.0","@288-toolkit/types":"3.1.0"},"_hasShrinkwrap":false,"peerDependencies":{"svelte":"4.x || 5.x","@sveltejs/kit":"2.x"},"_npmOperationalInternal":{"tmp":"tmp/device_5.0.0_1730469954434_0.34084697672954345","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-04-24T14:18:17.296Z","modified":"2025-09-23T15:34:36.668Z","1.0.0":"2024-04-24T14:18:17.620Z","1.0.1":"2024-04-25T20:15:11.071Z","1.1.0":"2024-04-29T19:04:58.749Z","1.2.0":"2024-04-29T19:14:04.906Z","3.0.0":"2024-04-30T20:39:47.510Z","4.0.0":"2024-05-01T00:07:55.417Z","4.0.1":"2024-05-16T14:52:30.608Z","5.0.0":"2024-11-01T14:05:54.679Z"},"author":{"name":"DeuxHuitHuit"},"license":"MIT","description":"A collection of functions, stores and actions to work with the user's device.","maintainers":[{"email":"open-source@deuxhuithuit.com","name":"nitriques"}],"readme":"# Device\n\nA collection of functions, stores and actions to work with the user's device.\n\n## Media\n\n### `createMatchMediaStore`\n\nA readable store which is true when the media query matches and false when it doesn't.\n\n```ts\nconst reducedData = createMatchMediaStore('(prefers-reduced-data)');\n\n$: if ($reducedData) {\n\t// ...\n} else {\n\t// ...\n}\n```\n\n### `isTouch`\n\nA readable store that returns whether the user is using a touch device.\n\n### `reducedMotion`\n\nA readable store that returns whether the user has requested reduced motion.\n\n### `runOnMatchMedia`\n\nA function that allows you to run a callback only when the media matches the specified condition\n('matches' or 'doesNotMatch'). The callback can return a cleanup function that will be called when\nthe media changes.\n\nThe media is determined by the `MediaStore` store (see `createMatchMediaStore`).\n\n```ts\nimport { runOnMatchMedia, createMediaMediaStore } from '@288-toolkit/device/media';\n\n// Run a callback only when the viewport size is below 800px\nconst destroy = runOnMatchMedia(createMediaMediaStore('(max-width: 800px)'), 'matches', () => {\n\t// do something\n});\n\n// Later, when you want to unsubscribe from the store and call the cleanup function if it exists\ndestroy();\n```\n\n### `runActionOnMatchMedia`\n\nUses `runOnMatchMedia` to run a Svelte action only when the media matches the specified condition.\n\nThe action can be typed via generic params.\n\n```ts\nimport { runActionOnMatchMedia, createMediaMediaStore } from '@288-toolkit/device/media';\nimport { scroll } from 'motion';\n\n// Run a Svelte action only when the viewport size is below 1200px\nconst myAction = runActionOnMatchMedia<\n\tHTMLButtonElement,\n\t{\n\t\ttest: string;\n\t},\n\t{ 'on:visible': (e: CustomEvent) => void }\n>(createMediaMediaStore('(min-width: 1200px)'), 'doesNotMatch', (node, params) => {\n\tconst unsubscribe = scroll(() => {\n\t\t// do something\n\t});\n\treturn {\n\t\tdestroy: () => {\n\t\t\tunsubscribe();\n\t\t},\n\t\tupdate: (params) => {\n\t\t\t// Code here will only be run when the params change and the viewport size is below 1200px\n\t\t}\n\t};\n});\n```\n\n## Window\n\n### `createWindowEventStore`\n\nCreate a readable store that listens to a window event. Using a store has the advantage of having\nmultiple event handlers for the same event listener, which is good for memory management.\n\nYou can create a store for any window event. This package already exports the following:\n\n-   `click`\n-   `clickUseCapture`\n-   `focus`\n-   `focusin`\n-   `keydown`\n-   `pointerdown`\n-   `resize`\n-   `scroll`\n\n### `currentScroll`\n\nA readable store that returns the current scroll positions of the user (x and y).\n","readmeFilename":"README.md"}