src property added

This commit is contained in:
Vladimir Enchev
2015-05-18 17:19:17 +03:00
parent 6b71ea07b4
commit 1dc3de774c
4 changed files with 95 additions and 4 deletions

View File

@ -22,11 +22,31 @@ function onUrlPropertyChanged(data: dependencyObservable.PropertyChangeData) {
// register the setNativeValue callback
(<proxy.PropertyMetadata>urlProperty.metadata).onSetNativeValue = onUrlPropertyChanged;
var srcProperty = new dependencyObservable.Property(
"src",
"WebView",
new proxy.PropertyMetadata("")
);
function onSrcPropertyChanged(data: dependencyObservable.PropertyChangeData) {
var webView = <WebView>data.object;
if (webView._suspendLoading) {
return;
}
webView._loadSrc(data.newValue);
}
// register the setNativeValue callback
(<proxy.PropertyMetadata>srcProperty.metadata).onSetNativeValue = onSrcPropertyChanged;
export class WebView extends view.View implements definition.WebView {
public static loadStartedEvent = "loadStarted";
public static loadFinishedEvent = "loadFinished";
public static urlProperty = urlProperty;
public static srcProperty = srcProperty;
public _suspendLoading: boolean;
@ -42,6 +62,14 @@ export class WebView extends view.View implements definition.WebView {
this._setValue(WebView.urlProperty, value);
}
get src(): string {
return this._getValue(WebView.srcProperty);
}
set src(value: string) {
this._setValue(WebView.srcProperty, value);
}
public _onLoadFinished(url: string, error?: string) {
this._suspendLoading = true;
@ -73,6 +101,10 @@ export class WebView extends view.View implements definition.WebView {
throw new Error("This member is abstract.");
}
public _loadSrc(src: string) {
throw new Error("This member is abstract.");
}
get canGoBack(): boolean {
throw new Error("This member is abstract.");
}