Results for “Custom hooks”
Small, practical examples. Search by task or narrow things down below.
Pass values through a custom event
jQuery: trigger passes its extra argument array after the event object.
jQuery✓ Tested
Provide a fallback for an unset custom property
CSS: The second var argument supplies a value when the custom property is unavailable.
CSS✓ Tested
Reuse a CSS custom property
CSS: Learn how to reuse a CSS custom property in a complete browser example.
CSS✓ Tested
Reuse colors with custom properties
Define a CSS custom property and use it for text color.
CSS✓ Tested
Run cleanup around a custom context
Python: Use try/finally inside a contextmanager so cleanup runs even on failure.
Python✓ Tested
Validate access through a custom context hook
Validate access through a custom context hook with a small React component and explicit browser behavior.
React✓ Tested
Construct a record with named properties
PowerShell: PSCustomObject gives downstream pipeline commands meaningful property names.
PowerShell✓ Tested
Create a small pure formatting pipe
Create a small pure formatting pipe with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Raise and catch a domain-specific exception
Python: Give a validation failure its own exception type so callers can handle it narrowly.
Python✓ Tested
Start a named queue explicitly
jQuery: Named queues wait until dequeue starts them.
jQuery✓ Tested
Read stash labels without commit hashes
Git: A custom format provides predictable stash subjects.
Git✓ Tested