{"id":15809196,"url":"https://github.com/zordius/with-promise","last_synced_at":"2025-03-31T23:44:35.310Z","repository":{"id":25058140,"uuid":"28478210","full_name":"zordius/with-promise","owner":"zordius","description":"An extended promise to keep the context persistently","archived":false,"fork":false,"pushed_at":"2017-03-29T07:40:33.000Z","size":415,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-06T03:20:19.029Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/with-promise","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zordius.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.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}},"created_at":"2014-12-25T10:01:58.000Z","updated_at":"2017-03-24T09:26:04.000Z","dependencies_parsed_at":"2022-08-23T12:01:50.275Z","dependency_job_id":null,"html_url":"https://github.com/zordius/with-promise","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zordius%2Fwith-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zordius%2Fwith-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zordius%2Fwith-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zordius%2Fwith-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zordius","download_url":"https://codeload.github.com/zordius/with-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246558113,"owners_count":20796696,"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-05T03:20:30.104Z","updated_at":"2025-03-31T23:44:35.285Z","avatar_url":"https://github.com/zordius.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"with-promise\n===================\n\nAn extended promise to keep the context persistently\n\n[![npm version](https://img.shields.io/npm/v/with-promise.svg)](https://www.npmjs.org/package/with-promise) [![Dependency Status](https://david-dm.org/zordius/with-promise.svg)](https://david-dm.org/zordius/with-promise) [![Build Status](https://travis-ci.org/zordius/with-promise.svg?branch=master)](https://travis-ci.org/zordius/with-promise) [![Test Coverage](https://codeclimate.com/github/zordius/with-promise/badges/coverage.svg)](https://codeclimate.com/github/zordius/with-promise) [![Code Climate](https://codeclimate.com/github/zordius/with-promise/badges/gpa.svg)](https://codeclimate.com/github/zordius/with-promise) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE.txt)\n\n[![Sauce Test Status](badge.png)](https://saucelabs.com/u/zordius_oss)\n\nInstallation\n------------\n\n```sh\nnpm install with-promise\n```\n\nIn browser:\n```html\n\u003cscript src=\"dist/with-promise.js\"\u003e\u003c/script\u003e\n```\n\nIn an AMD loader:\n```javascript\nrequire('with-promise', function (WithPromise) {/*....*/});\n```\n\nIn nodejs:\n```javascript\nvar WithPromise =  require('with-promise');\n```\n\nFeatures\n--------\n\n* Extended Promise, make all `.then()` , `.catch()` handlers be executed with your assigned context: `this` .\n\nNotice\n------\n\n**You should use polyfills** providing Promise to ensure with-promise works well. You can try \u003ca href=\"http://polyfill.io\"\u003epolyfill.io\u003c/a\u003e or \u003ca href=\"http://polyfills.io/\"\u003epolyfills.io\u003c/a\u003e. For nodejs, you can try \u003ca href=\"https://github.com/jakearchibald/es6-promise\"\u003ees6-promise\u003c/a\u003e or \u003ca href=\"https://github.com/yahoo/ypromise\"\u003eypromise\u003c/a\u003e.\n\nUsage\n-----\n\n```javascript\nvar WithPromise = require('with-promise');\n\n// create a Promise by a resolver function and set context\nvar myPromise = WithPromise.create(resolver, context);\n\n// create a resolved Promise\nvar myPromise = WithPromise.resolve(value, context);\n\n// create a rejected Promise\nvar myPromise = WithPromise.reject(value, context);\n\n// wrap Promise.all with context\nvar allPromises = WithPromise.all(promises, context);\n\n\n// all this == context\nmyPromise.then(function () {\n    // this == context\n}).then(function () {\n    // this == context\n}).catch(function () {\n    // this == context\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzordius%2Fwith-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzordius%2Fwith-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzordius%2Fwith-promise/lists"}