Skip to content

Instantly share code, notes, and snippets.

@cp
Last active April 28, 2016 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cp/3c570237f531c2a3763642f6dada8a51 to your computer and use it in GitHub Desktop.
Save cp/3c570237f531c2a3763642f6dada8a51 to your computer and use it in GitHub Desktop.
Reflect Overrides

Reflect Overrides

We built overrides as a way of customizing individual components at runtime. This can be useful for dynamically altering a component based on it's current environment.

Overrides use JSONPath to manipulate your view's configuration. The documentation on JSONPath's syntax can be found here.

Here's an example of supplying Reflect.js with overrides. Specifically, we're setting the dimensions of a component with id #1.

var ui = new ReflectUI(token),
    overrides = [
      {
        path: '$.components..[?(@.id == 1)].dimensions',
        value: ['dim1', dim2]
      }
    ];

ui.withOverrides(overrides);
ui.view(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment