You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/site/content/examples/20-miscellaneous/02-immutable-data/flash.js

13 lines
216 B

import { afterUpdate } from 'svelte';
export default function flash(fn) {
afterUpdate(() => {
const span = fn();
span.style.color = 'red';
setTimeout(() => {
span.style.color = 'black';
}, 400);
});
}