Skip to content

chore(#4): shared composable extending#5

Merged
lukasborawski merged 8 commits intodevelopfrom
chore/issue-4-extending-composables
Jan 8, 2025
Merged

chore(#4): shared composable extending#5
lukasborawski merged 8 commits intodevelopfrom
chore/issue-4-extending-composables

Conversation

@lukasborawski
Copy link
Owner

@lukasborawski lukasborawski commented Jan 8, 2025

Closing: #4

Tasks:

  • issue connected
  • summary
  • self review
  • issue todos

Summary:

This PR provides a new feature of extending composables by additional data. Now you can pass some Ref values of any handles to shared composables along with the special addons object.

Defining within the Vue component.

<script setup lang="ts">
import { useSharedState } from '@composables/useSharedState'

const {
  sharedState: { data },
} = useSharedState({ addons: { someRef } })
</script>

Using along within the Vue composable.

export const useSharedState = useStateEffect<{ someRef: Ref }, { state: Ref }>((...args) => {
  const [options] = args
  console.log(options.addons.someRef)

  /* rest of the composable logic */

  return {
    state,
  }
})

Additionally:

  • dependencies were updated
  • old Vue demo was removed

@lukasborawski lukasborawski merged commit 5561106 into develop Jan 8, 2025
1 check passed
@lukasborawski lukasborawski deleted the chore/issue-4-extending-composables branch January 8, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant