Skip to content

Commit d73f1b1

Browse files
use typescript all the way
Signed-off-by: Arnav Gupta <arnav@codingblocks.com>
1 parent 91d109c commit d73f1b1

19 files changed

+758
-149
lines changed

.gitignore

+6-23
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,9 @@ typings/
6666
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
6767

6868
# User-specific stuff
69-
.idea/**/workspace.xml
70-
.idea/**/tasks.xml
71-
.idea/**/dictionaries
72-
.idea/**/shelf
73-
74-
# Sensitive or high-churn files
75-
.idea/**/dataSources/
76-
.idea/**/dataSources.ids
77-
.idea/**/dataSources.local.xml
78-
.idea/**/sqlDataSources.xml
79-
.idea/**/dynamic.xml
80-
.idea/**/uiDesigner.xml
81-
.idea/**/dbnavigator.xml
82-
83-
# Gradle
84-
.idea/**/gradle.xml
85-
.idea/**/libraries
69+
.idea/
70+
!/.idea/jsLibraryMappings.xml
71+
!/.idea/codeStyles/
8672

8773
# CMake
8874
cmake-build-debug/
@@ -115,11 +101,8 @@ fabric.properties
115101
# Editor-based Rest Client
116102
.idea/httpRequests
117103
### VisualStudioCode template
118-
.vscode/*
119-
!.vscode/settings.json
120-
!.vscode/tasks.json
121-
!.vscode/launch.json
122-
!.vscode/extensions.json
104+
.vscode/
105+
123106

124107
# Nativescript
125-
/platforms
108+
/platforms

.idea/inspectionProfiles/profiles_settings.xml

-6
This file was deleted.

.idea/misc.xml

-79
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/nativescript-sample.iml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/App.js

+19-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/App.ts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Vue from 'nativescript-vue'
2+
import Counter from './Counter'
3+
4+
class App extends Vue {
5+
surprice: boolean
6+
}
7+
export default Vue.extend<App>({
8+
data() {
9+
return {
10+
surprise: false,
11+
};
12+
},
13+
template: `
14+
<Page class="page">
15+
<ActionBar class="action-bar" title="NativeScript-Vue"/>
16+
17+
<StackLayout>
18+
<Counter />
19+
20+
<Label class="p-20" textWrap=true text="This is a hello world application, tap the button if you dare"/>
21+
22+
<Button class="btn btn-primary" @tap="surprise = !surprise" text="Tap me!"/>
23+
<Image v-if="surprise" class="m-20" src="~/images/NativeScript-Vue.png"/>
24+
</StackLayout>
25+
</Page>
26+
`,
27+
components: {
28+
Counter,
29+
},
30+
})

app/components/Counter.js

+28-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/components/Counter.ts

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Vue from 'nativescript-vue'
2+
3+
class Counter extends Vue{
4+
count: number
5+
}
6+
export default Vue.extend<Counter>({
7+
data() {
8+
return {
9+
count: 42,
10+
};
11+
},
12+
computed: {
13+
message() {
14+
return this.count > 0
15+
? `Tap tap tap! Only ${this.count} left!`
16+
: `Whoa! Slow down, we have hit the limit...`;
17+
},
18+
},
19+
template: `
20+
<StackLayout>
21+
<FlexboxLayout flexDirection="row" justifyContent="center">
22+
<Button @tap="decrement" text="-" class="btn btn-outline"/>
23+
<Label :text="count" alignSelf="baseline" class="h2"/>
24+
<Button @tap="increment" text="+" class="btn btn-outline"/>
25+
</FlexboxLayout>
26+
27+
<Label class="p-20" :text="message"/>
28+
</StackLayout>
29+
`,
30+
methods: {
31+
increment() {
32+
this.count += 1;
33+
},
34+
decrement() {
35+
this.count -= 1;
36+
},
37+
},
38+
})

app/main.js

+7-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/main.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Vue = require('nativescript-vue');
2+
import App from './components/App'
3+
4+
new Vue({
5+
render: h => h(App),
6+
}).$start();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("nativescript-dev-typescript/lib/after-watch.js");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("nativescript-dev-typescript/lib/before-prepare.js");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("nativescript-dev-typescript/lib/watch.js");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("nativescript-dev-typescript/lib/before-watchPatterns.js");

0 commit comments

Comments
 (0)