{"id":19226383,"url":"https://github.com/untool/eprom","last_synced_at":"2025-04-10T23:03:57.668Z","repository":{"id":33162842,"uuid":"153693368","full_name":"untool/eprom","owner":"untool","description":"A deliberately incorrect resettable promise-like JavaScript async primitive powering untool's server-side rendering and module reloading. Mostly conforms with the Promises/A+ spec.","archived":false,"fork":false,"pushed_at":"2024-12-02T17:13:24.000Z","size":868,"stargazers_count":0,"open_issues_count":16,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T05:32:58.875Z","etag":null,"topics":["deferred","library","promise","promise-a-plus","thenable"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eprom","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/untool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-10-18T22:07:21.000Z","updated_at":"2020-12-14T10:21:55.000Z","dependencies_parsed_at":"2023-01-14T23:44:34.385Z","dependency_job_id":"de8e35f6-9941-478d-b96b-91a09bf12078","html_url":"https://github.com/untool/eprom","commit_stats":{"total_commits":121,"total_committers":5,"mean_commits":24.2,"dds":"0.14049586776859502","last_synced_commit":"261e91b282e41e4dd383121cfa2138c09d90d9b4"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untool%2Feprom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untool%2Feprom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untool%2Feprom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/untool%2Feprom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/untool","download_url":"https://codeload.github.com/untool/eprom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247953107,"owners_count":21023947,"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":["deferred","library","promise","promise-a-plus","thenable"],"created_at":"2024-11-09T15:18:30.735Z","updated_at":"2025-04-10T23:03:57.648Z","avatar_url":"https://github.com/untool.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eprom\n\n[![travis](https://img.shields.io/travis/untool/eprom/master.svg)](https://travis-ci.org/untool/eprom)\u0026nbsp;[![npm](https://img.shields.io/npm/v/eprom.svg)](https://www.npmjs.com/package/eprom) \u003cbr/\u003e\n\n`eprom` is an **e**nhanced **prom**ise implementation. It works by wrapping a globally available [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) class and is as compliant with the [Promises/A+](https://promisesaplus.com) spec as the global `Promise` is.\n\nIn addition to the usual `then`, `call` and `finally` instance methods, it provides `resolve` and `reject` methods. In this regard, it resembles jQuery's [`Deferred`](https://api.jquery.com/category/deferred-object/) object. On top of that, it features a `reset` method that enables repeat fulfillment.\n\n### Installation\n\nUsing [NPM](https://www.npmjs.com/get-npm):\n\n```text\nnpm install -S eprom\n```\n\nUsing [Yarn](https://yarnpkg.com/en/):\n\n```text\nyarn add eprom\n```\n\n### API\n\n`eprom`'s `EnhancedPromise` mimics more usual [`Promises`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) in every way. As such, it provides all class ([`resolve`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve), [`reject`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/reject), [`all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all), [`race`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race)) and instance ([`then`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then), [`catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch), [`finally`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally)) methods these provide.\n\n#### `enhancedPromise.resolve(value)`\n\nThis method resolves an `EnhancedPromise`'s inner `Promise`, triggering the execution of all `onFulfilled` handlers.\n\n```javascript\nconst enhancedPromise = new EnhancedPromise();\nenhancedPromise.then(value =\u003e console.log(value));\nenhancedPromise.resolve('foo');\n// logs 'foo'\n```\n\n#### `enhancedPromise.reject(reason)`\n\nThis method rejects an `EnhancedPromise`'s inner `Promise`, triggering the execution of all `onRejected` handlers.\n\n```javascript\nconst enhancedPromise = new EnhancedPromise();\nenhancedPromise.catch(reason =\u003e console.err(reason));\nenhancedPromise.reject('bar');\n// logs 'bar'\n```\n\n#### `enhancedPromise.reset()`\n\nThis method creates a fresh inner `Promise` and thus allows for the re-fulfillment of an `EnhancedPromise`. A typical use case for this is handling repeat builds triggered by [Webpack](https://webpack.js.org) in [watch mode](https://webpack.js.org/configuration/watch/).\n\n```javascript\nconst enhancedPromise = new EnhancedPromise();\n\nenhancedPromise.then(value =\u003e console.log(value));\nenhancedPromise.resolve('foo');\n// logs 'foo'\n\nenhancedPromise.reset();\n\nenhancedPromise.then(value =\u003e console.log(value));\nenhancedPromise.resolve('bar');\n// logs 'bar'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funtool%2Feprom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funtool%2Feprom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funtool%2Feprom/lists"}