{"id":20182168,"url":"https://github.com/nichoth/h-app","last_synced_at":"2025-08-25T01:32:12.625Z","repository":{"id":77400033,"uuid":"81394190","full_name":"nichoth/h-app","owner":"nichoth","description":"Elm-like app for javascript.","archived":false,"fork":false,"pushed_at":"2017-02-09T03:00:51.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T06:38:02.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/nichoth/model-message#readme","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-09T01:20:25.000Z","updated_at":"2018-03-12T16:23:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"535483ca-8bc0-4d40-9156-b16fb0ee2ddb","html_url":"https://github.com/nichoth/h-app","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nichoth/h-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fh-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fh-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fh-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fh-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nichoth","download_url":"https://codeload.github.com/nichoth/h-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nichoth%2Fh-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271991105,"owners_count":24854706,"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-08-24T02:00:11.135Z","response_time":111,"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:37:50.624Z","updated_at":"2025-08-25T01:32:12.607Z","avatar_url":"https://github.com/nichoth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# h-app\n\nElm-like app for javascript.\n\nInspired by hyper-app, the difference being that the state machine is decoupled from the view. The default here is using `virtual-dom`, but it is easy to use with another renderer.\n\n\n## example\n\napp.js\n\n```js\nvar Counter = require('./counter')\nvar app = require('../')\n\napp(Counter)\n```\n\ncounter.js\n\n```js\nvar h = require('../h')\n\nvar Counter = function () {\n    return { count: 0, input: '' }\n}\nCounter.update = {\n    plusOne: state =\u003e ({ count: state.count + 1 }),\n    minusOne: state =\u003e ({ count: state.count - 1 }),\n    add: (state, ev) =\u003e ({\n        count: state.count + parseInt(state.input, 10),\n        input: ''\n    }),\n    input: (state, ev) =\u003e ({ input: ev })\n}\nCounter.effects = {\n    asyncAdd: (state, msg, ev) =\u003e {\n        process.nextTick(() =\u003e msg.add(ev))\n    }\n}\n\nCounter.view = function (state, msg) {\n    return h('div', {}, [\n        'the count is ' + state.count,\n        h('hr'),\n        h('button', { onclick: msg.plusOne }, 'add one'),\n        h('hr'),\n        h('button', { onclick: msg.minusOne }, 'subtract one'),\n        h('hr'),\n        h('input', {\n            type: 'number',\n            value: state.input,\n            onchange: ev =\u003e msg.input(ev.target.value),\n            placeholder: 'add n'\n        }),\n        h('button', { onclick: msg.add }, 'submit')\n    ])\n}\n\nmodule.exports = Counter\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fh-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnichoth%2Fh-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnichoth%2Fh-app/lists"}