
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
backbone-promised
Advanced tools
Wraps up Backbone's sync/XHR functions (Backbone.Model
's save
, fetch
, destroy
and Backbone.Collection
's fetch
) as promises. If using the native response from these methods, on success, they return a jQuery XHR promisable, on failure a falsy value. This eliminates the need to check to see if it's thennable. Another advantage is these promises return on options.success
or options.error
, rather than just the XHR response, so when the modified promises resolve, you can be sure that the collection or model is also updated by that time.
npm install backbone-promised
BackbonePromised(prototype, resolver)
BackbonePromised
takes two arguments; first a prototype (or object) with the methods that
should be extended (save
, fetch
, destroy
). Generally this will be Backbone.Model.prototype
, but can be any object. The second argument is a Promise resolver so you can use any promise library, as long as you pass in a function that is called with a resolver function, like when.promise.
var Backbone = require("backbone");
var BackbonePromised = require("backbone-promised");
var when = require("when");
var Model = Backbone.Model.extend(BackbonePromised(Backbone.model.prototype, when.promise));
var user = new Model({ name: "Dash Rendar" });
user.save().then(({ model, options, response }) => {
console.log("success!", response);
}, ({ model, options, response }) => {
console.error("rejected!", response);
});
MIT License
FAQs
Wraps up Backbone's XHR methods into a consistent promisable API
We found that backbone-promised demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.