-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/geolocation
- Loading branch information
Showing
59 changed files
with
2,092 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<div> | ||
<h3> | ||
Language: <b>{{ language }}</b> | ||
</h3> | ||
<div> | ||
<h4>Preferred Languages</h4> | ||
<ul> | ||
<li v-for="l in languages" :key="l"> | ||
{{ l }} | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useLanguage } from "vue-composable"; | ||
export default { | ||
setup() { | ||
return useLanguage(); | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,50 @@ | ||
<template> | ||
<div> | ||
localStorage: {{storage}} | ||
localStorage: {{ storage }} | ||
<p> | ||
<b>Check the value in the dev tools: `{{key}}`</b> | ||
supported: | ||
<b :class="{ green: supported, red: !supported }">{{ supported }}</b> | ||
</p> | ||
<p> | ||
<b>Check the value in the dev tools: `{{ key }}`</b> | ||
</p> | ||
<label for="storage"> | ||
<input name="storage" v-model="storage" /> | ||
</label> | ||
|
||
<div> | ||
<p>Enable tab sync? <input type="checkbox" v-model="tabSync" /></p> | ||
<p v-if="tabSync"> | ||
Now this tab is listening for changes, please change the storage value | ||
in other tab | ||
</p> | ||
</div> | ||
<div> | ||
<button @click="remove">Remove</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useLocalStorage } from "vue-composable"; | ||
import { ref, watch } from "@vue/composition-api"; | ||
export default { | ||
name: "local-storage-example", | ||
setup() { | ||
const key = "__vue_localStorage_example"; | ||
const { storage } = useLocalStorage(key, 1); | ||
const tabSync = ref(false); | ||
const { supported, storage, setSync, remove } = useLocalStorage(key, 1); | ||
watch(tabSync, setSync); | ||
return { | ||
key, | ||
storage | ||
supported, | ||
tabSync, | ||
storage, | ||
remove | ||
}; | ||
} | ||
}; | ||
</script> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<div> | ||
<h1>Is Online?</h1> | ||
|
||
<h3> | ||
Online: <b :class="{ green: online, red: !online }">{{ online }}</b> | ||
</h3> | ||
<h4> | ||
Supported: <b>{{ supported }}</b> | ||
</h4> | ||
|
||
<p>To test open dev tools and set your browser to offline (Network tab)</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useOnline } from "vue-composable"; | ||
export default { | ||
setup() { | ||
return useOnline(); | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<template> | ||
<div> | ||
<h4> | ||
Hidden: <b>{{ hidden }}</b> | ||
</h4> | ||
<h4> | ||
State: <b>{{ visibility }}</b> | ||
</h4> | ||
<p>You can change the state by switching tab - Check console</p> | ||
<p> | ||
<a | ||
href="https://sqa.stackexchange.com/a/32355" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
>Check this link</a | ||
> | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { usePageVisibility, unwrap } from "vue-composable"; | ||
import { watch, reactive } from "@vue/composition-api"; | ||
export default { | ||
setup() { | ||
const { visibility, hidden } = usePageVisibility(); | ||
watch(visibility, () => { | ||
console.log("visibility changed", { | ||
visibility: visibility.value, | ||
hidden: hidden.value | ||
}); | ||
}); | ||
return { visibility, hidden }; | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<div> | ||
sessionStorage: {{ storage }} | ||
<p> | ||
supported: | ||
<b :class="{ green: supported, red: !supported }">{{ supported }}</b> | ||
</p> | ||
<p> | ||
<b>Check the value in the dev tools: `{{ key }}`</b> | ||
</p> | ||
<label for="storage"> | ||
<input name="storage" v-model="storage" /> | ||
</label> | ||
|
||
<div> | ||
<button @click="remove">Remove</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useSessionStorage } from "vue-composable"; | ||
import { ref, watch } from "@vue/composition-api"; | ||
export default { | ||
name: "session-storage-example", | ||
setup() { | ||
const key = "__vue_sessionStorage_example"; | ||
const tabSync = ref(false); | ||
const { supported, storage, remove } = useSessionStorage(key, 1); | ||
return { | ||
key, | ||
supported, | ||
tabSync, | ||
storage, | ||
remove | ||
}; | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<template> | ||
<div> | ||
storage: {{ storage }} | ||
<p> | ||
supported: | ||
<b :class="{ green: supported, red: !supported }">{{ supported }}</b> | ||
</p> | ||
<p> | ||
<b>Check the value in the dev tools: `{{ key }}`</b> | ||
</p> | ||
<label for="storage"> | ||
<input name="storage" v-model="storage" /> | ||
</label> | ||
|
||
<div> | ||
<p>Sync supported: {{ supportedSync }}</p> | ||
<p>Enable tab sync? <input type="checkbox" v-model="tabSync" /></p> | ||
<p v-if="tabSync"> | ||
Now this tab is listening for changes, please change the storage value | ||
in other tab | ||
</p> | ||
</div> | ||
<div> | ||
<button @click="remove">Remove</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { useLocalStorage, useStorage } from "vue-composable"; | ||
import { ref, watch } from "@vue/composition-api"; | ||
export default { | ||
name: "storage-example", | ||
setup() { | ||
const key = "__vue_storage_example"; | ||
const tabSync = ref(false); | ||
const supportedSync = ref(true); | ||
const { supported, storage, setSync, remove } = useStorage(key, 1); | ||
watch(tabSync, s => { | ||
if (setSync(s) === false) { | ||
supportedSync.value = false; | ||
} | ||
}); | ||
return { | ||
key, | ||
supported, | ||
supportedSync, | ||
tabSync, | ||
storage, | ||
remove | ||
}; | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
.red { | ||
color: red; | ||
} | ||
.green { | ||
color: green; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.