How to use the aurelia-metadata.metadata.getOrCreateOwn function in aurelia-metadata

To help you get started, we’ve selected a few aurelia-metadata 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 aurelia / templating / dist / aurelia-templating.js View on Github external
let deco = function(t) {
    let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);
    r.hasDynamicOptions = true;
  };
github aurelia / templating / src / decorators.js View on Github external
let deco = function(t) {
    let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, t);
    r.hasDynamicOptions = true;
  };
github adarshpastakia / aurelia-ui-framework / src / models / ui-data-model.ts View on Github external
return (target, property) => {
    if (!property) {
      throw Error("Decorator should be used on property only!");
    }

    const meta = Metadata.getOrCreateOwn(
      Metadata.properties,
      ModelMetadata,
      target
    ) as ModelMetadata;

    meta.serializableProps.push(property);
    meta.propertyDefs[property] = {
      enumerable: true,
      get: target.propertyGetter(property),
      set: target.propertySetter(property)
    };
    meta.propertyDefs["_" + property] = {
      enumerable: false,
      value: defaultValue,
      writable: true
    };
github aurelia / validatejs / dist / native-modules / aurelia-validatejs.js View on Github external
export function addRule(target, key, descriptor, targetOrConfig, rule) {
  var rules = metadata.getOrCreateOwn(metadataKey, ValidationRules, target);
  if (targetOrConfig === null || targetOrConfig === undefined) {
    targetOrConfig = true;
  }
  rules.addRule(key, rule(targetOrConfig));

  if (descriptor) {
    descriptor.configurable = true;
  }
}
github SpoonX / aurelia-orm / dist / aurelia-orm.js View on Github external
static forTarget(target) {
    return metadata.getOrCreateOwn(Metadata.key, Metadata, target, target.name);
  }
}
github aurelia / templating / src / decorators.js View on Github external
let deco = function(target, key2, descriptor2) {
    let actualTarget = key2 ? target.constructor : target; //is it on a property or a class?
    let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, actualTarget);
    let prop;

    if (key2) { //is it on a property or a class?
      nameOrConfigOrTarget = nameOrConfigOrTarget || {};
      nameOrConfigOrTarget.name = key2;
    }

    prop = new BindableProperty(nameOrConfigOrTarget);
    return prop.registerWith(actualTarget, r, descriptor2);
  };
github aurelia / templating / dist / aurelia-templating.js View on Github external
return function(target) {
    let r = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, target);
    r.attributeName = name;
    r.attributeDefaultBindingMode = defaultBindingMode;
  };
}