< >

Marionette Utility Functions

Marionette provides a set of utility / helper functions that are used to facilitate common behaviors throughout the framework. These functions may be useful to those that are building on top of Marionette, as they provide a way to get the same behaviors and conventions from your own code.

Documentation Index


Backbone's extend function is a useful utility to have, and is used in various places in Marionette. To make the use of this method more consistent, Backbone's extend has been exported extend. This allows you to get the extend functionality for your object without having to decide if you want to use Backbone.View or Backbone.Model or another Backbone object to grab the method from.

import { extend } from 'backbone.marionette';

const Foo = function(){};

// use Marionette.extend to make Foo extendable, just like other
// Backbone and Marionette objects
Foo.extend = extend;

// Now Foo can be extended to create a new class, with methods
const Bar = Foo.extend({

  someMethod(){ ... }

  // ...

// Create an instance of Bar
const b = new Bar();

Live example

Common Method Utilities

These common utilities are available to all Marionette classes and exported so that the functionality can be used elsewhere. Each method has the same arguments as documented in common utilities except that the target of the method is added as the first argument.

For instance:

import { View, triggerMethod, getOption } from 'backbone.marionette';

const MyView = View.extend({
  initialize() {
    this.triggerMethod('foo', this.getOption('foo'));
  onFoo() {

// logs "bar"
const myView = new MyView({ foo: 'bar' });

// Same as initialize, logs "bar"
triggerMethod(myView, 'foo', getOption(myView, 'foo'));


Maintains a reference to the version of a Marionette instance. VERSION is used to direct users to the correctly versioned documentation when errors are thrown.

Improve this page