{"id":26709397,"url":"https://github.com/js-bits/xpromise","last_synced_at":"2025-04-13T17:32:48.519Z","repository":{"id":57122335,"uuid":"361310214","full_name":"js-bits/xpromise","owner":"js-bits","description":"Extendable Promise","archived":false,"fork":false,"pushed_at":"2023-07-19T02:16:44.000Z","size":1233,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T20:05:40.949Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/js-bits.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":"2021-04-25T02:14:31.000Z","updated_at":"2023-07-03T17:58:38.000Z","dependencies_parsed_at":"2024-10-29T19:30:08.395Z","dependency_job_id":null,"html_url":"https://github.com/js-bits/xpromise","commit_stats":{"total_commits":92,"total_committers":1,"mean_commits":92.0,"dds":0.0,"last_synced_commit":"2f5e07a0b53fae78ffaff299dd258d2be009e3f5"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-bits%2Fxpromise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-bits%2Fxpromise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-bits%2Fxpromise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/js-bits%2Fxpromise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/js-bits","download_url":"https://codeload.github.com/js-bits/xpromise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248752385,"owners_count":21156081,"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":"2025-03-27T08:16:45.609Z","updated_at":"2025-04-13T17:32:48.499Z","avatar_url":"https://github.com/js-bits.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extendable Promise\n\nAllows extension of JavaScript's standard, built-in `Promise` class and decouples an asynchronous operation that ties an outcome to a promise from the constructor.\n\n## Installation\n\nInstall with npm:\n\n```\nnpm install @js-bits/xpromise\n```\n\nInstall with yarn:\n\n```\nyarn add @js-bits/xpromise\n```\n\nImport where you need it:\n\n```javascript\nimport ExtendablePromise from '@js-bits/xpromise';\n```\n\nor require for CommonJS:\n\n```javascript\nconst ExtendablePromise = require('@js-bits/xpromise');\n```\n\n## How to use\n\n```javascript\nclass MyPromise extends ExtendablePromise {\n  // do whatever you need\n}\n\nconst myPromise = new MyPromise((resolve, reject) =\u003e {\n  console.log('executed', resolve, reject);\n});\nconsole.log(myPromise instanceof Promise); // true\nmyPromise.execute(); // 'executed' [Function (anonymous)] [Function (anonymous)]\nmyPromise.then(result =\u003e {\n  console.log(result); // 123\n});\nmyPromise.resolve(123);\n```\n\n## Notes\n\n- [Alternative solution](https://stackoverflow.com/questions/48158730/extend-javascript-promise-and-resolve-or-reject-it-inside-constructor)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs-bits%2Fxpromise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjs-bits%2Fxpromise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjs-bits%2Fxpromise/lists"}