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

View file

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

View file

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

View file

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