mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added loadStarted event.
This commit is contained in:
@@ -34,7 +34,7 @@ export var testLoadExistingUrl = function (done) {
|
||||
// <snippet module="ui/web-view" title="WebView">
|
||||
// ### Using WebView,
|
||||
// ``` JavaScript
|
||||
webView.on(webViewModule.knownEvents.finished, function (args: webViewModule.FinishedEventData) {
|
||||
webView.on(webViewModule.knownEvents.loadFinished, function (args: webViewModule.LoadEventData) {
|
||||
var message;
|
||||
if (!args.error) {
|
||||
message = "WebView finished loading " + args.url;
|
||||
@@ -60,7 +60,7 @@ export var testLoadInvalidUrl = function (done) {
|
||||
var webView = <webViewModule.WebView>views[0];
|
||||
|
||||
var errorReceived = false;
|
||||
webView.on(webViewModule.knownEvents.finished, function (args: webViewModule.FinishedEventData) {
|
||||
webView.on(webViewModule.knownEvents.loadFinished, function (args: webViewModule.LoadEventData) {
|
||||
if (errorReceived) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import application = require("application");
|
||||
application.mainModule = "app/main-page";
|
||||
|
||||
import trace = require("trace");
|
||||
trace.enable();
|
||||
trace.setCategories(trace.categories.concat(trace.categories.Debug));
|
||||
|
||||
application.start();
|
||||
@@ -47,6 +47,8 @@ export function onPageLoaded(args: observableModule.EventData) {
|
||||
//viewModel.url = "alabala://www.nemadastane.com" // Error
|
||||
//viewModel.url = "sdfsdf://sdfwerfd";
|
||||
//viewModel.url = "http://www.sdfsdfsdfsdf.com/";
|
||||
|
||||
//viewModel.url = "https://api.instagram.com/oauth/authorize/?client_id=4e0171f9fcfc4015bb6300ed91fbf719&redirect_uri=http://localhost:2000/oauth&response_type=code";
|
||||
|
||||
backButton.isEnabled = false;
|
||||
forwardButton.isEnabled = false;
|
||||
@@ -67,7 +69,12 @@ export function onReloadButtonTap(args: observableModule.EventData) {
|
||||
webView.reload();
|
||||
}
|
||||
|
||||
export function onWebViewFinished(args: webViewModule.FinishedEventData) {
|
||||
export function onWebViewStartedLoading(args: webViewModule.LoadEventData) {
|
||||
console.log("startedLoading: " + args.url);
|
||||
}
|
||||
|
||||
export function onWebViewFinishedLoading(args: webViewModule.LoadEventData) {
|
||||
console.log("finishedLoading: " + args.url);
|
||||
backButton.isEnabled = webView.canGoBack;
|
||||
forwardButton.isEnabled = webView.canGoForward;
|
||||
reloadButton.isEnabled = true;
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
<Button text="→" col="1" tap="onForwardButtonTap" id="forwardButton"/>
|
||||
<TextField col="2" id="urlTextField" text="{{ url }}" />
|
||||
<Button text="↻" col="3" tap="onReloadButtonTap" id="reloadButton"/>
|
||||
<WebView colSpan="4" row="2" id="webView" finished="onWebViewFinished" url="{{ url }}"/>
|
||||
<WebView colSpan="4" row="2" id="webView" finishedLoading="onWebViewFinishedLoading" startedLoading="onWebViewStartedLoading" url="{{ url }}"/>
|
||||
</GridLayout>
|
||||
</Page>
|
||||
Reference in New Issue
Block a user