{"id":20181737,"url":"https://github.com/nichoth/yo-pull-stream","last_synced_at":"2025-07-31T09:08:58.367Z","repository":{"id":57404031,"uuid":"88389813","full_name":"nichoth/yo-pull-stream","owner":"nichoth","description":"Turn your view into a duplex stream","archived":false,"fork":false,"pushed_at":"2017-06-02T17:16:39.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-21T01:24:18.599Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/nichoth.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-04-16T03:58:01.000Z","updated_at":"2018-09-25T02:31:02.000Z","dependencies_parsed_at":"2022-09-26T17:01:21.408Z","dependency_job_id":null,"html_url":"https://github.com/nichoth/yo-pull-stream","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/nichoth/yo-pull-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fyo-pull-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fyo-pull-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fyo-pull-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fyo-pull-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nichoth","download_url":"https://codeload.github.com/nichoth/yo-pull-stream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fyo-pull-stream/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268016818,"owners_count":24181655,"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-07-31T02:00:08.723Z","response_time":66,"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":[],"created_at":"2024-11-14T02:36:36.766Z","updated_at":"2025-07-31T09:08:58.242Z","avatar_url":"https://github.com/nichoth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yo pull stream\n\nTurn your view into a duplex stream. This uses [yo-yo](https://github.com/maxogden/yo-yo/) to render your view, and gives you a duplex stream interface for emitting events and subscribing to changes.\n\n\n## install\n\n    $ npm install yo-pull-stream\n\n\n## example\n\n```js\nvar S = require('pull-stream')\nvar scan = require('pull-scan')\nvar ViewStream = require('../')\nvar html = require('yo-yo')\n\nvar root = document.createElement('div')\ndocument.body.appendChild(root)\n\n// viewStream is a duplex stream\nvar viewStream = ViewStream(root, myView, function onEnd (err) {\n    if (err) return console.log('error', err)\n    console.log(\"it's over\")\n})\n\nS(\n    viewStream,\n    scan(function (state, ev) {\n        if (ev === 'plus') return { count: state.count + 1 }\n        return state\n    }),\n    viewStream\n)\n\n// push an initial event so our view renders\nviewStream.source.push({ count: 0 })\n\nfunction myView (state, push) {\n    // call push to publish an event\n    return html`\u003cdiv\u003e\n        \u003cdiv\u003e${state.count}\u003c/div\u003e\n        \u003cbutton onclick=${push.bind(null, 'plus')}\u003eplus 1\u003c/button\u003e\n    \u003c/div\u003e`\n}\n```\n\nYou can pass in a render function. This should work with any function like `morphdom`:\n\n```js\nvar ViewStream = require('yo-pull-stream/render-loop')(myRenderFunction)\nvar viewStream = ViewStream(root, myView, function onEnd (err) {\n})\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fyo-pull-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnichoth%2Fyo-pull-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fyo-pull-stream/lists"}