How to use the ember-metal/core.deprecate function in ember-metal

To help you get started, we’ve selected a few ember-metal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember.js / packages / ember-runtime / lib / computed / reduce_computed.js View on Github external
function ReduceComputedProperty(options) {
  var cp = this;

  // use options._suppressDeprecation to allow us to deprecate
  // arrayComputed and reduceComputed themselves, but not the
  // default internal macros which will be reimplemented as plain
  // array methods
  if (this._isArrayComputed) {
    Ember.deprecate(
      'Ember.arrayComputed is deprecated. Replace it with plain array methods',
      options._suppressDeprecation
    );
  } else {
    Ember.deprecate(
      'Ember.reduceComputed is deprecated. Replace it with plain array methods',
      options._suppressDeprecation
    );
  }

  this.options = options;
  this._dependentKeys = null;
  this._cacheable = true;
  // A map of dependentKey -> [itemProperty, ...] that tracks what properties of
  // items in the array we must track to update this property.
  this._itemPropertyKeys = {};
github emberjs / ember.js / packages / ember-htmlbars / lib / node-managers / component-node-manager.js View on Github external
function extractLegacyTemplate(_templates, componentTemplate) {
  let templates;

  // There is no block template provided but the component has a
  // `template` property.
  if ((!_templates || !_templates.default) && componentTemplate) {
    Ember.deprecate("Using deprecated `template` property on a Component.");
    templates = { default: componentTemplate.raw };
  } else {
    templates = _templates;
  }

  return templates;
}
github emberjs / ember.js / packages / ember-htmlbars / lib / helpers / collection.js View on Github external
export function collectionHelper(params, hash, options, env) {
  var path = params[0];

  Ember.deprecate("Using the {{collection}} helper without specifying a class has been" +
                  " deprecated as the {{each}} helper now supports the same functionality.", path !== 'collection');

  Ember.assert("You cannot pass more than one argument to the collection helper", params.length <= 1);

  var data     = env.data;
  var template = options.template;
  var inverse  = options.inverse;
  var view     = data.view;

  // This should be deterministic, and should probably come from a
  // parent view and not the controller.
  var  controller = get(view, 'controller');
  var  container = (controller && controller.container ? controller.container : view.container);

  // If passed a path string, convert that into an object.
  // Otherwise, just default to the standard class.
github emberjs / ember.js / packages / ember-htmlbars / lib / node-managers / component-node-manager.js View on Github external
export function createComponent(_component, isAngleBracket, _props, renderNode, env, attrs = {}, proto = _component.proto()) {
  let props = assign({}, _props);

  if (!isAngleBracket) {
    let hasSuppliedController = 'controller' in attrs; // 2.0TODO remove
    Ember.deprecate("controller= is deprecated", !hasSuppliedController);

    let snapshot = takeSnapshot(attrs);
    props.attrs = snapshot;

    mergeBindings(props, shadowedAttrs(proto, snapshot));
  } else {
    props._isAngleBracket = true;
  }

  props.renderer = props.parentView ? props.parentView.renderer : env.container.lookup('renderer:-dom');
  props._viewRegistry = props.parentView ? props.parentView._viewRegistry : env.container.lookup('-view-registry:main');

  let component = _component.create(props);

  // for the fallback case
  component.container = component.container || env.container;
github emberjs / ember.js / packages / ember-routing-views / lib / views / link.js View on Github external
init: function() {
    this._super.apply(this, arguments);

    Ember.deprecate('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.', !this.currentWhen);

    // Map desired event name to invoke function
    var eventName = get(this, 'eventName');
    this.on(eventName, this, this._invoke);
  },
github emberjs / ember.js / packages / ember-htmlbars / lib / system / merge-view-bindings.js View on Github external
continue;
    }

    var value = hash[key];

    if (IS_BINDING.test(key)) {
      if (typeof value === 'string') {
        Ember.deprecate(
          "You're attempting to render a view by passing " + key + " " +
          "to a view helper, but this syntax is deprecated. You should use `" +
          key.slice(0, -7) + "=someValue` instead."
        );

        props[key] = view._getBindingForStream(value);
      } else if (isStream(value)) {
        Ember.deprecate(
          "You're attempting to render a view by passing " + key + " " +
          "to a view helper without a quoted value, but this syntax is " +
          "ambiguous. You should either surround " + key + "'s value in " +
          "quotes or remove `Binding` from " + key + "."
        );

        props[key] = view._getBindingForStream(value);
      } else {
        props[key] = value;
      }
    } else {
      if (isStream(value)) {
        props[key + 'Binding'] = view._getBindingForStream(value);
      } else {
        props[key] = value;
      }
github emberjs / ember.js / packages / ember-handlebars / lib / helpers / with.js View on Github external
Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);

    var localizedOptions = o_create(options);
    localizedOptions.data = o_create(options.data);

    localizedOptions.keywords = {};
    localizedOptions.keywords[keywordName] = view.getStream(contextPath);

    localizedOptions.hash.keywordName = keywordName;

    bindContext = this;
    options = localizedOptions;
    preserveContext = true;
  } else {
    Ember.deprecate('Using the context switching form of `{{with}}` is deprecated. Please use the keyword form (`{{with foo as bar}}`) instead. See http://emberjs.com/guides/deprecations/#toc_more-consistent-handlebars-scope for more details.');

    Ember.assert("You must pass exactly one argument to the with helper", arguments.length === 2);
    Ember.assert("You must pass a block to the with helper", options.fn && options.fn !== Handlebars.VM.noop);

    helperName += ' ' + contextPath;
    bindContext = options.contexts[0];
    preserveContext = false;
  }

  options.helperName = helperName;

  return bind.call(bindContext, contextPath, options, preserveContext, exists, undefined, undefined, WithView);
}
github emberjs / ember.js / packages / ember-template-compiler / lib / plugins / transform-bind-attr-to-attributes.js View on Github external
let moduleInfo = '';

  if (moduleName) {
    moduleInfo +=  `'${moduleName}' @ `;
  }

  if (line && column) {
    moduleInfo += `L${line}:C${column}`;
  }

  if (moduleInfo) {
    moduleInfo = `(${moduleInfo}) `;
  }

  if (name === 'bind-attr' || name === 'bindAttr') {
    Ember.deprecate(
      'The `' + name + '` helper ' + moduleInfo + 'is deprecated in favor of ' +
      'HTMLBars-style bound attributes.'
    );
    return true;
  } else {
    return false;
  }
}
github emberjs / ember.js / packages / ember-views / lib / compat / render_buffer.js View on Github external
export default function RenderBuffer(domHelper) {
  Ember.deprecate('`Ember.RenderBuffer` is deprecated.', false,
                  { id: 'ember-views.render-buffer', until: '3.0.0' });
  this.buffer = null;
  this.childViews = [];
  this.attrNodes = [];

  Ember.assert('RenderBuffer requires a DOM helper to be passed to its constructor.', !!domHelper);

  this.dom = domHelper;

  this.tagName = undefined;
  this.buffer = null;
  this._element = null;
  this._outerContextualElement = undefined;
  this.elementClasses = null;
  this.elementId = null;
  this.elementAttributes = null;
github emberjs / ember.js / packages / ember-metal / lib / utils.js View on Github external
var deprecatedTryCatchFinally = function() {
  Ember.deprecate("tryCatchFinally is deprecated. Please use JavaScript's native try/catch/finally.", false);
  return tryCatchFinally.apply(this, arguments);
};