refactor(core): move files to the right place
- render/xhr_* -> compiler/xhr_* - render/event_config -> linker/event_config - render/dom/schema -> compiler/schema - render/dom/compiler/* -> compiler/* - render/dom/view/shared_styles_host -> render/dom/shared_styles_host - services/url_resolver -> compiler/url_resolver - services/app_root_urlo -> compiler/app_root_url
This commit is contained in:
23
modules/angular2/src/core/linker/event_config.ts
Normal file
23
modules/angular2/src/core/linker/event_config.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {StringWrapper} from 'angular2/src/core/facade/lang';
|
||||
export const EVENT_TARGET_SEPARATOR = ':';
|
||||
|
||||
export class EventConfig {
|
||||
constructor(public fieldName: string, public eventName: string, public isLongForm: boolean) {}
|
||||
|
||||
static parse(eventConfig: string): EventConfig {
|
||||
var fieldName = eventConfig, eventName = eventConfig, isLongForm = false;
|
||||
var separatorIdx = eventConfig.indexOf(EVENT_TARGET_SEPARATOR);
|
||||
if (separatorIdx > -1) {
|
||||
// long format: 'fieldName: eventName'
|
||||
fieldName = StringWrapper.substring(eventConfig, 0, separatorIdx).trim();
|
||||
eventName = StringWrapper.substring(eventConfig, separatorIdx + 1).trim();
|
||||
isLongForm = true;
|
||||
}
|
||||
return new EventConfig(fieldName, eventName, isLongForm);
|
||||
}
|
||||
|
||||
getFullName(): string {
|
||||
return this.isLongForm ? `${this.fieldName}${EVENT_TARGET_SEPARATOR}${this.eventName}` :
|
||||
this.eventName;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user