Renamed ambiguous "self" variables to "context"

This commit is contained in:
Joel Collins 2019-03-21 20:02:26 +00:00
parent 9ea17ce560
commit c140d92b5f
4 changed files with 16 additions and 17 deletions

View file

@ -109,9 +109,9 @@ export default {
},
delCaptureConfirm: function(tag_string) {
var self = this;
var context = this
UIkit.modal.confirm('Permanantly delete capture?').then(function() {
self.delCaptureRequest()
context.delCaptureRequest()
}, function () {
console.log('Rejected.')
});
@ -142,9 +142,9 @@ export default {
},
delTagConfirm: function(tag_string) {
var self = this;
var context = this;
UIkit.modal.confirm(`Remove tag '${tag_string}'?`).then(function() {
self.delTagRequest(tag_string)
context.delTagRequest(tag_string)
}, function () {
console.log('Rejected.')
});

View file

@ -73,11 +73,10 @@ export default {
},
recalibrateConfirm: function() {
self = this;
context = this
this.modalConfirm('Start recalibration? This may take a while, and the microscope will be locked during this time.')
.then(function() {
self.recalibrateRequest()
context.recalibrateRequest()
}, function () {
console.log('Rejected recalibration.')
})

View file

@ -29,22 +29,22 @@ export default {
mounted() {
// Attach methods to UIkit events for tab switching
var self=this;
var context = this;
// Gallery tab
UIkit.util.on('#galleryDisplayTab', 'shown', function(event, area) {
console.log("Gallery tab entered")
if (self.$store.state.settings.trackWindow == true) {
self.$root.$emit('globalTogglePreview', false)
if (context.$store.state.settings.trackWindow == true) {
context.$root.$emit('globalTogglePreview', false)
}
self.$root.$emit('globalUpdateCaptureList');
context.$root.$emit('globalUpdateCaptureList');
});
// Stream tab
UIkit.util.on('#streamDisplayTab', 'shown', function(event, area) {
console.log("Stream tab entered")
UIkit.update()
if (self.$store.state.settings.trackWindow == true) {
self.$root.$emit('globalTogglePreview', true)
if (context.$store.state.settings.trackWindow == true) {
context.$root.$emit('globalTogglePreview', true)
}
});

View file

@ -9,10 +9,10 @@ Vue.config.productionTip = false
Vue.mixin({
methods: {
modalConfirm: function(modalText) {
var self = this;
var context = this;
// Stop GPU preview to show modal
self.$root.$emit('globalTogglePreview', false)
context.$root.$emit('globalTogglePreview', false)
var showModal = function(resolve, reject) {
UIkit.modal.confirm(modalText)
@ -24,9 +24,9 @@ Vue.mixin({
.finally(function() {
// Reenable the GPU preview, if it was active before the modal
console.log("Re-enabling GPU preview")
if (self.$store.state.settings.autoGpuPreview) {
if (context.$store.state.settings.autoGpuPreview) {
console.log("Re-enabling preview")
self.$root.$emit('globalTogglePreview', true)
context.$root.$emit('globalTogglePreview', true)
}
})
}