Skip to content

Commit

Permalink
Add Cloud Storage example
Browse files Browse the repository at this point in the history
  • Loading branch information
MBoretto committed Sep 25, 2023
1 parent 43e2bfc commit 9bfeb36
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<h3>Bot API version available</h3>
<b>version</b>: {{ TWA.version }} <br>
<b>isVersionAtLeast('6.4')</b>: {{ TWA.isVersionAtLeast('6.4') }} <br>
<b>isVersionAtLeast('6.9')</b>: {{ TWA.isVersionAtLeast('6.9') }} <br>

<h3>Haptic Feedback</h3>
<select v-model="style_selected">
Expand Down Expand Up @@ -78,6 +78,17 @@
<button @click="showPopup()">Show Popup message</button><br>
<button @click="showPopup2()">Show Popup message2</button><br>
<br>
<h3>Cloud Storage</h3>

<button @click="TWA.CloudStorage.setItem(document.getElementById('key').value, document.getElementById('value').value)">Set key</button><br>

<div v-for="key in cloud_storage_keys">
{{ key }} <br>
</div>
<br>
<input type="text" id="key" name="key" placeholder="key">
<input type="text" id="value" name="value" placeholder="value">
<button @click="TWA.CloudStorage.getKeys(this.processKeys)">Get keys</button><br>
</div>
</template>

Expand Down Expand Up @@ -105,6 +116,7 @@ export default {
return {
style_selected: 'medium',
clipboard: null,
cloud_storage_keys: null,
};
},
created() {
Expand Down Expand Up @@ -251,6 +263,13 @@ export default {
this.TWA.showPopup(par);
},
processKeys(error, data) {
if (error) {
this.TWA.showAlert(error);
return;
}
this.cloud_storage_keys = data;
}
}
}
</script>
Expand Down

0 comments on commit 9bfeb36

Please sign in to comment.