Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var deco = function(target){
Metadata.on(target).add(new ElementConfigResource());
};
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);
}
}
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);
}
}
/**
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();
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
);
}
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{
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);
}
}
/**