{"id":13527117,"url":"https://github.com/component/infinity","last_synced_at":"2026-02-28T05:10:36.419Z","repository":{"id":9942517,"uuid":"11959512","full_name":"component/infinity","owner":"component","description":"infinite scrolling with loading and unloading.","archived":false,"fork":false,"pushed_at":"2016-03-23T19:09:35.000Z","size":26,"stargazers_count":105,"open_issues_count":2,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-10T07:06:04.276Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://component.github.io/infinity/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/component.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2013-08-07T20:11:38.000Z","updated_at":"2024-04-27T14:54:59.000Z","dependencies_parsed_at":"2022-09-13T14:43:01.303Z","dependency_job_id":null,"html_url":"https://github.com/component/infinity","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Finfinity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Finfinity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Finfinity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/component%2Finfinity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/component","download_url":"https://codeload.github.com/component/infinity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246935238,"owners_count":20857366,"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":[],"created_at":"2024-08-01T06:01:41.454Z","updated_at":"2026-02-28T05:10:31.399Z","avatar_url":"https://github.com/component.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"\n# infinity\n\n  Unload and reload panes while scrolling. Inspired by [airbnb/infinity](http://github.com/airbnb/infinity).\n\n## Installation\n\n  Install with [component(1)](http://component.io):\n\n    $ component install component/infinity\n\n## Example\n\n```js\nvar infinity = require('infinity')(window);\nvar panes = document.querySelectorAll('.pane');\n\nfor(var i = 0, len = panes.length; i \u003c len; i++) {\n  infinity.add(panes[i]);\n}\n\ninfinity.refresh();\n```\n\n## Events\n\n* `loading`: called once before each visible `el` is loaded. useful for batch operations.\n* `load`: called when a `el` is to be loaded.\n* `unloading`: called once before each `el` is unloaded. useful for batch operations.\n* `unload`: called when an `el` is to be unloaded.\n\n## API\n\n### infinity(el)\n\n  Initialize `infinity` with `el`. `el` can be either the `window` or an element with overflow.\n\n### infinity.add(el, ...)\n\n  Add `el` to `infinity`. You may pass any number of arguments\n  to be called with the `load` and `unload` functions. The\n  first argument must be the element node.\n\n```js\ninfinity.add(view.el, view)\n```\n\n### infinity.remove(el)\n\n  Remove an element from `infinity`.\n\n```js\ninfinity.remove(el)\n```\n\n### infinity.load(fn)\n\n  Add a load function. Defaults to a `noop`.\n  The arguments passed to add will be passed\n  through `load`.\n\n```js\ninfinity.load(function(el, view) {\n  // ...\n});\n```\n\n### infinity.unload(fn)\n\n  Add an unload function. Defaults to a `noop`.\n  The arguments passed to add will be passed\n  through `unload`.\n\n```js\ninfinity.unload(function(el, view) {\n  // ...\n});\n```\n\n### infinity.refresh()\n\n  Refresh, loading and unloading elements. Call this\n  after adding elements, removing elements, or moving\n  elements programmatically.\n\n```js\ninfinity.refresh();\n```\n\n### infinity.margin(n)\n\n  Add \"preload margin\" to each side of the container.\n  This will allow you to start loading elements before\n  they appear in viewport. `n` defaults to `0`.\n\n  For example, for `infinity.margin(200)`, the `load`\n  function would trigger when the element is within\n  200px from being in view.\n\n### infinity.unbind()\n\n  Unbind all infinity events\n\n## License\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomponent%2Finfinity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomponent%2Finfinity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomponent%2Finfinity/lists"}