internal-ambient.d.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. declare var internalBinding: any;
  2. declare namespace NodeJS {
  3. interface FeaturesBinding {
  4. isDesktopCapturerEnabled(): boolean;
  5. isOffscreenRenderingEnabled(): boolean;
  6. isPDFViewerEnabled(): boolean;
  7. isRunAsNodeEnabled(): boolean;
  8. isFakeLocationProviderEnabled(): boolean;
  9. isViewApiEnabled(): boolean;
  10. isTtsEnabled(): boolean;
  11. isPrintingEnabled(): boolean;
  12. isPictureInPictureEnabled(): boolean;
  13. isExtensionsEnabled(): boolean;
  14. isComponentBuild(): boolean;
  15. }
  16. interface V8UtilBinding {
  17. getHiddenValue<T>(obj: any, key: string): T;
  18. setHiddenValue<T>(obj: any, key: string, value: T): void;
  19. deleteHiddenValue(obj: any, key: string): void;
  20. requestGarbageCollectionForTesting(): void;
  21. }
  22. interface Process {
  23. /**
  24. * DO NOT USE DIRECTLY, USE process.electronBinding
  25. */
  26. _linkedBinding(name: string): any;
  27. electronBinding(name: string): any;
  28. electronBinding(name: 'features'): FeaturesBinding;
  29. electronBinding(name: 'v8_util'): V8UtilBinding;
  30. electronBinding(name: 'app'): { app: Electron.App, App: Function };
  31. electronBinding(name: 'command_line'): Electron.CommandLine;
  32. electronBinding(name: 'desktop_capturer'): { createDesktopCapturer(): ElectronInternal.DesktopCapturer };
  33. log: NodeJS.WriteStream['write'];
  34. activateUvLoop(): void;
  35. // Additional events
  36. once(event: 'document-start', listener: () => any): this;
  37. once(event: 'document-end', listener: () => any): this;
  38. // Additional properties
  39. _firstFileName?: string;
  40. helperExecPath: string;
  41. }
  42. }
  43. declare module NodeJS {
  44. interface Global {
  45. require: NodeRequire;
  46. module: NodeModule;
  47. __filename: string;
  48. __dirname: string;
  49. }
  50. }
  51. interface ContextMenuItem {
  52. id: number;
  53. label: string;
  54. type: 'normal' | 'separator' | 'subMenu' | 'checkbox';
  55. checked: boolean;
  56. enabled: boolean;
  57. subItems: ContextMenuItem[];
  58. }
  59. declare interface Window {
  60. ELECTRON_DISABLE_SECURITY_WARNINGS?: boolean;
  61. ELECTRON_ENABLE_SECURITY_WARNINGS?: boolean;
  62. InspectorFrontendHost?: {
  63. showContextMenuAtPoint: (x: number, y: number, items: ContextMenuItem[]) => void
  64. };
  65. DevToolsAPI?: {
  66. contextMenuItemSelected: (id: number) => void;
  67. contextMenuCleared: () => void
  68. };
  69. UI?: {
  70. createFileSelectorElement: (callback: () => void) => HTMLSpanElement
  71. };
  72. Persistence?: {
  73. FileSystemWorkspaceBinding: {
  74. completeURL: (project: string, path: string) => string;
  75. }
  76. };
  77. ResizeObserver: ResizeObserver;
  78. }
  79. /**
  80. * The ResizeObserver interface is used to observe changes to Element's content
  81. * rect.
  82. *
  83. * It is modeled after MutationObserver and IntersectionObserver.
  84. */
  85. declare class ResizeObserver {
  86. constructor (callback: ResizeObserverCallback);
  87. /**
  88. * Adds target to the list of observed elements.
  89. */
  90. observe: (target: Element) => void;
  91. /**
  92. * Removes target from the list of observed elements.
  93. */
  94. unobserve: (target: Element) => void;
  95. /**
  96. * Clears both the observationTargets and activeTargets lists.
  97. */
  98. disconnect: () => void;
  99. }
  100. /**
  101. * This callback delivers ResizeObserver's notifications. It is invoked by a
  102. * broadcast active observations algorithm.
  103. */
  104. interface ResizeObserverCallback {
  105. (entries: ResizeObserverEntry[], observer: ResizeObserver): void;
  106. }
  107. interface ResizeObserverEntry {
  108. /**
  109. * @param target The Element whose size has changed.
  110. */
  111. new (target: Element): ResizeObserverEntry;
  112. /**
  113. * The Element whose size has changed.
  114. */
  115. readonly target: Element;
  116. /**
  117. * Element's content rect when ResizeObserverCallback is invoked.
  118. */
  119. readonly contentRect: DOMRectReadOnly;
  120. }