{"id":22710584,"url":"https://github.com/smallhelm/virtual-dom-closure-widget","last_synced_at":"2025-03-29T21:42:42.624Z","repository":{"id":57392758,"uuid":"46999508","full_name":"smallhelm/virtual-dom-closure-widget","owner":"smallhelm","description":"virtual-dom widget constructor that persists it's local state between renders","archived":false,"fork":false,"pushed_at":"2015-11-27T22:50:40.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T22:28:15.669Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smallhelm.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":"2015-11-27T21:12:35.000Z","updated_at":"2016-07-05T19:47:33.000Z","dependencies_parsed_at":"2022-08-27T02:18:12.437Z","dependency_job_id":null,"html_url":"https://github.com/smallhelm/virtual-dom-closure-widget","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/smallhelm%2Fvirtual-dom-closure-widget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fvirtual-dom-closure-widget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fvirtual-dom-closure-widget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fvirtual-dom-closure-widget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallhelm","download_url":"https://codeload.github.com/smallhelm/virtual-dom-closure-widget/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249226,"owners_count":20747167,"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-12-10T12:10:40.932Z","updated_at":"2025-03-29T21:42:42.604Z","avatar_url":"https://github.com/smallhelm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# virtual-dom-closure-widget\nMake virtual-dom widgets by using a function closure that persists it's local state between renders.\n\n## Example\nCheck out `example.js`\n\nTo run it clone this repository then run\n```sh\n$ npm i \u0026\u0026 npm start\n```\nIt will give you localhost url to open in your browser and see it running.\n\n## API\n```js\nvar mkWidget = require(\"virtual-dom-closure-widget\");\n\nvar MyWidgetThing = mkWidget(function(props){\n\n  //This code executes the first time a widget is mounted (i.e. Widget \"init\" method)\n  //Do whatever you want here...\n  //At some point you should create a DOM element you want mounted to the page\n\n  return {\n    element: element,//this is the elment you want mounted the page\n\n    update: //same API as virtual-dom widget's \"update\" method\n\n    destroy: //same API as virtual-dom widget's \"destroy\" method\n  };\n});\n\n...\n  //somwhere in your render\n  MyWidgetThing(props),\n...\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fvirtual-dom-closure-widget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallhelm%2Fvirtual-dom-closure-widget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fvirtual-dom-closure-widget/lists"}