mirror of
https://github.com/kevin-DL/build-gmail-clone-with-vue-3.git
synced 2026-01-20 06:15:13 +00:00
Lesson 12 - use-email-selection composable
This commit is contained in:
20
src/composables/use-email-selection.js
Normal file
20
src/composables/use-email-selection.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { reactive } from 'vue';
|
||||
|
||||
let emails = reactive(new Set())
|
||||
|
||||
export const useEmailSelection = function(){
|
||||
let toggle = function(email) {
|
||||
if(emails.has(email)) {
|
||||
emails.delete(email)
|
||||
} else {
|
||||
emails.add(email)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
emails,
|
||||
toggle
|
||||
}
|
||||
}
|
||||
|
||||
export default useEmailSelection
|
||||
Reference in New Issue
Block a user