cocoonJS.3.0.0.d.ts 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. interface Navigator {
  2. /** http://stackoverflow.com/questions/13641692/how-to-use-getusermedia-from-typesecript */
  3. isCocoonJS : boolean;
  4. }
  5. declare module Cocoon {
  6. class Ad{
  7. public hideBanner() : void;
  8. public loadBanner() : void;
  9. public loadInterstitial() : void;
  10. public setBannerLayout(bannerLayout : string) : void; // problem example wrong
  11. public showBanner() : void;
  12. public showInterstitial() : void;
  13. public on(event : string, callback: () => void) : void;
  14. public static TOP_CENTER : string;
  15. public static BOTTOM_CENTER : string;
  16. }
  17. class App{
  18. public exit() : void;
  19. public exitCallback(callback: () => boolean) : void;
  20. public forward(code : string) : void;
  21. public forwardAsync(javaScriptCode : string, callback: () => void) : void;
  22. public hideTheWebView() :void;
  23. public load(path : string, storageType : Cocoon.App.StorageType) : void;
  24. public loadInTheWebView(path : string, cb : Array<() => void>, storageType : Cocoon.App.StorageType) : void;
  25. public openURL(url : string) : void;
  26. public pause() : void;
  27. public reload() : void;
  28. public reloadWebView() : void;
  29. public resume() : void;
  30. public showTheWebView(x : number, y : number, width : number, height : number) : void;
  31. public on(event : string, callback: () => void) : void;
  32. }
  33. class Camera{
  34. public getAllCamerasInfo() : Array<Cocoon.Camera.CameraInfo>;
  35. public getCameraInfoByIndex(cameraIndex : number) : Cocoon.Camera.CameraInfo;
  36. public getNumberOfCameras() : number;
  37. public isCapturing(cameraIndex : number) : boolean;
  38. public start(params : any) : any; // not sure what params is, example does not help
  39. public stop(cameraIndex : number) : void;
  40. }
  41. class Device{
  42. public autoLock(enabled : boolean)
  43. public getDeviceId() : string;
  44. public getDeviceInfo() : Cocoon.Device.DeviceInfo;
  45. public getOrientation() : number;
  46. public setOrientation(preferredOrientation : number) : void;
  47. }
  48. class Dialog{
  49. public confirm(params, callback : (boolean) => void) : void;
  50. public prompt(param, callbacks)
  51. }
  52. class Motion{
  53. public getAccelerometerInterval() : number;
  54. public getGyroscopeInterval() : number;
  55. public setAccelerometerInterval(seconds : number) : void;
  56. public setGyroscopeInterval(seconds : number) : void;
  57. }
  58. class Multiplayer{
  59. // public
  60. }
  61. class Notification{
  62. // public
  63. }
  64. class Proxify{
  65. public static audio() : void;
  66. public static console() : void;
  67. public static deproxifyConsole() : void;
  68. public static xhr() : void;
  69. }
  70. class Social{
  71. // public
  72. }
  73. class Store{
  74. // public
  75. }
  76. class Touch{
  77. public static disable() : void;
  78. public static disableInWebView() : void;
  79. public static enable() : void;
  80. public static enableInWebView() : void;
  81. }
  82. class Utils{
  83. public captureScreen(fileName : string, storageType? : Cocoon.App.StorageType, captureType? : Cocoon.Utils.CaptureType) : string;
  84. public captureScreenAsync(fileName : string, storageType? : Cocoon.App.StorageType, captureType? : Cocoon.Utils.CaptureType, callback? : () => void) : void;
  85. public existsPath(path : string, storageType? : Cocoon.App.StorageType) : boolean;
  86. public logMemoryInfo() : void;
  87. public markAsMusic(filePath : string) : void;
  88. public setAntialias(antialias : boolean) : void;
  89. public setTextCacheSize(size : number) : void;
  90. public setTextureReduction(sizeThreshold : number, applyTo? : any, forbidFor? : any) : void;
  91. }
  92. class WebView{
  93. public hide() : void;
  94. public show(x? : number, y? : number, width? : number, height? : number) : void;
  95. }
  96. }
  97. declare module Cocoon.App{
  98. class StorageType{
  99. public static PORTRAIT : string; // ????
  100. public static INTERNAL_STORAGE : string;
  101. public static EXTERNAL_STORAGE : string;
  102. public static TEMPORARY_STORAGE : string;
  103. }
  104. }
  105. declare module Cocoon.Camera{
  106. class CameraInfo{
  107. public cameraIndex : number;
  108. // public supportedVideoSizes : Array<Cocoon.Size>; // !!!!!!!!!!!!!!!!!!!!!!!!!!! could not find Cocoon.Size
  109. public supportedVideoFrameRates: Array<number>;
  110. public supportedImageFormats : Array<Cocoon.Camera.CaptureFormatType>;
  111. }
  112. class CameraType{
  113. public static FRONT : string;
  114. public static BACK : string;
  115. }
  116. class CaptureFormatType{
  117. public static JPEG : string;
  118. public static RGB_565 : string;
  119. public static NV21 : string;
  120. public static NV16 : string;
  121. public static YUY2 : string;
  122. public static YV12 : string;
  123. public static BGRA32 : string;
  124. }
  125. }
  126. declare module Cocoon.Device{
  127. class DeviceInfo{
  128. /** The operating system name (ios, android,...). */
  129. public os : string;
  130. /** The operating system version (4.2.2, 5.0,...). */
  131. public version : string;
  132. /** The operating system screen density in dpi. */
  133. public dpi : string;
  134. /** The device manufacturer (apple, samsung, lg,...). */
  135. brand : string;
  136. /** The device model (iPhone 4S, SAMSUNG-SGH-I997, SAMSUNG-SGH-I997R, etc). */
  137. public model : string;
  138. /** The phone IMEI. Android: The phone IMEI is returned or null if the device has not telepohny. iOS: null is returned as we cannot get the IMEI in iOS, no public API available for that yet. */
  139. public imei : string;
  140. /** The platform Id. */
  141. public platformId : string;
  142. /** The Odin generated id: https://code.google.com/p/odinmobile/ */
  143. public odin : string;
  144. /** The OpenUDID generated Id: https://github.com/ylechelle/OpenUDID */
  145. public openudid : string;
  146. }
  147. class Orientations{
  148. public static PORTRAIT : string
  149. public static PORTRAIT_UPSIDE_DOWN : string;
  150. public static LANDSCAPE_LEFT : string;
  151. public static LANDSCAPE_RIGHT : string;
  152. public static LANDSCAPE : string;
  153. public static BOTH : string;
  154. }
  155. }
  156. declare module Cocoon.Dialog{
  157. class keyboardType{
  158. public static TEXT : string;
  159. public static NUMBER : string;
  160. public static PHONE : string;
  161. public static EMAIL : string;
  162. public static URL : string;
  163. }
  164. }
  165. declare module Cocoon.Multiplayer{
  166. class Match{
  167. constructor(nativeExtensionName : string, extensionName : string, matchID: number);
  168. public disconnect() : void;
  169. public getExpectedPlayerCount() : number;
  170. public getLocalPlayerID() : Cocoon.Multiplayer.PlayerInfo;
  171. public getPlayerIDs() : Array<Cocoon.Multiplayer.PlayerInfo>;
  172. public requestPlayersInfo(callback) : void;
  173. public sendData(data, playerIDs, sendMode) : boolean;
  174. public sendDataToAllPlayers(data, sendMode) : boolean
  175. }
  176. class ConnectionState{
  177. }
  178. class PlayerInfo{
  179. public userID : string;
  180. public userName : string;
  181. }
  182. class SendDataMode{
  183. public static RELIABLE : string;
  184. public static UNRELIABLE : string;
  185. }
  186. }
  187. declare module Cocoon.Utils{
  188. class CaptureType{
  189. public static EVERYTHING : string;
  190. public static COCOONJS_GL_SURFACE : string;
  191. public static JUST_SYSTEM_VIEWS : string;
  192. }
  193. }
  194. declare module Coocoon.Widget{
  195. class WebDialog{
  196. public close() : void;
  197. public eval() : void;
  198. public show(url : string, closeCallback: () => void) : void;
  199. }
  200. }