index.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. declare namespace UniNamespace {
  2. /**
  3. * uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
  4. */
  5. type OnUserCaptureScreenCallbackResult = {
  6. /**
  7. * 截屏文件路径(仅Android返回)
  8. */
  9. path ?: string
  10. }
  11. /**
  12. * uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
  13. */
  14. type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
  15. type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
  16. type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
  17. /**
  18. * uni.setUserCaptureScreen成功回调参数
  19. */
  20. type SetUserCaptureScreenSuccess = {
  21. }
  22. /**
  23. * uni.setUserCaptureScreen成功回调函数定义
  24. */
  25. type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void
  26. /**
  27. * 错误码
  28. * - 12001 "setUserCaptureScreen:system not support"
  29. * - 12010 "setUserCaptureScreen:system internal error"
  30. */
  31. type SetUserCaptureScreenErrorCode = 12001 | 12010;
  32. /**
  33. * SetUserCaptureScreen 的错误回调参数
  34. */
  35. interface SetUserCaptureScreenFail {
  36. errCode : SetUserCaptureScreenErrorCode
  37. }
  38. /**
  39. * uni.setUserCaptureScreen失败回调函数定义
  40. */
  41. type SetUserCaptureScreenFailCallback = (res : SetUserCaptureScreenFail) => void
  42. /**
  43. * uni.setUserCaptureScreen完成回调函数定义
  44. */
  45. type SetUserCaptureScreenCompleteCallback = (res : any) => void
  46. /**
  47. * uni.setUserCaptureScreen参数
  48. */
  49. type SetUserCaptureScreenOptions = {
  50. /**
  51. * true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
  52. */
  53. enable : boolean;
  54. /**
  55. * 接口调用成功的回调函数
  56. */
  57. // success : SetUserCaptureScreenSuccessCallback | null,
  58. success ?: SetUserCaptureScreenSuccessCallback,
  59. /**
  60. * 接口调用失败的回调函数
  61. */
  62. // fail : SetUserCaptureScreenFailCallback | null,
  63. fail ?: SetUserCaptureScreenFailCallback,
  64. /**
  65. * 接口调用结束的回调函数(调用成功、失败都会执行)
  66. */
  67. // complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
  68. complete ?: SetUserCaptureScreenCompleteCallback
  69. }
  70. type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
  71. }
  72. declare interface Uni {
  73. /**
  74. * 开启截屏监听
  75. *
  76. * @param {UserCaptureScreenCallback} callback
  77. * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
  78. * @uniPlatform {
  79. * "app": {
  80. * "android": {
  81. * "osVer": "4.4.4",
  82. * "uniVer": "3.7.7",
  83. * "unixVer": "3.9.0"
  84. * },
  85. * "ios": {
  86. * "osVer": "9.0",
  87. * "uniVer": "3.7.7",
  88. * "unixVer": "x"
  89. * }
  90. * }
  91. * }
  92. * @uniVersion 3.7.7
  93. * @uniVueVersion 2,3 //支持的vue版本
  94. * @autotest { expectCallback: true }
  95. */
  96. onUserCaptureScreen(callback : UniNamespace.UserCaptureScreenCallback | null) : void,
  97. /**
  98. * 关闭截屏监听
  99. *
  100. * @param {UserCaptureScreenCallback} callback
  101. * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
  102. * @uniPlatform {
  103. * "app": {
  104. * "android": {
  105. * "osVer": "4.4.4",
  106. * "uniVer": "3.7.7",
  107. * "unixVer": "3.9.0"
  108. * },
  109. * "ios": {
  110. * "osVer": "9.0",
  111. * "uniVer": "3.7.7",
  112. * "unixVer": "x"
  113. * }
  114. * }
  115. * }
  116. * @uniVersion 3.7.7
  117. * @uniVueVersion 2,3 //支持的vue版本
  118. * @autotest { expectCallback: true }
  119. */
  120. offUserCaptureScreen(callback : UniNamespace.UserCaptureScreenCallback | null) : void,
  121. /**
  122. * 设置防截屏
  123. *
  124. * @param {SetUserCaptureScreenOptions} options
  125. * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
  126. * @uniPlatform {
  127. * "app": {
  128. * "android": {
  129. * "osVer": "4.4.4",
  130. * "uniVer": "3.7.7",
  131. * "unixVer": "3.9.0"
  132. * },
  133. * "ios": {
  134. * "osVer": "13.0",
  135. * "uniVer": "3.7.7",
  136. * "unixVer": "x"
  137. * }
  138. * }
  139. * }
  140. * @uniVersion 3.7.7
  141. * @uniVueVersion 2,3 //支持的vue版本
  142. */
  143. setUserCaptureScreen(options : UniNamespace.SetUserCaptureScreenOptions) : void
  144. }