Skip to content

Instantly share code, notes, and snippets.

@Kcko
Last active April 15, 2024 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kcko/21b9484fa3c78731ccfec242dbbb9c8b to your computer and use it in GitHub Desktop.
Save Kcko/21b9484fa3c78731ccfec242dbbb9c8b to your computer and use it in GitHub Desktop.
// JS
function setPreferences({ theme = 'dark', layout = 'grid' } = {}) {
console.log(`Preferences set: Theme - ${theme}, Layout - ${layout}`);
}
export function useRefHistory(ref, options) {
const {
deep = false,
capacity = Infinity,
} = options;
// ...
};
// https://michaelnthiessen.com/tips/options-object
export function useRefHistory(ref, options) {
const {
deep = false,
capacity = Infinity,
...otherOptions,
} = options;
// Pass along some options we're not using directly
useSomeOtherComposable(otherOptions);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment