{"id":15497226,"url":"https://github.com/jwerle/regl-shared-context","last_synced_at":"2025-10-27T09:35:10.419Z","repository":{"id":148540549,"uuid":"106607635","full_name":"jwerle/regl-shared-context","owner":"jwerle","description":"Share regl context variables in the same context","archived":false,"fork":false,"pushed_at":"2017-10-11T22:15:08.000Z","size":4,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-30T18:02:39.869Z","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/jwerle.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-11T20:47:01.000Z","updated_at":"2020-07-02T16:54:19.000Z","dependencies_parsed_at":"2023-05-20T11:15:19.818Z","dependency_job_id":null,"html_url":"https://github.com/jwerle/regl-shared-context","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"76358757a89bb8bdc4401c698ab675ffb5a5dff7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fregl-shared-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fregl-shared-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fregl-shared-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Fregl-shared-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwerle","download_url":"https://codeload.github.com/jwerle/regl-shared-context/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251747773,"owners_count":21637404,"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-10-02T08:32:08.893Z","updated_at":"2025-10-27T09:35:05.398Z","avatar_url":"https://github.com/jwerle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"regl-shared-context\n===================\n\nShare regl context variables in the same context\n\n## Install\n\n```sh\n$ npm install regl-shared-context\n```\n\n## Usage\n\n```js\nconst shared = require('regl-shared-context')\nconst regl = require('regl')()\nregl({\n  context: shared.context({\n    first() { return 'first' },\n    second() { return 'second' },\n    third() { return 'third' },\n    output({first, second, third}) {\n      return `${first} ${second} ${third}`\n    },\n  })\n})({output}) =\u003e {\n  console.log(output) // 'first second third'\n})\n```\n\n## Why ?\n\nWhen context variables are computed, the parent scope context is exposed\nto dynamic properties. This module allows local context properties to be\nexposed and shared between each other without the need to create\nmultiple regl commands.\n\n## API\n\n### shared.context(object: Object) -\u003e Object\n\nThis function accepts an object that should be used for the `context`\nproperty of the regl command constructor. It wraps a regl context object\nwith accessors providing a shared regl context object. Properties are\nevaluated in the order in which they were defined.\n\n```js\nconst command = regl({\n  context: shared.context({\n    valueA: 123,\n    valueB: ({valueA}) =\u003e valueB // 123\n  })\n})\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Fregl-shared-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwerle%2Fregl-shared-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Fregl-shared-context/lists"}