How to use the @loki/core.NativeError function in @loki/core

To help you get started, we’ve selected a few @loki/core 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 oblador / loki / packages / target-native-core / src / create-message-queue.js View on Github external
const receiveMessage = (type, args) => {
    const isError = type === nativeErrorType;
    for (let i = 0; i < queue.length; i++) {
      const item = queue[i];
      if (
        (isError || item.type === type) &&
        (!item.condition || item.condition(...args))
      ) {
        if (isError) {
          const { error, isFatal } = args[0];
          item.reject(new NativeError(error.message, error.stack, isFatal));
        } else {
          item.resolve(args[0]);
        }
        queue.splice(i, 1);
        break;
      }
    }
  };