The backbone.js model extends another model

I am creating a control panel application using Backbone.js

There is a grid of panels called modules. Each module has its own user data that must be listened to.

In this sense, I created a base model called Module , which is basically top-level information for each module, such as module_name and module_description

My first inclination is to find a way to create a new special modular model for each module ... like a “counting” module, a “messages” module, etc.

How can I approach separate and different data on a module? any recommendations on design patterns?

+4
source share
1 answer

You can do something like this:

 var Module = Backbone.Model.extend({ // default properties/methods of this module }); var MessageModule = Module.extend({ // new properties/methods of this module }); 
+7
source

Source: https://habr.com/ru/post/1447282/


All Articles