How to use the hyperview/src/services/behaviors.setIndicatorsAfterLoad function in hyperview

To help you get started, we’ve selected a few hyperview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Instawork / hyperview / src / behaviors / hv-toggle / index.js View on Github external
const doc: Document = getRoot();
      const targetElement: ?Element = doc.getElementById(targetId);
      if (!targetElement) {
        return;
      }

      // Toggle the hide attribute of the target
      const isCurrentlyHidden: boolean =
        targetElement.getAttribute('hide') === 'true';
      const newToggleState: string = isCurrentlyHidden ? 'false' : 'true';
      targetElement.setAttribute('hide', newToggleState);
      let newRoot: Document = shallowCloneToRoot(targetElement);

      // If using the delay, we need to undo the indicators shown earlier.
      if (delay > 0) {
        newRoot = Behaviors.setIndicatorsAfterLoad(
          showIndicatorIds,
          hideIndicatorIds,
          newRoot,
        );
      }
      // Update the DOM with the new toggle state and finished indicators.
      updateRoot(newRoot);
    };
github Instawork / hyperview / src / behaviors / hv-show / index.js View on Github external
const showElement = () => {
      const doc: Document = getRoot();
      const targetElement: ?Element = doc.getElementById(targetId);
      if (!targetElement) {
        return;
      }

      // Show the target
      targetElement.setAttribute('hide', 'false');
      let newRoot: Document = shallowCloneToRoot(targetElement);

      // If using delay, we need to undo the indicators shown earlier.
      if (delay > 0) {
        newRoot = Behaviors.setIndicatorsAfterLoad(
          showIndicatorIds,
          hideIndicatorIds,
          newRoot,
        );
      }
      // Update the DOM with the new shown state and finished indicators.
      updateRoot(newRoot);
    };
github Instawork / hyperview / src / behaviors / hv-hide / index.js View on Github external
const hideElement = () => {
      const doc: Document = getRoot();
      const targetElement: ?Element = doc.getElementById(targetId);
      if (!targetElement) {
        return;
      }

      // Hide the target
      targetElement.setAttribute('hide', 'true');
      let newRoot: Document = shallowCloneToRoot(targetElement);

      // If using delay, we need to undo the indicators shown earlier.
      if (delay > 0) {
        newRoot = Behaviors.setIndicatorsAfterLoad(
          showIndicatorIds,
          hideIndicatorIds,
          newRoot,
        );
      }
      // Update the DOM with the new hidden state and finished indicators.
      updateRoot(newRoot);
    };