Skip to content

Files

Latest commit

13f6ef7 · Mar 17, 2016

History

History

object

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 17, 2016
Mar 13, 2016
Mar 10, 2016

Object Type

Represents simple, untyped objects. When an object is stored, it behaves as if Object.preventExtensions() has been called on it - it is not possible to add further properties, but existing properties can be modified.

Usage:

const {StructType, T} = realm;

const Element = new StructType({
  name: T.String,
  props: T.Object
});

const banner = new Element({
  name: 'Banner',
  props: {
    id: 'main-banner',
    className: 'jumbotron',
    nested: {
      as: {
        deep: {
          as: {
            you: {
              want: true
            }
          }
        }
      }
    }
  }
});

console.log(banner.props.className);

banner.props.className = 'jumbotron jumbotron-lg'; // ok

banner.props.nope = 'nope'; // has no effect, we can't add properties
typeof banner.props.nope === 'undefined'