< >

Features

Marionette Features are opt-in functionality that you can enable by utilizing setEnabled in your app. It is a good practice to set these flags only once prior to instantiating any Marionette class.

Documentation Index

Goals:

Checking a Feature Flag State

Use isEnabled if you need to know the state of a feature flag programmatically.

import { isEnabled } from 'backbone.marionette';

isEnabled('fooFlag'); // false

Setting a Feature Flag

Use setEnabled to change the value of a flag. While setting a flag at any point may work, these flags are designed to be set before any functionality of Marionette is used. Change flags after at your own risk.

import { setEnabled } from 'backbone.marionette';

setEnabled('fooFlag', true);

const myApp = new MyApp({
  region: '#app-hook'
});

myApp.start();

Current Features

childViewEventPrefix

Default: false

This flag indicates whether childViewEventPrefix for all views will return the default value of 'childview' or if it will return false disabling automatic event bubbling.

triggersPreventDefault

Default: true

It indicates the whether or not View.triggers will call event.preventDefault() if not explicitly defined by the trigger. The default has been true, but for a future version false is being considered.

triggersStopPropagating

Default: true

It indicates the whether or not View.triggers will call event.stopPropagating() if not explicitly defined by the trigger. The default has been true, but for a future version false is being considered.

DEV_MODE

Default: false

If true, deprecation console warnings are issued at runtime.

Improve this page