microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
TypescriptNext/typescript/lib/lib.scriptHost.d.ts
294lines · modecode
| 1 | /*! ***************************************************************************** |
| 2 | Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| 4 | this file except in compliance with the License. You may obtain a copy of the |
| 5 | License at http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | |
| 7 | THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 8 | KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED |
| 9 | WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, |
| 10 | MERCHANTABLITY OR NON-INFRINGEMENT. |
| 11 | |
| 12 | See the Apache Version 2.0 License for specific language governing permissions |
| 13 | and limitations under the License. |
| 14 | ***************************************************************************** */ |
| 15 | |
| 16 | /// <reference path="lib.core.d.ts" /> |
| 17 | |
| 18 | |
| 19 | ///////////////////////////// |
| 20 | /// Windows Script Host APIS |
| 21 | ///////////////////////////// |
| 22 | |
| 23 | |
| 24 | interface ActiveXObject { |
| 25 | new (s: string): any; |
| 26 | } |
| 27 | declare var ActiveXObject: ActiveXObject; |
| 28 | |
| 29 | interface ITextWriter { |
| 30 | Write(s: string): void; |
| 31 | WriteLine(s: string): void; |
| 32 | Close(): void; |
| 33 | } |
| 34 | |
| 35 | interface TextStreamBase { |
| 36 | /** |
| 37 | * The column number of the current character position in an input stream. |
| 38 | */ |
| 39 | Column: number; |
| 40 | |
| 41 | /** |
| 42 | * The current line number in an input stream. |
| 43 | */ |
| 44 | Line: number; |
| 45 | |
| 46 | /** |
| 47 | * Closes a text stream. |
| 48 | * It is not necessary to close standard streams; they close automatically when the process ends. If |
| 49 | * you close a standard stream, be aware that any other pointers to that standard stream become invalid. |
| 50 | */ |
| 51 | Close(): void; |
| 52 | } |
| 53 | |
| 54 | interface TextStreamWriter extends TextStreamBase { |
| 55 | /** |
| 56 | * Sends a string to an output stream. |
| 57 | */ |
| 58 | Write(s: string): void; |
| 59 | |
| 60 | /** |
| 61 | * Sends a specified number of blank lines (newline characters) to an output stream. |
| 62 | */ |
| 63 | WriteBlankLines(intLines: number): void; |
| 64 | |
| 65 | /** |
| 66 | * Sends a string followed by a newline character to an output stream. |
| 67 | */ |
| 68 | WriteLine(s: string): void; |
| 69 | } |
| 70 | |
| 71 | interface TextStreamReader extends TextStreamBase { |
| 72 | /** |
| 73 | * Returns a specified number of characters from an input stream, starting at the current pointer position. |
| 74 | * Does not return until the ENTER key is pressed. |
| 75 | * Can only be used on a stream in reading mode; causes an error in writing or appending mode. |
| 76 | */ |
| 77 | Read(characters: number): string; |
| 78 | |
| 79 | /** |
| 80 | * Returns all characters from an input stream. |
| 81 | * Can only be used on a stream in reading mode; causes an error in writing or appending mode. |
| 82 | */ |
| 83 | ReadAll(): string; |
| 84 | |
| 85 | /** |
| 86 | * Returns an entire line from an input stream. |
| 87 | * Although this method extracts the newline character, it does not add it to the returned string. |
| 88 | * Can only be used on a stream in reading mode; causes an error in writing or appending mode. |
| 89 | */ |
| 90 | ReadLine(): string; |
| 91 | |
| 92 | /** |
| 93 | * Skips a specified number of characters when reading from an input text stream. |
| 94 | * Can only be used on a stream in reading mode; causes an error in writing or appending mode. |
| 95 | * @param characters Positive number of characters to skip forward. (Backward skipping is not supported.) |
| 96 | */ |
| 97 | Skip(characters: number): void; |
| 98 | |
| 99 | /** |
| 100 | * Skips the next line when reading from an input text stream. |
| 101 | * Can only be used on a stream in reading mode, not writing or appending mode. |
| 102 | */ |
| 103 | SkipLine(): void; |
| 104 | |
| 105 | /** |
| 106 | * Indicates whether the stream pointer position is at the end of a line. |
| 107 | */ |
| 108 | AtEndOfLine: boolean; |
| 109 | |
| 110 | /** |
| 111 | * Indicates whether the stream pointer position is at the end of a stream. |
| 112 | */ |
| 113 | AtEndOfStream: boolean; |
| 114 | } |
| 115 | |
| 116 | declare var WScript: { |
| 117 | /** |
| 118 | * Outputs text to either a message box (under WScript.exe) or the command console window followed by |
| 119 | * a newline (under CScript.exe). |
| 120 | */ |
| 121 | Echo(s: any): void; |
| 122 | |
| 123 | /** |
| 124 | * Exposes the write-only error output stream for the current script. |
| 125 | * Can be accessed only while using CScript.exe. |
| 126 | */ |
| 127 | StdErr: TextStreamWriter; |
| 128 | |
| 129 | /** |
| 130 | * Exposes the write-only output stream for the current script. |
| 131 | * Can be accessed only while using CScript.exe. |
| 132 | */ |
| 133 | StdOut: TextStreamWriter; |
| 134 | Arguments: { length: number; Item(n: number): string; }; |
| 135 | |
| 136 | /** |
| 137 | * The full path of the currently running script. |
| 138 | */ |
| 139 | ScriptFullName: string; |
| 140 | |
| 141 | /** |
| 142 | * Forces the script to stop immediately, with an optional exit code. |
| 143 | */ |
| 144 | Quit(exitCode?: number): number; |
| 145 | |
| 146 | /** |
| 147 | * The Windows Script Host build version number. |
| 148 | */ |
| 149 | BuildVersion: number; |
| 150 | |
| 151 | /** |
| 152 | * Fully qualified path of the host executable. |
| 153 | */ |
| 154 | FullName: string; |
| 155 | |
| 156 | /** |
| 157 | * Gets/sets the script mode - interactive(true) or batch(false). |
| 158 | */ |
| 159 | Interactive: boolean; |
| 160 | |
| 161 | /** |
| 162 | * The name of the host executable (WScript.exe or CScript.exe). |
| 163 | */ |
| 164 | Name: string; |
| 165 | |
| 166 | /** |
| 167 | * Path of the directory containing the host executable. |
| 168 | */ |
| 169 | Path: string; |
| 170 | |
| 171 | /** |
| 172 | * The filename of the currently running script. |
| 173 | */ |
| 174 | ScriptName: string; |
| 175 | |
| 176 | /** |
| 177 | * Exposes the read-only input stream for the current script. |
| 178 | * Can be accessed only while using CScript.exe. |
| 179 | */ |
| 180 | StdIn: TextStreamReader; |
| 181 | |
| 182 | /** |
| 183 | * Windows Script Host version |
| 184 | */ |
| 185 | Version: string; |
| 186 | |
| 187 | /** |
| 188 | * Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event. |
| 189 | */ |
| 190 | ConnectObject(objEventSource: any, strPrefix: string): void; |
| 191 | |
| 192 | /** |
| 193 | * Creates a COM object. |
| 194 | * @param strProgiID |
| 195 | * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. |
| 196 | */ |
| 197 | CreateObject(strProgID: string, strPrefix?: string): any; |
| 198 | |
| 199 | /** |
| 200 | * Disconnects a COM object from its event sources. |
| 201 | */ |
| 202 | DisconnectObject(obj: any): void; |
| 203 | |
| 204 | /** |
| 205 | * Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file. |
| 206 | * @param strPathname Fully qualified path to the file containing the object persisted to disk. |
| 207 | * For objects in memory, pass a zero-length string. |
| 208 | * @param strProgID |
| 209 | * @param strPrefix Function names in the form prefix_event will be bound to this object's COM events. |
| 210 | */ |
| 211 | GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any; |
| 212 | |
| 213 | /** |
| 214 | * Suspends script execution for a specified length of time, then continues execution. |
| 215 | * @param intTime Interval (in milliseconds) to suspend script execution. |
| 216 | */ |
| 217 | Sleep(intTime: number): void; |
| 218 | }; |
| 219 | |
| 220 | /** |
| 221 | * Allows enumerating over a COM collection, which may not have indexed item access. |
| 222 | */ |
| 223 | interface Enumerator<T> { |
| 224 | /** |
| 225 | * Returns true if the current item is the last one in the collection, or the collection is empty, |
| 226 | * or the current item is undefined. |
| 227 | */ |
| 228 | atEnd(): boolean; |
| 229 | |
| 230 | /** |
| 231 | * Returns the current item in the collection |
| 232 | */ |
| 233 | item(): T; |
| 234 | |
| 235 | /** |
| 236 | * Resets the current item in the collection to the first item. If there are no items in the collection, |
| 237 | * the current item is set to undefined. |
| 238 | */ |
| 239 | moveFirst(): void; |
| 240 | |
| 241 | /** |
| 242 | * Moves the current item to the next item in the collection. If the enumerator is at the end of |
| 243 | * the collection or the collection is empty, the current item is set to undefined. |
| 244 | */ |
| 245 | moveNext(): void; |
| 246 | } |
| 247 | |
| 248 | interface EnumeratorConstructor { |
| 249 | new <T>(collection: any): Enumerator<T>; |
| 250 | new (collection: any): Enumerator<any>; |
| 251 | } |
| 252 | |
| 253 | declare var Enumerator: EnumeratorConstructor; |
| 254 | |
| 255 | /** |
| 256 | * Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions. |
| 257 | */ |
| 258 | interface VBArray<T> { |
| 259 | /** |
| 260 | * Returns the number of dimensions (1-based). |
| 261 | */ |
| 262 | dimensions(): number; |
| 263 | |
| 264 | /** |
| 265 | * Takes an index for each dimension in the array, and returns the item at the corresponding location. |
| 266 | */ |
| 267 | getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T; |
| 268 | |
| 269 | /** |
| 270 | * Returns the smallest available index for a given dimension. |
| 271 | * @param dimension 1-based dimension (defaults to 1) |
| 272 | */ |
| 273 | lbound(dimension?: number): number; |
| 274 | |
| 275 | /** |
| 276 | * Returns the largest available index for a given dimension. |
| 277 | * @param dimension 1-based dimension (defaults to 1) |
| 278 | */ |
| 279 | ubound(dimension?: number): number; |
| 280 | |
| 281 | /** |
| 282 | * Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions, |
| 283 | * each successive dimension is appended to the end of the array. |
| 284 | * Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6] |
| 285 | */ |
| 286 | toArray(): T[]; |
| 287 | } |
| 288 | |
| 289 | interface VBArrayConstructor { |
| 290 | new <T>(safeArray: any): VBArray<T>; |
| 291 | new (safeArray: any): VBArray<any>; |
| 292 | } |
| 293 | |
| 294 | declare var VBArray: VBArrayConstructor; |
| 295 | |