How to use the aurelia-metadata.Metadata.resource 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 / es6 / decorators.js View on Github external
var deco = function(target){
    var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
    resource.skipContentProcessing = true;
  };
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / module-analyzer.ts View on Github external
if(typeof moduleInstance === 'function'){
      moduleInstance = {'default': moduleInstance};
    }

    if(viewModelMember){
      mainResource = new ResourceDescription(viewModelMember, moduleInstance[viewModelMember]);
    }

    for(key in moduleInstance){
      exportedValue = moduleInstance[key];

      if(key === viewModelMember || typeof exportedValue !== 'function'){
        continue;
      }

      resourceTypeMeta = Metadata.get(Metadata.resource, exportedValue);

      if(resourceTypeMeta){
        if(resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null){
          //no customeElement or customAttribute but behavior added by other metadata
          HtmlBehaviorResource.convention(key, resourceTypeMeta);
        }

        if(resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null){
          //no convention and no customeElement or customAttribute but behavior added by other metadata
          resourceTypeMeta.elementName = hyphenate(key);
        }

        if(!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null){
          mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta);
        }else{
          resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / module-analyzer.ts View on Github external
}else{
          resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));
        }
      } else if(exportedValue instanceof ViewStrategy){
        viewStrategy = exportedValue;
      } else if(exportedValue instanceof TemplateRegistryEntry){
        viewStrategy = new TemplateRegistryViewStrategy(moduleId, exportedValue);
      } else {
        if(conventional = HtmlBehaviorResource.convention(key)){
          if(conventional.elementName !== null && !mainResource){
            mainResource = new ResourceDescription(key, exportedValue, conventional);
          }else{
            resources.push(new ResourceDescription(key, exportedValue, conventional));
          }

          Reflect.defineMetadata(Metadata.resource, conventional, exportedValue);
        } else if(conventional = ValueConverterResource.convention(key)) {
          resources.push(new ResourceDescription(key, exportedValue, conventional));
          Reflect.defineMetadata(Metadata.resource, conventional, exportedValue);
        } else if(!fallbackValue){
          fallbackValue = exportedValue;
          fallbackKey = key;
        }
      }
    }

    if(!mainResource && fallbackValue){
      mainResource = new ResourceDescription(fallbackKey, fallbackValue);
    }

    resourceModule.moduleInstance = moduleInstance;
    resourceModule.mainResource = mainResource;
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / decorators.js View on Github external
var deco = function (target) {
        var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
        resource.hasDynamicOptions = true;
    };
    return target ? deco(target) : deco;
github aurelia / binding / src / index.js View on Github external
export function valueConverter(nameOrTarget){
  if(nameOrTarget === undefined || typeof nameOrTarget === 'string'){
    return function(target){
      Reflect.defineMetadata(Metadata.resource, new ValueConverterResource(nameOrTarget), target);
    }
  }

  Reflect.defineMetadata(Metadata.resource, new ValueConverterResource(), nameOrTarget);
}
github cmichaelgraham / aurelia-ts-port / dist / es6 / templating / decorators.js View on Github external
var deco = function (target) {
        var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
        resource.targetShadowDOM = true;
    };
    return target ? deco(target) : deco;
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / decorators.ts View on Github external
var deco = function(target){
    var resource = Metadata.getOrCreateOwn(Metadata.resource, HtmlBehaviorResource, target);
    resource.liftsContent = true;
  };
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / module-analyzer.js View on Github external
constructor(key, exportedValue, resourceTypeMeta) {
        if (!resourceTypeMeta) {
            resourceTypeMeta = Metadata.get(Metadata.resource, exportedValue);
            if (!resourceTypeMeta) {
                resourceTypeMeta = new HtmlBehaviorResource();
                resourceTypeMeta.elementName = hyphenate(key);
                Reflect.defineMetadata(Metadata.resource, resourceTypeMeta, exportedValue);
            }
        }
        if (resourceTypeMeta instanceof HtmlBehaviorResource) {
            if (resourceTypeMeta.elementName === undefined) {
                //customeElement()
                resourceTypeMeta.elementName = hyphenate(key);
            }
            else if (resourceTypeMeta.attributeName === undefined) {
                //customAttribute()
                resourceTypeMeta.attributeName = hyphenate(key);
            }
            else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
github cmichaelgraham / aurelia-ts-port / aurelia-ts / templating / module-analyzer.js View on Github external
constructor(key, exportedValue, resourceTypeMeta) {
        if (!resourceTypeMeta) {
            resourceTypeMeta = Metadata.get(Metadata.resource, exportedValue);
            if (!resourceTypeMeta) {
                resourceTypeMeta = new HtmlBehaviorResource();
                resourceTypeMeta.elementName = hyphenate(key);
                Reflect.defineMetadata(Metadata.resource, resourceTypeMeta, exportedValue);
            }
        }
        if (resourceTypeMeta instanceof HtmlBehaviorResource) {
            if (resourceTypeMeta.elementName === undefined) {
                //customeElement()
                resourceTypeMeta.elementName = hyphenate(key);
            }
            else if (resourceTypeMeta.attributeName === undefined) {
                //customAttribute()
                resourceTypeMeta.attributeName = hyphenate(key);
            }
            else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {
                //no customeElement or customAttribute but behavior added by other metadata
                HtmlBehaviorResource.convention(key, resourceTypeMeta);
            }
        }