How to use the aurelia-metadata.Metadata.on 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 cmichaelgraham / aurelia-ts-port / aurelia-latest / templating / decorators.js View on Github external
var deco = function(target){
    Metadata.on(target).add(new ElementConfigResource());
  };
github cmichaelgraham / aurelia-typescript / aurelia-ts-lib / aurelia-ts / dependency-injection / container.ts View on Github external
autoRegister(fn, key?){
    var registration;

    if (fn === null || fn === undefined){
      throw new Error('fn cannot be null or undefined.')
    }

    registration = Metadata.on(fn).first(Registration, true);

    if(registration){
      registration.register(this, key || fn, fn);
    }else{
      this.registerSingleton(key || fn, fn);
    }
  }
github cmichaelgraham / aurelia-typescript / aurelia-ts-lib / aurelia-ts / output-gulp / dependency-injection / container.js View on Github external
autoRegister(fn, key) {
        var registration;
        if (fn === null || fn === undefined) {
            throw new Error('fn cannot be null or undefined.');
        }
        registration = Metadata.on(fn).first(Registration, true);
        if (registration) {
            registration.register(this, key || fn, fn);
        }
        else {
            this.registerSingleton(key || fn, fn);
        }
    }
    /**
github aurelia / templating / src / behaviors.js View on Github external
export function configureBehavior(container, behavior, target, valuePropertyName) {
  var proto = target.prototype,
      taskQueue = container.get(TaskQueue),
      meta = Metadata.on(target),
      observerLocator = container.get(ObserverLocator),
      i, ii, properties;

  if(!behavior.name){
    behavior.name = hyphenate(target.name);
  }

  behavior.target = target;
  behavior.observerLocator = observerLocator;
  behavior.handlesCreated = ('created' in proto);
  behavior.handlesBind = ('bind' in proto);
  behavior.handlesUnbind = ('unbind' in proto);
  behavior.handlesAttached = ('attached' in proto);
  behavior.handlesDetached = ('detached' in proto);
  behavior.apiName = behavior.name.replace(/-([a-z])/g, (m, w) => {
    return w.toUpperCase();
github aurelia / templating / src / resource-coordinator.js View on Github external
resources.push({type:conventional,value:exportedValue});
      } else if(conventional = ValueConverter.convention(name)) {
        resources.push({type:conventional,value:exportedValue});
      } else if(!fallback){
        fallback = exportedValue;
      }
    }
  }

  viewModelType = viewModelType || fallback;

  return new ResourceModule(
    moduleInstance,
    viewModelType ? {
        value: viewModelType,
        type: Metadata.on(viewModelType).first(CustomElement) || new CustomElement()
      } : null,
    resources
    );
}
github aurelia / templating / src / resource-coordinator.js View on Github external
if(typeof moduleInstance === 'function'){
    moduleInstance = {'default': moduleInstance};
  }

  if(viewModelMember){
    viewModelType = moduleInstance[viewModelMember];
  }

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

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

    meta = Metadata.on(exportedValue);
    annotation = meta.first(ResourceType);

    if(annotation){
      if(!viewModelType && annotation instanceof CustomElement){
        viewModelType = exportedValue;
      }else{
        resources.push({type:annotation,value:exportedValue});
      }
    } else {
      name = exportedValue.name;

      if(conventional = CustomElement.convention(name)){
        if(!viewModelType){
          meta.add(conventional);
          viewModelType = exportedValue;
        }else{
github cmichaelgraham / aurelia-typescript / aurelia-ts-lib / aurelia-ts / output / dependency-injection / container.js View on Github external
autoRegister(fn, key) {
        var registration;
        if (fn === null || fn === undefined) {
            throw new Error('fn cannot be null or undefined.');
        }
        registration = Metadata.on(fn).first(Registration, true);
        if (registration) {
            registration.register(this, key || fn, fn);
        }
        else {
            this.registerSingleton(key || fn, fn);
        }
    }
    /**