src/Morearty.js
function (spec) {
      var initialState, initialMetaState, options;
      if (arguments.length <= 1) {
        var effectiveSpec = spec || {};
        initialState = effectiveSpec.initialState;
        initialMetaState = effectiveSpec.initialMetaState;
        options = effectiveSpec.options;
      } else {
        console.warn(
          'Passing multiple arguments to createContext is deprecated. Use single object form instead.'
        );

        initialState = arguments[0];
        initialMetaState = arguments[1];
        options = arguments[2];
      }

      var ensureImmutable = function (state) {
        return Imm.Iterable.isIterable(state) ? state : Imm.fromJS(state);
      };

      var state = ensureImmutable(initialState || {});
      var metaState = ensureImmutable(initialMetaState || {});

      var metaBinding = Binding.init(metaState);
      var binding = Binding.init(state, metaBinding);

      var effectiveOptions = options || {};
      return new Context(binding, metaBinding, {
        requestAnimationFrameEnabled: effectiveOptions.requestAnimationFrameEnabled !== false,
        renderOnce: effectiveOptions.renderOnce || false,
        stopOnRenderError: effectiveOptions.stopOnRenderError || false,
        logger: effectiveOptions.logger || defaultLogger
      });
    }
function (spec) {
      var initialState, initialMetaState, options;
      if (arguments.length <= 1) {
        var effectiveSpec = spec || {};
        initialState = effectiveSpec.initialState;
        initialMetaState = effectiveSpec.initialMetaState;
        options = effectiveSpec.options;
      } else {
        console.warn(
          'Passing multiple arguments to createContext is deprecated. Use single object form instead.'
        );

        initialState = arguments[0];
        initialMetaState = arguments[1];
        options = arguments[2];
      }

      var ensureImmutable = function (state) {
        return Imm.Iterable.isIterable(state) ? state : Imm.fromJS(state);
      };

      var state = ensureImmutable(initialState || {});
      var metaState = ensureImmutable(initialMetaState || {});

      var metaBinding = Binding.init(metaState);
      var binding = Binding.init(state, metaBinding);

      var effectiveOptions = options || {};
      return new Context(binding, metaBinding, {
        requestAnimationFrameEnabled: effectiveOptions.requestAnimationFrameEnabled !== false,
        renderOnce: effectiveOptions.renderOnce || false,
        stopOnRenderError: effectiveOptions.stopOnRenderError || false,
        logger: effectiveOptions.logger || defaultLogger
      });
    }
function ( spec ) { var initialState , initialMetaState , options ; if ( arguments . length <= 1 ) { var effectiveSpec = spec || { } ; initialState = effectiveSpec . initialState ; initialMetaState = effectiveSpec . initialMetaState ; options = effectiveSpec . options ; } else { console . warn ( 'Passing multiple arguments to createContext is deprecated. Use single object form instead.' ) ; initialState = arguments [ 0 ] ; initialMetaState = arguments [ 1 ] ; options = arguments [ 2 ] ; } var ensureImmutable = function ( state ) { return Imm . Iterable . isIterable ( state ) ? state : Imm . fromJS ( state ) ; } ; var state = ensureImmutable ( initialState || { } ) ; var metaState = ensureImmutable ( initialMetaState || { } ) ; var metaBinding = Binding . init ( metaState ) ; var binding = Binding . init ( state , metaBinding ) ; var effectiveOptions = options || { } ; return new Context ( binding , metaBinding , { requestAnimationFrameEnabled : effectiveOptions . requestAnimationFrameEnabled !== false , renderOnce : effectiveOptions . renderOnce || false , stopOnRenderError : effectiveOptions . stopOnRenderError || false , logger : effectiveOptions . logger || defaultLogger } ) ; }
Create Morearty context.
@param {Object} [spec] spec object
@param {Immutable.Map|Object} [spec.initialState={}] initial state
@param {Immutable.Map|Object} [spec.initialMetaState={}] initial meta-state
@param {Object} [spec.options={}] options object
@param {Boolean} [spec.options.requestAnimationFrameEnabled=true] enable rendering in requestAnimationFrame
@param {Boolean} [spec.options.renderOnce=false]
ensure render is executed only once (useful for server-side rendering to save resources),
any further state updates are ignored
@param {Boolean} [spec.options.stopOnRenderError=false] stop on errors during render
@param {Object} [spec.options.logger=undefined] an optional logger object for reporting errors
@param {function} [spec.options.logger.error] function accepting error message and optional cause
@return {Context}
@memberOf Morearty
Create Morearty context .