Skip to content

Commit e0e3d1a

Browse files
committed
test: demo
1 parent bda760d commit e0e3d1a

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed
Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,55 @@
11
'use strict';
22

33
function getNumber() {
4-
return 42;
4+
return 42;
55
}
66

77
function getNumberFloat() {
8-
return 3.14;
8+
return 3.14;
99
}
1010

1111
function getFalse() {
12-
return false;
12+
return false;
1313
}
1414

1515
function getTruth() {
16-
return true;
16+
return true;
1717
}
1818

1919
function getString() {
20-
return 'string result from webview JS function';
20+
return 'string result from webview JS function';
2121
}
2222

2323
function getArray() {
24-
return [1.5, true, "hello"];
24+
return [1.5, true, 'hello'];
2525
}
2626

2727
function getObject() {
28-
return {
29-
prop: "test",
30-
name: "object-test",
31-
values: [
32-
42,
33-
3.14
34-
]
35-
};
28+
return {
29+
prop: 'test',
30+
name: 'object-test',
31+
values: [42, 3.14]
32+
};
3633
}
3734

3835
function setupEventListener() {
39-
window.nsWebViewBridge.on('tns-message', function (args) {
40-
window.nsWebViewBridge.emit('web-message', args);
41-
});
36+
window.nsWebViewBridge.on('tns-message', function (args) {
37+
window.nsWebViewBridge.emit('web-message', args);
38+
});
4239
}
4340

4441
function testPromiseResolve() {
45-
return new Promise(function(resolve) {
46-
setTimeout(function() {
47-
resolve(42);
48-
}, 100);
49-
});
42+
return new Promise(function (resolve) {
43+
setTimeout(function () {
44+
resolve(42);
45+
}, 100);
46+
});
5047
}
5148

5249
function testPromiseReject() {
53-
return new Promise(function(resolve, reject) {
54-
setTimeout(function() {
55-
reject(new Error('The Cake is a Lie'));
56-
}, 100);
57-
});
58-
}
50+
return new Promise(function (resolve, reject) {
51+
setTimeout(function () {
52+
reject(new Error('The Cake is a Lie'));
53+
}, 100);
54+
});
55+
}

demo-snippets/vue/BasicExample.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export default {
9898
// } else {
9999
// webview.src = 'http://localhost:8080';
100100
// }
101-
webview.src = '~/test-data/html/javascript-calls.html';
101+
webview.registerLocalResource('local-stylesheet.css', '~/test-data/css/local-stylesheet.css');
102+
webview.src = '~/test-data/html/css-predefined-link-tags.html';
102103
103104
webview.on(AWebView.shouldOverrideUrlLoadingEvent, (args: ShouldOverrideUrlLoadEventData) => {
104105
console.log(`${args.httpMethod} ${args.url}`);

demo-snippets/vue/install.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import Vue from 'nativescript-vue';
22
import WebView from '@nativescript-community/ui-webview/vue';
3+
import {Trace} from '@nativescript/core';
34

45
import BasicExample from './BasicExample.vue';
56

67
export function installPlugin() {
8+
Trace.addCategories('NOTA');
9+
Trace.enable();
710
Vue.use(WebView);
811
}
912

0 commit comments

Comments
 (0)