{"id":25530872,"url":"https://github.com/lab5e/loadabledata","last_synced_at":"2026-05-07T05:33:02.477Z","repository":{"id":57126076,"uuid":"374376775","full_name":"lab5e/loadabledata","owner":"lab5e","description":"Simple framework-agnostic wrapper around loadable data to help encapsulate and use state changes in a UI.","archived":false,"fork":false,"pushed_at":"2021-06-30T11:10:21.000Z","size":3400,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T08:04:09.141Z","etag":null,"topics":["async","data","loadable","state","typescript","ui"],"latest_commit_sha":null,"homepage":"https://lab5e.github.io/loadabledata/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lab5e.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-06T14:09:26.000Z","updated_at":"2021-06-30T11:09:37.000Z","dependencies_parsed_at":"2022-08-31T08:20:58.287Z","dependency_job_id":null,"html_url":"https://github.com/lab5e/loadabledata","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Floadabledata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Floadabledata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Floadabledata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lab5e%2Floadabledata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lab5e","download_url":"https://codeload.github.com/lab5e/loadabledata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239754022,"owners_count":19691233,"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":["async","data","loadable","state","typescript","ui"],"created_at":"2025-02-20T00:22:34.889Z","updated_at":"2026-01-16T00:30:16.671Z","avatar_url":"https://github.com/lab5e.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LoadableData\n\nSimple framework-agnostic wrapper around loadable data to help encapsulate and use state changes in a UI.\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Documentation](https://img.shields.io/badge/docs-tsdoc-blue.svg)](https://lab5e.github.io/loadabledata)\n[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@lab5e/loadabledata.svg)](#tiny)\n[![loadabledata](https://img.shields.io/npm/v/@lab5e/loadabledata.svg)](https://www.npmjs.com/package/@lab5e/loadabledata)\n[![CI](https://github.com/lab5e/loadabledata/actions/workflows/main.yml/badge.svg)](https://github.com/lab5e/loadabledata/actions/workflows/main.yml)\n\n## Examples\n\nWe have a [TSDoc](https://lab5e.github.io/loadabledata/) that will include all documentation as well as the examples below.\n\n### Play around in codepen\n\n[Codepen example](https://codepen.io/pkkummermo/pen/abJGxbx)\n\n### Example: Vue in browser\n\n```html\n\u003cbody\u003e\n  ...\n  \u003cdiv id=\"app\" v-cloak\u003e\n    \u003cspan v-if=\"repositories.state.loading\"\u003eLoading data\u003c/span\u003e\n    \u003cspan v-if=\"repositories.state.ready\"\u003e\n      Lab5e has {{ repositories.data.length }} public repositories!\n    \u003c/span\u003e\n    \u003cspan v-if=\"repositories.state.error\"\u003e{{ repositories.errorMessage }}\u003c/span\u003e\n  \u003c/div\u003e\n\n  \u003cscript src=\"https://cdn.jsdelivr.net/npm/vue@2\"\u003e\u003c/script\u003e\n  \u003cscript src=\"https://cdn.jsdelivr.net/npm/@lab5e/loadabledata\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    var app = new Vue({\n      el: \"#app\",\n      data() {\n        return {\n          repositories: loadabledata.fromUrl(\n            \"https://api.github.com/users/lab5e/repos\",\n            (error) =\u003e `Error trying to fetch data. Error: ${error}`,\n          ),\n        };\n      },\n    });\n  \u003c/script\u003e\n\u003c/body\u003e\n```\n\n### Example: In ts\n\nYou must first install the dependency\n\n```bash\nnpm i -S @lab5e/loadabledata\n```\n\nThen you can have a `Lab5eRepos.vue`-file which details the number of repositories Lab5e has publically available.\n\n```html\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003cspan v-if=\"repositories.state.loading\"\u003eLoading data\u003c/span\u003e\n    \u003cspan v-if=\"repositories.state.ready\"\u003e\n      Lab5e has {{ repositories.data.length }} public repositories!\n    \u003c/span\u003e\n    \u003cspan v-if=\"repositories.state.error\"\u003e{{ repositories.errorMessage }}\u003c/span\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript lang=\"ts\"\u003e\n  import { fromPromise, LoadableData } from \"@lab5e/loadabledata\";\n\n  import Vue from \"vue\";\n  export default Vue.extend({\n    data(): { repositories: LoadableData\u003cRepositories[]\u003e } {\n      return {\n        repositories: fromUrl(\n          \"https://api.github.com/users/lab5e/repos\",\n          (error) =\u003e `Failed to list available todos. ${error}`,\n          [],\n        ),\n      };\n    },\n  });\n\u003c/script\u003e\n```\n\n## Development\n\nWe use [TSDX](https://github.com/formium/tsdx) for pretty much everything, and most npm scripts just proxy to `tsdx`.\n\n### Run single build\n\nUse `npm run build`.\n\n### Run tests\n\nTo run tests, use `npm test`.\n\n## Configuration\n\nCode quality is set up with `prettier`, `husky`, and `lint-staged`.\n\n### Jest\n\nJest tests are set up to run with `npm test`.\n\n#### Watch mode\n\nTo run in watch mode run `npm run test:watch`\n\n#### Coverage\n\nTo see coverage run `npm run test:coverage`\n\n### Bundle Analysis\n\n[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.\n\n### Rollup\n\nWe us TSDX which uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.\n\nWe create UMD, CommonJS, and JavaScript Modules in our build. The appropriate paths are configured in `package.json` and `dist/index.js`\n\n### TypeScript\n\nWe use TypeScript for everything, giving us types for all the published packages.\n\n## Continuous Integration\n\n### GitHub Actions\n\n- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix\n- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)\n\n## Publishing to NPM\n\nWe use `np`. To publish a new version, write `npx np` and follow the interactive tutorial.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab5e%2Floadabledata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flab5e%2Floadabledata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flab5e%2Floadabledata/lists"}