M
M
Mikhail2019-02-21 09:55:27
JavaScript
Mikhail, 2019-02-21 09:55:27

Is it possible to pass objects through Backbone.Radio, and what does request, response mean?

One of the disadvantages of Beckbon and Marionette is that I used to drag different objects around. Views, Models. For example, through the window object. Can the Radio transfer functions or objects from one to another.
The second question is what does request and response mean. As I think, these are requests to a remote server - a response and a request. But I'm not sure.
Another thing I would like to ask is why events and requests are separated by a colon, what does it give? For example:

import { MnObject } from 'backbone.marionette';
import Radio from 'backbone.radio';

const channel = Radio.channel('notify');

const Notification = MnObject.extend({

  initialize() {
    channel.reply('show:success', this.showSuccessMessage);
    channel.reply('show:error', function(msg) {
       // ...
    });
  },

  showSuccessMessage(msg) {
    // ...
  }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question