Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Give your JS App some Backbone with Models, Views, Collections, and Events.
Backbone.js is a lightweight JavaScript library that provides the structure for web applications by offering models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
Models
Models in Backbone.js represent the data and the logic of the application. They provide methods for data manipulation and validation.
const Backbone = require('backbone');
const Book = Backbone.Model.extend({
defaults: {
title: 'Unknown',
author: 'Unknown'
}
});
const myBook = new Book({ title: '1984', author: 'George Orwell' });
console.log(myBook.get('title')); // Outputs: 1984
Collections
Collections in Backbone.js are ordered sets of models. They provide a rich set of methods for handling and manipulating groups of models.
const Backbone = require('backbone');
const Book = Backbone.Model.extend({});
const Library = Backbone.Collection.extend({
model: Book
});
const myLibrary = new Library([
{ title: '1984', author: 'George Orwell' },
{ title: 'Brave New World', author: 'Aldous Huxley' }
]);
console.log(myLibrary.length); // Outputs: 2
Views
Views in Backbone.js are responsible for rendering the user interface and handling user interactions. They are associated with a DOM element and a model.
const Backbone = require('backbone');
const BookView = Backbone.View.extend({
tagName: 'li',
render: function() {
this.$el.html(this.model.get('title'));
return this;
}
});
const book = new Backbone.Model({ title: '1984' });
const bookView = new BookView({ model: book });
console.log(bookView.render().el.outerHTML); // Outputs: <li>1984</li>
Routers
Routers in Backbone.js provide methods for routing client-side pages and connecting them to actions and events.
const Backbone = require('backbone');
const AppRouter = Backbone.Router.extend({
routes: {
'books/:id': 'showBook'
},
showBook: function(id) {
console.log('Book ID:', id);
}
});
const router = new AppRouter();
Backbone.history.start();
router.navigate('books/1', { trigger: true }); // Outputs: Book ID: 1
React is a JavaScript library for building user interfaces. It allows developers to create large web applications that can update and render efficiently in response to data changes. Unlike Backbone, React focuses on the view layer and uses a component-based architecture.
Angular is a platform and framework for building single-page client applications using HTML and TypeScript. It provides a comprehensive solution for building dynamic web applications, including data binding, dependency injection, and a powerful templating system. Angular is more opinionated and feature-rich compared to Backbone.
Vue.js is a progressive JavaScript framework for building user interfaces. It is designed to be incrementally adoptable and focuses on the view layer. Vue provides a reactive data binding system and a component-based architecture, similar to React but with a more flexible and less opinionated approach compared to Angular.
____ __ __
/\ _`\ /\ \ /\ \ __
\ \ \ \ \ __ ___\ \ \/'\\ \ \____ ___ ___ __ /\_\ ____
\ \ _ <' /'__`\ /'___\ \ , < \ \ '__`\ / __`\ /' _ `\ /'__`\ \/\ \ /',__\
\ \ \ \ \/\ \ \.\_/\ \__/\ \ \\`\\ \ \ \ \/\ \ \ \/\ \/\ \/\ __/ __ \ \ \/\__, `\
\ \____/\ \__/.\_\ \____\\ \_\ \_\ \_,__/\ \____/\ \_\ \_\ \____\/\_\_\ \ \/\____/
\/___/ \/__/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/_/\/_/\/____/\/_/\ \_\ \/___/
\ \____/
\/___/
(_'_______________________________________________________________________________'_)
(_.———————————————————————————————————————————————————————————————————————————————._)
Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.
For Docs, License, Tests, pre-packed downloads, and everything else, really, see: https://backbonejs.org
To suggest a feature or report a bug: https://github.com/jashkenas/backbone/issues
For questions on working with Backbone or general discussions: security policy, https://stackoverflow.com/questions/tagged/backbone.js, https://matrix.to/#/#jashkenas_backbone:gitter.im or https://groups.google.com/g/backbonejs
Backbone is an open-sourced component of DocumentCloud: https://github.com/documentcloud
Testing powered by SauceLabs: https://saucelabs.com
Many thanks to our contributors: https://github.com/jashkenas/backbone/graphs/contributors
Special thanks to Robert Kieffer for the original philosophy behind Backbone. https://github.com/broofa
This project adheres to a code of conduct. By participating, you are expected to uphold this code.
FAQs
Give your JS App some Backbone with Models, Views, Collections, and Events.
We found that backbone demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.