{"id":16884485,"url":"https://github.com/yerkopalma/choo-offline","last_synced_at":"2025-03-22T08:30:35.740Z","repository":{"id":57198268,"uuid":"66655264","full_name":"YerkoPalma/choo-offline","owner":"YerkoPalma","description":":wrench: offline first support for choo apps","archived":false,"fork":false,"pushed_at":"2019-05-12T11:00:52.000Z","size":59,"stargazers_count":13,"open_issues_count":25,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T05:32:03.031Z","etag":null,"topics":["choo","offline"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/choo-offline","language":"JavaScript","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/YerkoPalma.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":"2016-08-26T14:44:40.000Z","updated_at":"2023-05-04T11:45:56.000Z","dependencies_parsed_at":"2022-09-16T13:12:31.884Z","dependency_job_id":null,"html_url":"https://github.com/YerkoPalma/choo-offline","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YerkoPalma%2Fchoo-offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YerkoPalma%2Fchoo-offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YerkoPalma%2Fchoo-offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YerkoPalma%2Fchoo-offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YerkoPalma","download_url":"https://codeload.github.com/YerkoPalma/choo-offline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244197084,"owners_count":20414434,"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":["choo","offline"],"created_at":"2024-10-13T16:28:32.719Z","updated_at":"2025-03-22T08:30:35.451Z","avatar_url":"https://github.com/YerkoPalma.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# choo-offline [![Build Status](https://secure.travis-ci.org/YerkoPalma/choo-offline.svg?branch=master)](https://travis-ci.org/YerkoPalma/choo-offline) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n\u003e offline first support for choo apps\n\n## Installation\n\n```bash\nnpm install --save choo-offline\n```\n\n## Usage\n\n```javascript\nconst choo = require('choo')\nconst offline = require('choo-offline')\n\nconst app = choo()\n\noffline(offline =\u003e {\n  app.use(offline)\n\n  const tree = app.start()\n  document.body.appendChild(tree)\n})\n```\n\n## API\n\n### `offline([opts], fn())`\n\nFunction that wraps the choo `start` and `use` methods, only needed for this plugin, other plugins can be registered before.\nIt can take two parameters.\n\n#### `opts`\n\nType: `Object`\n\nOptional configuration object for the plugin, can take the following options:\n\n- `serviceWorker` (String): A string with the relative path to a service worker file, if not provided, it will not install a service worker. Defaults: `''`.\n- `dbConfig` (Object): An object with [localforage config](https://github.com/localForage/localForage#configuration).\n\n#### `fn`\n\nType: `Function`\n\nRequired function that get as the only argument, the offline plugin object. The object use the following hooks:\n\n- `onStateChange`: To update the app state locally with localforage.\n- `onAction`: To check if the app is offline and, if it is, use a backup action. Use the backup function when you have actions that depend on network availability,\n   just define a `_backup` option in your `send()` data, the `_backup` option must be a string calling an effect or reducer from your model. For example\n   \n   ```javascript\n      send('xhrEffect', { foo: bar, _backup: 'nonXhrBackup' })\n   ```\n   \n   The above statement will call `xhrEffect` normally, but when offline, it will call the `nonXhrBackup` effect|reducer, passing the same data, excluding the _backup strings. \n- `wrapInitialState`: To get the initial local state.\n\n## License\n\nMIT\n\nCrafted with \u003c3 by [YerkoPalma](https://github.com/YerkoPalma) .\n\n***\n\n\u003e This package was initially generated with [yeoman](http://yeoman.io) and the [p generator](https://github.com/johnotander/generator-p.git).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyerkopalma%2Fchoo-offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyerkopalma%2Fchoo-offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyerkopalma%2Fchoo-offline/lists"}