{"id":18074896,"url":"https://github.com/robinloeffel/sgnls","last_synced_at":"2025-07-08T06:06:51.588Z","repository":{"id":211411864,"uuid":"729032108","full_name":"robinloeffel/sgnls","owner":"robinloeffel","description":"small, simple signals for the browser and node 🙋🏼","archived":false,"fork":false,"pushed_at":"2024-05-01T12:14:16.000Z","size":179,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-04T17:27:50.452Z","etag":null,"topics":["effects","observables","reactivity","refs","runes","signals","state-management","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/robinloeffel.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"license.txt","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":"2023-12-08T08:51:55.000Z","updated_at":"2025-06-19T13:42:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d1915b3-38fb-4bf5-b44f-9fa66ec5ce6e","html_url":"https://github.com/robinloeffel/sgnls","commit_stats":null,"previous_names":["robinloeffel/sgnls"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robinloeffel/sgnls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinloeffel%2Fsgnls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinloeffel%2Fsgnls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinloeffel%2Fsgnls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinloeffel%2Fsgnls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinloeffel","download_url":"https://codeload.github.com/robinloeffel/sgnls/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinloeffel%2Fsgnls/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264207117,"owners_count":23572733,"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":["effects","observables","reactivity","refs","runes","signals","state-management","typescript"],"created_at":"2024-10-31T10:23:43.211Z","updated_at":"2025-07-08T06:06:51.561Z","avatar_url":"https://github.com/robinloeffel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `sgnls`\n\n[![version on npm](https://badgen.net/npm/v/sgnls)](https://www.npmjs.com/package/sgnls)\n[![weekly downloads on npm](https://badgen.net/npm/dw/sgnls)](https://www.npmjs.com/package/sgnls)\n[![types](https://badgen.net/npm/types/sgnls)](https://www.npmjs.com/package/sgnls)\n[![license](https://badgen.net/npm/license/sgnls)](https://github.com/robinloeffel/sgnls/blob/main/license.txt)\n\n\u003e small, simple signals for the browser and node\n\nan easy way to create and use signals in your code base, with a tiny footprint.\n\n## usage\n\n```sh\nnpm i sgnls\n```\n\n```ts\nimport signal from 'sgnls';\n\nconst $favPasta = signal('lasagna');\n\n$favPasta.effect(newValue =\u003e {\n  document.title = `my favorite pasta is ${newValue}`;\n});\n\n$favPasta.set('carbonara');\n```\n\n## api\n\n### `import`\n\n`sgnls` comes with a straightforward api. it exports one default function, which returns a signal object.\n\n```ts\nimport signal from 'sgnls';\n\nconst $signal = signal('initial value');\n```\n\nsaid object then exposes the following five methods.\n\n### `get`\n\nreturns the current value of the signal.\n\n```ts\nconst $signal = signal('initial value');\n\n$signal.get();\n```\n\n### `set`\n\nsets the value of the signal.\n\n```ts\nconst $signal = signal('initial value');\n\n$signal.set('new value');\n```\n\n### `update`\n\nupdates the value of the signal by mutating it through a function.\n\n```ts\nconst $signal = signal(['a', 'b', 'c']);\n\n$signal.update(value =\u003e [...value, 'd']);\n```\n\n### `effect`\n\nsets up an effect to be called whenever the signal changes.\n\n_note: the effect is called once immediately after the setup!_\n\n```ts\nconst $signal = signal('initial value');\n\n$signal.effect(newValue =\u003e {\n  console.log(newValue);\n});\n\n$signal.set('new value');\n```\n\n### `stop`\n\nstops the attached effects from invoking.\n\n```ts\nconst $signal = signal('initial value');\n\n$signal.stop();\n```\n\n## license\n\nmit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinloeffel%2Fsgnls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinloeffel%2Fsgnls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinloeffel%2Fsgnls/lists"}