VOOZH about

URL: https://www.geeksforgeeks.org/javascript/backbone-js-mixin-collection/

⇱ Backbone.js mixin Collection - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Backbone.js mixin Collection

Last Updated : 18 Jul, 2022

The Backbone.js mixin Collection is function which is used to append attributes and function to base Backbone.Collection class. This function is used add generic function link Underscore Method.

Syntax: 

Backbone.Collection.mixin( properties );

Properties: It accepts a single property as mentioned above and described below:

  • properties: It is the properties which we want to append in our base class.

In the below examples, we will use the Backbone.js mixin Collection.

Example 1: In this example, we will append some attributes and initialize method which will print itself.

Output:

👁 Image
Backbone.js mixin Collection

Example 2: In this example, we will add print method to the base class which will print given attribute of model in class.

Output:

👁 Image
Backbone.js mixin Collection

Reference: https://backbonejs.org/#Collection-mixin

Comment