Use async/await in more places

This commit is contained in:
James Lyne 2021-05-18 18:23:10 +01:00
parent a6ae811660
commit a3aa04c2dd
5 changed files with 112 additions and 112 deletions

View File

@ -73,8 +73,9 @@ export default defineComponent({
} }
}, },
handlePendingUpdates = () => { handlePendingUpdates = async () => {
useStore().dispatch(ActionTypes.POP_TILE_UPDATES, 10).then(updates => { const updates = await useStore().dispatch(ActionTypes.POP_TILE_UPDATES, 10);
for(const update of updates) { for(const update of updates) {
layer.updateNamedTile(update.name, update.timestamp); layer.updateNamedTile(update.name, update.timestamp);
} }
@ -85,7 +86,6 @@ export default defineComponent({
} else { } else {
updateFrame = 0; updateFrame = 0;
} }
});
}; };
watch(active, (newValue) => newValue ? enableLayer() : disableLayer()); watch(active, (newValue) => newValue ? enableLayer() : disableLayer());

View File

@ -71,11 +71,12 @@ export default defineComponent({
layers.delete(id); layers.delete(id);
}, },
handlePendingUpdates = () => { handlePendingUpdates = async () => {
useStore().dispatch(ActionTypes.POP_AREA_UPDATES, { const updates = await useStore().dispatch(ActionTypes.POP_AREA_UPDATES, {
markerSet: props.set.id, markerSet: props.set.id,
amount: 10, amount: 10,
}).then(updates => { });
const converter = getPointConverter(); const converter = getPointConverter();
for(const update of updates) { for(const update of updates) {
@ -98,7 +99,6 @@ export default defineComponent({
} else { } else {
updateFrame = 0; updateFrame = 0;
} }
});
}; };
//FIXME: Prevent unnecessary repositioning when changing worlds //FIXME: Prevent unnecessary repositioning when changing worlds

View File

@ -71,11 +71,12 @@ export default defineComponent({
layers.delete(id); layers.delete(id);
}, },
handlePendingUpdates = () => { handlePendingUpdates = async () => {
useStore().dispatch(ActionTypes.POP_CIRCLE_UPDATES, { const updates = await useStore().dispatch(ActionTypes.POP_CIRCLE_UPDATES, {
markerSet: props.set.id, markerSet: props.set.id,
amount: 10, amount: 10,
}).then(updates => { });
const converter = getPointConverter(); const converter = getPointConverter();
for(const update of updates) { for(const update of updates) {
@ -98,7 +99,6 @@ export default defineComponent({
} else { } else {
updateFrame = 0; updateFrame = 0;
} }
});
}; };
//FIXME: Prevent unnecessary repositioning when changing worlds //FIXME: Prevent unnecessary repositioning when changing worlds

View File

@ -70,11 +70,12 @@ export default defineComponent({
layers.delete(id); layers.delete(id);
}, },
handlePendingUpdates = () => { handlePendingUpdates = async () => {
useStore().dispatch(ActionTypes.POP_LINE_UPDATES, { const updates = await useStore().dispatch(ActionTypes.POP_LINE_UPDATES, {
markerSet: props.set.id, markerSet: props.set.id,
amount: 10, amount: 10,
}).then(updates => { });
const converter = getPointConverter(); const converter = getPointConverter();
for(const update of updates) { for(const update of updates) {
@ -97,7 +98,6 @@ export default defineComponent({
} else { } else {
updateFrame = 0; updateFrame = 0;
} }
});
}; };
//FIXME: Prevent unnecessary repositioning when changing worlds //FIXME: Prevent unnecessary repositioning when changing worlds

View File

@ -69,11 +69,12 @@ export default defineComponent({
layers.delete(id); layers.delete(id);
}, },
handlePendingUpdates = () => { handlePendingUpdates = async () => {
useStore().dispatch(ActionTypes.POP_MARKER_UPDATES, { const updates = await useStore().dispatch(ActionTypes.POP_MARKER_UPDATES, {
markerSet: props.set.id, markerSet: props.set.id,
amount: 10, amount: 10,
}).then(updates => { });
const projection = currentProjection.value; const projection = currentProjection.value;
for(const update of updates) { for(const update of updates) {
@ -96,7 +97,6 @@ export default defineComponent({
} else { } else {
updateFrame = 0; updateFrame = 0;
} }
});
}; };
//FIXME: Prevent unnecessary repositioning when changing worlds //FIXME: Prevent unnecessary repositioning when changing worlds