internal-ambient.d.ts 3.1 KB

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