MCPcopy Create free account
hub / github.com/firebase/quickstart-js / updateStarredByCurrentUser

Function updateStarredByCurrentUser

database/scripts/main.ts:348–366  ·  view source on GitHub ↗

* Updates the starred status of the post.

(
  postElement: HTMLElement,
  starred: boolean,
)

Source from the content-addressed store, hash-verified

346 * Updates the starred status of the post.
347 */
348function updateStarredByCurrentUser(
349 postElement: HTMLElement,
350 starred: boolean,
351) {
352 const star = postElement.getElementsByClassName(
353 'starred',
354 )[0] as HTMLDivElement;
355 const unStar = postElement.getElementsByClassName(
356 'not-starred',
357 )[0] as HTMLDivElement;
358
359 if (starred) {
360 star.style.display = 'inline-block';
361 unStar.style.display = 'none';
362 } else {
363 star.style.display = 'none';
364 unStar.style.display = 'inline-block';
365 }
366}
367
368/**
369 * Updates the number of stars displayed for a post.

Callers 1

createPostElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected