{"id":26875041,"url":"https://github.com/adoratorio/medusa","last_synced_at":"2025-08-23T06:31:30.093Z","repository":{"id":57095157,"uuid":"176748474","full_name":"Adoratorio/medusa","owner":"Adoratorio","description":"A simple utility to easy handle multiple IntersectionObserver","archived":false,"fork":false,"pushed_at":"2025-05-28T14:22:49.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T02:34:01.570Z","etag":null,"topics":["intersectionobserver","intersectionobserver-manager","lazyload-utils"],"latest_commit_sha":null,"homepage":"","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/Adoratorio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-20T14:11:55.000Z","updated_at":"2025-08-13T17:55:34.000Z","dependencies_parsed_at":"2022-08-22T23:10:14.689Z","dependency_job_id":null,"html_url":"https://github.com/Adoratorio/medusa","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Adoratorio/medusa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adoratorio%2Fmedusa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adoratorio%2Fmedusa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adoratorio%2Fmedusa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adoratorio%2Fmedusa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adoratorio","download_url":"https://codeload.github.com/Adoratorio/medusa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adoratorio%2Fmedusa/sbom","scorecard":{"id":8883,"data":{"date":"2025-08-11","repo":{"name":"github.com/Adoratorio/medusa","commit":"e37a00181e811f81b0f78ab2e2a339f7f870739c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":5,"reason":"7 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENCE:0","Info: FSF or OSI recognized license: MIT License: LICENCE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}}]},"last_synced_at":"2025-08-14T14:08:27.723Z","repository_id":57095157,"created_at":"2025-08-14T14:08:27.724Z","updated_at":"2025-08-14T14:08:27.724Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745670,"owners_count":24813521,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["intersectionobserver","intersectionobserver-manager","lazyload-utils"],"created_at":"2025-03-31T10:22:11.082Z","updated_at":"2025-08-23T06:31:30.044Z","avatar_url":"https://github.com/Adoratorio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Medusa\nA lightweight utility for managing multiple IntersectionObserver instances with TypeScript support.\n\n## Installation\n```sh\nnpm install @adoratorio/medusa\n```\n\n## Usage\n```typescript\nimport Medusa from '@adoratorio/medusa';\n\nconst medusa = new Medusa({ debug: true });\n```\n\n## Configuration\n\n### MedusaOptions\n| Parameter | Type | Default | Description |\n| :-------: | :--: | :-----: | :---------- |\n| observers | `MedusaObserverConfig[]` | `[]` | Array of observer configurations |\n| debug | `boolean` | `false` | Enable console debugging |\n\n### Observer Configuration\n```typescript\ninterface MedusaObserverConfig {\n  id: string;\n  root?: Element | null;\n  rootMargin?: string;\n  threshold?: number | number[];\n  nodes?: Element | Element[];\n  mode?: MODE;\n  emit?: boolean;\n  callback?: MedusaCallback;\n}\n\ntype MedusaCallback = (\n  entry: IntersectionObserverEntry,\n  observer: IntersectionObserver | null,\n) =\u003e void;\n```\n\n#### Configuration Options\n| Parameter | Type | Default | Description |\n| :-------: | :--: | :-----: | :---------- |\n| id | `string` | required | Unique observer identifier |\n| root | `Element` | `null` | Viewport element for intersection checking |\n| rootMargin | `string` | `'0px'` | Margin around root (CSS format) |\n| threshold | `number\\|number[]` | `0` | Intersection threshold(s) |\n| mode | `MODE` | `DEFAULT` | Observer behavior mode |\n| emit | `boolean` | `false` | Emit custom events on intersection |\n| callback | `MedusaCallback` | `undefined` | Intersection callback function |\n\n### Available Modes\n```typescript\nenum MODE {\n  DEFAULT = 'DEFAULT',    // Trigger on every intersection\n  ONCE = 'ONCE',          // Trigger only once\n  BYPIXELS = 'BYPIXELS',  // Trigger per pixel in viewport\n}\n```\n\n## Methods\n\n### Adding Observers\n```typescript\n// Add single observer\nmedusa.addObserver({\n  id: 'myObserver',\n  threshold: 0.5,\n  callback: (entry, observer) =\u003e console.log('Intersecting:', entry.isIntersecting),\n});\n\n// Add multiple observers\nmedusa.addObserver([\n  { id: 'observer1', mode: Medusa.MODE.ONCE },\n  { id: 'observer2', mode: Medusa.MODE.BYPIXELS },\n]);\n```\n\n### Observing Elements\n```typescript\n// Observe single element\nconst element = document.querySelector('.target');\nmedusa.observe('myObserver', element);\n\n// Observe with custom callback\nmedusa.observe('myObserver', element, (entry, observer) =\u003e {\n  console.log('Custom callback for this element');\n});\n\n// Observe multiple elements\nconst elements = document.querySelectorAll('.targets');\nmedusa.observe('myObserver', Array.from(elements));\n```\n\n### Management Methods\n```typescript\n// Get observer instance\nconst observer = medusa.getObserver('myObserver');\n\n// Clear specific observer\nmedusa.clearObserver('myObserver');\n\n// Clear all observers\nmedusa.clearAllObservers();\n\n// Remove specific observer\nmedusa.removeObserver('myObserver');\n\n// Remove all observers\nmedusa.removeAllObservers();\n\n// Unobserve elements\nmedusa.unobserve('myObserver', element);\n\n// Destroy instance\nmedusa.destroy();\n```\n\n## Events\nWhen `emit: true` is set, Medusa emits custom events on intersecting elements:\n\n```typescript\n// Event name format: medusa-${observerId}\nelement.addEventListener('medusa-myObserver', (event: CustomEvent) =\u003e {\n  const entry: IntersectionObserverEntry = event.detail;\n  console.log('Intersection ratio:', entry.intersectionRatio);\n});\n```\n\n### Event Details\nThe event.detail contains the IntersectionObserverEntry:\n\n```typescript\n{\n  time: number;\n  rootBounds: DOMRectReadOnly;\n  boundingClientRect: DOMRectReadOnly;\n  intersectionRect: DOMRectReadOnly;\n  isIntersecting: boolean;\n  intersectionRatio: number;\n  target: Element;\n}\n```\n\n## TypeScript Support\nMedusa is written in TypeScript and includes full type definitions:\n\n```typescript\nimport type {\n  MedusaOptions,\n  MedusaObserverConfig,\n  MedusaCallback,\n} from '@adoratorio/medusa';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadoratorio%2Fmedusa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadoratorio%2Fmedusa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadoratorio%2Fmedusa/lists"}