definitions.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. export interface ClipboardPlugin {
  2. /**
  3. * Write a value to the clipboard (the "copy" action)
  4. *
  5. * @since 1.0.0
  6. */
  7. write(options: WriteOptions): Promise<void>;
  8. /**
  9. * Read a value from the clipboard (the "paste" action)
  10. *
  11. * @since 1.0.0
  12. */
  13. read(): Promise<ReadResult>;
  14. }
  15. /**
  16. * Represents the data to be written to the clipboard.
  17. *
  18. * @since 1.0.0
  19. */
  20. export interface WriteOptions {
  21. /**
  22. * Text value to copy.
  23. *
  24. * @since 1.0.0
  25. */
  26. string?: string;
  27. /**
  28. * Image in [Data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format to copy.
  29. *
  30. * @since 1.0.0
  31. */
  32. image?: string;
  33. /**
  34. * URL string to copy.
  35. *
  36. * @since 1.0.0
  37. */
  38. url?: string;
  39. /**
  40. * User visible label to accompany the copied data (Android Only).
  41. *
  42. * @since 1.0.0
  43. */
  44. label?: string;
  45. }
  46. /**
  47. * Represents the data read from the clipboard.
  48. *
  49. * @since 1.0.0
  50. */
  51. export interface ReadResult {
  52. /**
  53. * Data read from the clipboard.
  54. *
  55. * @since 1.0.0
  56. */
  57. value: string;
  58. /**
  59. * Type of data in the clipboard.
  60. *
  61. * @since 1.0.0
  62. */
  63. type: string;
  64. }
  65. /**
  66. * @deprecated Use `WriteOptions`.
  67. * @since 1.0.0
  68. */
  69. export declare type ClipboardWrite = WriteOptions;
  70. /**
  71. * @deprecated Use `ReadResult`.
  72. * @since 1.0.0
  73. */
  74. export declare type ClipboardReadResult = ReadResult;