{"id":18924630,"url":"https://github.com/dash-os/saga-event-observer","last_synced_at":"2026-03-14T04:30:18.424Z","repository":{"id":57356000,"uuid":"92819237","full_name":"Dash-OS/saga-event-observer","owner":"Dash-OS","description":"Use saga-observables to provide a simple way to create window event listeners for your sagas","archived":false,"fork":false,"pushed_at":"2017-05-30T10:11:36.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-31T23:16:21.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/Dash-OS.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":"2017-05-30T09:54:32.000Z","updated_at":"2017-12-10T07:54:42.000Z","dependencies_parsed_at":"2022-09-05T22:13:37.065Z","dependency_job_id":null,"html_url":"https://github.com/Dash-OS/saga-event-observer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dash-OS%2Fsaga-event-observer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dash-OS%2Fsaga-event-observer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dash-OS%2Fsaga-event-observer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dash-OS%2Fsaga-event-observer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dash-OS","download_url":"https://codeload.github.com/Dash-OS/saga-event-observer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239921875,"owners_count":19718842,"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-11-08T11:07:38.976Z","updated_at":"2026-03-14T04:30:18.379Z","avatar_url":"https://github.com/Dash-OS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# saga-event-observer\n\nUses [saga-observable](https://www.npmjs.com/package/saga-observable) to provide a\nsimple way to create window event listeners from sagas.\n\n\n### Installation\n\n```\nyarn add saga-event-observer\n```\n\n**or**\n\n```\nnpm install --save saga-event-observer\n```\n\n### Simple Example\n\n```js\nimport { put, fork } = 'redux-saga/effects'\nimport eventObserver from 'saga-event-observer'\n\nfunction* mySaga(foo, bar, ctx) {\n\n  const task = yield fork(\n    eventObserverSaga,\n    'device-orientation-observer', // uid\n    [ 'orientationchange' , { passive: true } ], // event args\n    {\n      onEvent:  handleEvent,\n      onError:  handleError,\n      // optionally use [ context, fn ] for binding context.\n      onCancel: [ ctx, handleCancellation ] \n    }, // optional lifecycle events, called as saga if possible.\n    /* pass through args are sent to the handlers */\n    foo, bar\n  )\n  \n}\n\nfunction* handleEvent(event, value, uid, ...passThroughArgs) {\n  yield put({\n    type: 'WINDOW_EVENT',\n    event, // 'orientationchange'\n    value, // Event\n    uid, // 'device-orientation-observer'\n    passThroughArgs, // [ foo, bar ]\n  })\n}\n\nfunction* handleError(event, error, uid, ...passThroughArgs) {\n  /* ... handle error ... */\n}\n\nfunction* handleCancellation(event, uid, ...passThroughArgs) {\n  /* ... handle cancellation ... */\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdash-os%2Fsaga-event-observer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdash-os%2Fsaga-event-observer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdash-os%2Fsaga-event-observer/lists"}