How to use the @shopify/app-bridge/actions.ResourcePicker.Action function in @shopify/app-bridge

To help you get started, we’ve selected a few @shopify/app-bridge 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 Shopify / polaris-react / src / components / ResourcePicker / ResourcePicker.tsx View on Github external
}

    this.appBridgeResourcePicker.unsubscribe();

    if (onSelection != null) {
      this.appBridgeResourcePicker.subscribe(
        AppBridgeResourcePicker.Action.SELECT,
        ({selection}) => {
          onSelection({selection});
        },
      );
    }

    if (onCancel != null) {
      this.appBridgeResourcePicker.subscribe(
        AppBridgeResourcePicker.Action.CANCEL,
        onCancel,
      );
    }

    if (wasOpen !== open) {
      if (open) {
        this.appBridgeResourcePicker.dispatch(
          AppBridgeResourcePicker.Action.OPEN,
        );
      } else {
        this.appBridgeResourcePicker.dispatch(
          AppBridgeResourcePicker.Action.CLOSE,
        );
      }
    }