Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

check the arrows functions in demo-vue #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions demo-vue/app/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
}
},
methods: {
enableLocationTap: function() {
geolocation.isEnabled().then(function (isEnabled) {
enableLocationTap: () => {
geolocation.isEnabled().then((isEnabled) => {
if (!isEnabled) {
geolocation.enableLocationRequest(true, true).then(() => {
console.log("User Enabled Location Service");
Expand All @@ -44,34 +44,32 @@
console.log("Unable to Enable Location", ex);
});
}
}, function (e) {
}, (e) => {
console.log("Error: " + (e.message || e));
});
},
buttonGetLocationTap: function() {
let that = this;
buttonGetLocationTap: () => {
geolocation.getCurrentLocation({
desiredAccuracy: Accuracy.high,
maximumAge: 5000,
timeout: 10000
}).then(function (loc) {
}).then((loc) => {
if (loc) {
that.locations.push(loc);
this.locations.push(loc);
}
}, function (e) {
}, (e) => {
console.log("Error: " + (e.message || e));
});
},
buttonStartTap: function() {
buttonStartTap: () => {
try {
let that = this;
this.watchIds.push(geolocation.watchLocation(
function (loc) {
(loc) => {
if (loc) {
that.locations.push(loc);
this.locations.push(loc);
}
},
function (e) {
(e) => {
console.log("Error: " + e.message);
},
{
Expand All @@ -84,14 +82,14 @@
console.log("Error: " + ex.message);
}
},
buttonStopTap: function() {
buttonStopTap: () => {
let watchId = this.watchIds.pop();
while (watchId != null) {
geolocation.clearWatch(watchId);
watchId = this.watchIds.pop();
}
},
buttonClearTap: function() {
buttonClearTap: () => {
this.locations.splice(0, this.locations.length);
}
}
Expand Down
6 changes: 4 additions & 2 deletions demo-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
"@babel/core": "~7.1.0",
"@babel/preset-env": "~7.1.0",
"babel-loader": "~8.0.0",
"eslint": "^7.15.0",
"eslint-plugin-vue": "^7.3.0",
"nativescript-dev-webpack": "^1.3.0",
"nativescript-vue-template-compiler": "~2.4.0",
"node-sass": "~4.12.0",
"vue-loader": "~15.4.0",
"typescript": "~3.4.5"
"typescript": "~3.4.5",
"vue-loader": "~15.4.0"
}
}