Get started with backbone.marionette CDN

MIT licensed

Backbone.Marionette: Library for large-scale, modular Backbone.js apps.

Tags:
  • collections
  • models
  • controllers
  • events

Stable version

Copied!

How to start using backbone.marionette CDN


// Include Backbone and Backbone.Marionette via CDN
const Backbone = require('https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone-min.js');
const Marionette = require('https://cdn.cdnhub.io/backbone.marionette/4.1.3/backbone.marionette.min.js');

// Define a simple model
class MyModel extends Backbone.Model {
  defaults() {
    return { message: 'Hello, Marionette!' };
  }
}

// Define a simple view
class MyView extends Marionette.View {
  template() {
    return `<p>${this.model.get('message')}</p>`;
  }
}

// Define a region and a layout
class MyLayout extends Marionette.Layout {
  template() {
    return '<div id="content"></div>';
  }

  regions() {
    return {
      content: '#content'
    };
  }
}

// Initialize the application
class App extends Marionette.Application {
  constructor() {
    super();

    this.addInitializer(() => {
      this.layout = new MyLayout();
      this.addRegion('main', this.layout.get('content'));

      this.showChildView('main', new MyView({ model: new MyModel() }));
    });
  }
}

new App().start();
Copied!
Copied!
Copied!
Copied!

All versions

0.10.0 0.10.0-bundled 0.10.1 0.10.1-bundled 0.10.2 0.10.2-bundled 0.7.0 0.7.1 0.7.2 0.7.3 0.7.4 0.7.5 0.7.6 0.8.0 0.8.0-bundled 0.8.1 0.8.1-bundled 0.8.2 0.8.2-bundled 0.8.3 0.8.3-bundled 0.8.4 0.8.4-bundled 0.9.0 0.9.0-bundled 0.9.1 0.9.1-bundled 0.9.10 0.9.10-bundled 0.9.11 0.9.11-bundled 0.9.12 0.9.12-bundled 0.9.13 0.9.13-bundled 0.9.2 0.9.2-bundled 0.9.3 0.9.3-bundled 0.9.4 0.9.4-bundled 0.9.5 0.9.5-bundled 0.9.6 0.9.6-bundled 0.9.7 0.9.7-bundled 0.9.8 0.9.8-bundled 0.9.9 0.9.9-bundled 1.0.0 1.0.0-beta1 1.0.0-beta1-bundled 1.0.0-beta2 1.0.0-beta2-bundled 1.0.0-beta3 1.0.0-beta3-bundled 1.0.0-beta4 1.0.0-beta4-bundled 1.0.0-beta5 1.0.0-beta5-bundled 1.0.0-beta6 1.0.0-beta6-bundled 1.0.0-bundled 1.0.0-rc1 1.0.0-rc1-bundled 1.0.0-rc2 1.0.0-rc2-amdjs 1.0.0-rc2-bundled 1.0.0-rc3 1.0.0-rc3-bundled 1.0.0-rc4 1.0.0-rc4-bundled 1.0.0-rc5 1.0.0-rc5-bundled 1.0.0-rc6 1.0.0-rc6-bundled 1.0.1 1.0.1-bundled 1.0.2 1.0.2-bundled 1.0.3 1.0.3-bundled 1.0.4 1.0.4-bundled 1.1.0 1.1.0-bundled 1.2.0 1.2.0-bundled 1.2.1 1.2.1-bundled 1.2.2 1.2.2-bundled 1.2.3 1.2.3-bundled 1.3.0 1.3.0-bundled 1.4.0 1.4.0-bundled 1.4.0beta 1.4.0beta-bundled 1.4.1 1.4.1-bundled 1.5.0 1.5.0-bundled 1.5.1 1.5.1-bundled 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.4-bundled 1.7 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 2.0.0 2.0.0-pre.1 2.0.0-pre.2 2.0.1 2.0.2 2.0.3 2.1.0 2.1.0-pre 2.2.0 2.2.0-pre 2.2.0-pre.2 2.2.1 2.2.2 2.3.0 2.3.0-pre 2.3.1 2.3.2 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.6 3.0.0 3.0.0-beta.2 3.0.0-pre.1 3.0.0-pre.2 3.0.0-pre.3 3.0.0-pre.4 3.0.0-pre.5 3.1.0 3.2.0 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.5.0 3.5.1 4.0.0 4.0.0-alpha.1 4.0.0-beta.1 4.1.0 4.1.1 4.1.2 *** 4.1.3