How to use the hyperview/src/services.later 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 / index.js View on Github external
// Re-render the modifications
        this.setState({
          doc: newRoot,
        });

        // in dev mode log the updated xml for debugging purposes
        if (__DEV__) {
          console.log('Updated XML:', this.serializer.serializeToString(newRoot.documentElement));
        }

        onEnd && onEnd();
      });

    if (delay) {
      later(parseInt(delay, 10)).then(fetchPromise);
    } else {
      fetchPromise();
    }
  }
github Instawork / hyperview / src / behaviors / hv-toggle / index.js View on Github external
if (delay === 0) {
      // If there's no delay, toggle immediately without showing/hiding
      // any indicators.
      toggleElement();
    } else {
      // If there's a delay, first trigger the indicators before the toggle.
      const newRoot = Behaviors.setIndicatorsBeforeLoad(
        showIndicatorIds,
        hideIndicatorIds,
        getRoot(),
      );
      // Update the DOM to reflect the new state of the indicators.
      updateRoot(newRoot);
      // Wait for the delay then toggle the target.
      later(delay)
        .then(toggleElement)
        .catch(toggleElement);
    }
  },
};
github Instawork / hyperview / src / behaviors / hv-hide / index.js View on Github external
if (delay === 0) {
      // If there's no delay, hide target immediately without showing/hiding
      // any indicators.
      hideElement();
    } else {
      // If there's a delay, first trigger the indicators before the hide
      const newRoot = Behaviors.setIndicatorsBeforeLoad(
        showIndicatorIds,
        hideIndicatorIds,
        getRoot(),
      );
      // Update the DOM to reflect the new state of the indicators.
      updateRoot(newRoot);
      // Wait for the delay then hide the target.
      later(delay)
        .then(hideElement)
        .catch(hideElement);
    }
  },
};
github Instawork / hyperview / src / behaviors / hv-show / index.js View on Github external
if (delay === 0) {
      // If there's no delay, show target immediately without showing/hiding
      // any indicators.
      showElement();
    } else {
      // If there's a delay, first trigger the indicators before the show.
      const newRoot = Behaviors.setIndicatorsBeforeLoad(
        showIndicatorIds,
        hideIndicatorIds,
        getRoot(),
      );
      // Update the DOM to reflect the new state of the indicators.
      updateRoot(newRoot);
      // Wait for the delay then show the target.
      later(delay)
        .then(showElement)
        .catch(showElement);
    }
  },
};