async function makeUserAction(fn: Function): Promise<void> { LoadingService.startLoading(); await fn(); LoadingService.stopLoading(); UserGrid.reloadData(); } async function createUser2(user: User): Promise<void> { makeUserAction(() => userHttpClient.createUser(user)); } async function updateUser2(user: User): Promise<void> { makeUserAction(() => userHttpClient.updateUser(user)); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter