How to use the ember-metal/property_set.set 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-views / lib / views / bound_view.js View on Github external
// expression to the render context and return.
          if (result === null || result === undefined) {
            result = "";
          }

          buffer.push(result);
          return;
        }
      }
    } else if (inverseTemplate) {
      set(this, 'template', inverseTemplate);

      if (preserveContext) {
        set(this, '_context', context);
      } else {
        set(this, '_context', result);
      }
    } else {
      set(this, 'template', function() { return ''; });
    }

    return this._super(buffer);
  }
});
github emberjs / ember.js / packages / ember-views / lib / views / each.js View on Github external
createChildView: function(view, attrs) {
    view = this._super(view, attrs);

    var content = get(view, 'content');
    var keyword = get(this, 'keyword');

    if (keyword) {
      view._keywords[keyword] = content;
    }

    // If {{#each}} is looping over an array of controllers,
    // point each child view at their respective controller.
    if (content && content.isController) {
      set(view, 'controller', content);
    }

    return view;
  },
github emberjs / ember.js / packages / ember-routing / lib / ext / view.js View on Github external
_finishDisconnections: function() {
    if (this.isDestroyed) return; // _outlets will be gone anyway
    var outlets = get(this, '_outlets');
    var pendingDisconnections = this._pendingDisconnections;
    this._pendingDisconnections = null;

    for (var outletName in pendingDisconnections) {
      set(outlets, outletName, null);
    }
  }
});
github emberjs / ember.js / packages / ember-views / lib / views / collection_view.js View on Github external
});

        addedViews.push(view);
      }
    } else {
      emptyView = get(this, 'emptyView');

      if (!emptyView) { return; }

      if ('string' === typeof emptyView && isGlobalPath(emptyView)) {
        emptyView = get(emptyView) || emptyView;
      }

      emptyView = this.createChildView(emptyView);
      addedViews.push(emptyView);
      set(this, 'emptyView', emptyView);

      if (CoreView.detect(emptyView)) {
        this._createdEmptyView = emptyView;
      }
    }

    this.replace(start, 0, addedViews);
  },
github emberjs / ember.js / packages / ember-handlebars / lib / helpers / each.js View on Github external
this.disableContentObservers(function() {
        set(this, 'content', controller);
        binding = new Binding('content', '_eachView.dataSource').oneWay();
        binding.connect(controller);
      });
github emberjs / ember.js / packages / ember-runtime / lib / system / set.js View on Github external
var len = get(this, 'length');
    if (len === 0) { return this; }

    var guid;

    this.enumerableContentWillChange(len, 0);
    propertyWillChange(this, 'firstObject');
    propertyWillChange(this, 'lastObject');

    for (var i=0; i < len; i++) {
      guid = guidFor(this[i]);
      delete this[guid];
      delete this[i];
    }

    set(this, 'length', 0);

    propertyDidChange(this, 'firstObject');
    propertyDidChange(this, 'lastObject');
    this.enumerableContentDidChange(len, 0);

    return this;
  },
github emberjs / ember.js / packages / ember-views / lib / views / legacy_each_view.js View on Github external
willUpdate(attrs) {
    let itemController = this.getAttrFor(attrs, 'itemController');

    if (itemController) {
      let arrayController = get(this, '_arrayController');
      set(arrayController, 'content', this.getAttrFor(attrs, 'content'));
    }
  },
github emberjs / ember.js / packages / ember-views / lib / views / with_view.js View on Github external
render: function(buffer) {
    var withValue = this.normalizedValue();
    this._lastNormalizedValue = withValue;

    if (!this.preserveContext && !this.controllerName) {
      set(this, '_context', withValue);
    }

    var template = withValue ? this.mainTemplate : this.inverseTemplate;
    renderView(this, buffer, template);
  },
github emberjs / ember.js / packages / ember-views / lib / views / container_view.js View on Github external
forEach(views, function(view) {
      set(view, '_parentView', parentView);

      if (!view.container && parentView) {
        set(view, 'container', parentView.container);
      }
    });
  },
github emberjs / ember.js / packages / ember-views / lib / views / container_view.js View on Github external
forEach(views, function(view) {
      set(view, '_parentView', parentView);

      if (!view.container && parentView) {
        set(view, 'container', parentView.container);
      }

      if (!get(view, 'templateData')) {
        set(view, 'templateData', templateData);
      }
    });
  },