Skip to content

Commit

Permalink
chore(docs): generate types and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Apr 27, 2024
1 parent cb75cab commit 5e50a1d
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 31 deletions.
48 changes: 27 additions & 21 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1604,12 +1604,12 @@ Watch for changes at `path` calling `callback`
import { send } from 'socket:ipc'
```
## [`maybeMakeError()`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L270)
## [`maybeMakeError()`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L271)
This is a `FunctionDeclaration` named `maybeMakeError` in `api/ipc.js`, it's exported but undocumented.
## [`emit(name, value, target, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1141)
## [`emit(name, value, target, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1142)
Emit event to be dispatched on `window` object.
Expand All @@ -1620,7 +1620,7 @@ Emit event to be dispatched on `window` object.
| target | EventTarget | window | true | |
| options | Object | | true | |
## [`send(command, value, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1200)
## [`send(command, value, options)`](https://github.com/socketsupply/socket/blob/master/api/ipc.js#L1201)
Sends an async IPC command request with parameters.
Expand Down Expand Up @@ -2018,20 +2018,25 @@ Converts this `Path` instance to a string.
This is a `ClassDeclaration` named ``ProcessEnvironmentEvent` (extends `Event`)` in `api/process.js`, it's exported but undocumented.


## [env](https://github.com/socketsupply/socket/blob/master/api/process.js#L29)
## [`ProcessEnvironment` (extends `EventTarget`)](https://github.com/socketsupply/socket/blob/master/api/process.js#L29)

This is a `ClassDeclaration` named ``ProcessEnvironment` (extends `EventTarget`)` in `api/process.js`, it's exported but undocumented.


## [env](https://github.com/socketsupply/socket/blob/master/api/process.js#L34)

This is a `VariableDeclaration` named `env` in `api/process.js`, it's exported but undocumented.


## [`nextTick(callback)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L190)
## [`nextTick(callback)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L197)

Adds callback to the 'nextTick' queue.

| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| callback | Function | | false | |

## [`hrtime(time)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L221)
## [`hrtime(time)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L228)

Computed high resolution time as a `BigInt`.

Expand All @@ -2043,15 +2048,15 @@ Computed high resolution time as a `BigInt`.
| :--- | :--- | :--- |
| Not specified | bigint | |

## [`exit(code)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L247)
## [`exit(code)`](https://github.com/socketsupply/socket/blob/master/api/process.js#L254)



| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| code | number | 0 | true | The exit code. Default: 0. |

## [`memoryUsage()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L259)
## [`memoryUsage()`](https://github.com/socketsupply/socket/blob/master/api/process.js#L266)

Returns an object describing the memory usage of the Node.js process measured in bytes.

Expand Down Expand Up @@ -2868,31 +2873,32 @@ Post a message to a window
| :--- | :--- | :--- |
| Not specified | Promise | |
### [`openExternal(options)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L413)
### [`openExternal(value)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L414)
Opens an URL in the default browser.
Opens an URL in the default application associated with the URL protocol,
such as 'https:' for the default web browser.
| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| options | object | | false | |
| value | string | | false | |
| Return Value | Type | Description |
| :--- | :--- | :--- |
| Not specified | Promise<ipc.Result> | |
| Not specified | Promise<{ url: string | >} |
### [`revealFile(options)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L422)
### [`revealFile(value)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L429)
Opens a file in the default file explorer.
| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| options | object | | false | |
| value | string | | false | |
| Return Value | Type | Description |
| :--- | :--- | :--- |
| Not specified | Promise<ipc.Result> | |
| Not specified | Promise | |
### [`addListener(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L433)
### [`addListener(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L444)
Adds a listener to the window.
Expand All @@ -2901,7 +2907,7 @@ Adds a listener to the window.
| event | string | | false | the event to listen to |
| cb | function(*): void | | false | the callback to call |
### [`on(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L451)
### [`on(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L462)
Adds a listener to the window. An alias for `addListener`.
Expand All @@ -2910,7 +2916,7 @@ Adds a listener to the window. An alias for `addListener`.
| event | string | | false | the event to listen to |
| cb | function(*): void | | false | the callback to call |
### [`once(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L468)
### [`once(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L479)
Adds a listener to the window. The listener is removed after the first call.
Expand All @@ -2919,7 +2925,7 @@ Adds a listener to the window. The listener is removed after the first call.
| event | string | | false | the event to listen to |
| cb | function(*): void | | false | the callback to call |
### [`removeListener(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L484)
### [`removeListener(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L495)
Removes a listener from the window.
Expand All @@ -2928,15 +2934,15 @@ Removes a listener from the window.
| event | string | | false | the event to remove the listener from |
| cb | function(*): void | | false | the callback to remove |
### [`removeAllListeners(event)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L497)
### [`removeAllListeners(event)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L508)
Removes all listeners from the window.
| Argument | Type | Default | Optional | Description |
| :--- | :--- | :---: | :---: | :--- |
| event | string | | false | the event to remove the listeners from |
### [`off(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L513)
### [`off(event, cb)`](https://github.com/socketsupply/socket/blob/master/api/window.js#L524)
Removes a listener from the window. An alias for `removeListener`.
Expand Down
51 changes: 41 additions & 10 deletions api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ declare module "socket:internal/symbols" {

declare module "socket:gc" {
/**
* Track `object` ref to call `Symbol.for('socket.gc.finalize')` method when
* Track `object` ref to call `Symbol.for('socket.runtime.gc.finalize')` method when
* environment garbage collects object.
* @param {object} object
* @return {boolean}
Expand Down Expand Up @@ -2362,6 +2362,9 @@ declare module "socket:process" {
key: any;
value: any;
}
export class ProcessEnvironment extends EventTarget {
get [Symbol.toStringTag](): string;
}
export const env: any;
export default process;
const process: any;
Expand Down Expand Up @@ -4734,11 +4737,13 @@ declare module "socket:ipc" {
[k: string]: string;
};
}
const Message_base: any;
/**
* A container for a IPC message based on a `ipc://` URI scheme.
* @ignore
*/
export class Message extends URL {
export class Message extends Message_base {
[x: string]: any;
/**
* The expected protocol for an IPC message.
* @ignore
Expand Down Expand Up @@ -4844,7 +4849,7 @@ declare module "socket:ipc" {
* @param {any} value
* @ignore
*/
set(key: string, value: any): void;
set(key: string, value: any): any;
/**
* Get a parameter value by `key`.
* @param {string} key
Expand Down Expand Up @@ -4975,6 +4980,7 @@ declare module "socket:ipc" {
export const primordials: any;
export default exports;
import { Buffer } from "socket:buffer";
import { URL } from "socket:url/index";
import * as exports from "socket:ipc";

}
Expand Down Expand Up @@ -6518,17 +6524,20 @@ declare module "socket:window" {
*/
postMessage(message: object): Promise<any>;
/**
* Opens an URL in the default browser.
* @param {object} options
* @returns {Promise<ipc.Result>}
* Opens an URL in the default application associated with the URL protocol,
* such as 'https:' for the default web browser.
* @param {string} value
* @returns {Promise<{ url: string }>}
*/
openExternal(options: object): Promise<ipc.Result>;
openExternal(value: string): Promise<{
url: string;
}>;
/**
* Opens a file in the default file explorer.
* @param {object} options
* @returns {Promise<ipc.Result>}
* @param {string} value
* @returns {Promise}
*/
revealFile(options: object): Promise<ipc.Result>;
revealFile(value: string): Promise<any>;
/**
* Adds a listener to the window.
* @param {string} event - the event to listen to
Expand Down Expand Up @@ -13199,6 +13208,28 @@ declare module "socket:test/index" {
export namespace test {
export { only };
export { skip };
export function linux(name: any, fn: any): void;
export function windows(name: any, fn: any): void;
export function win32(name: any, fn: any): void;
export function unix(name: any, fn: any): void;
export function macosx(name: any, fn: any): void;
export function macos(name: any, fn: any): void;
export function mac(name: any, fn: any): void;
export function darwin(name: any, fn: any): void;
export function iphone(name: any, fn: any): void;
export namespace iphone {
function simulator(name: any, fn: any): void;
}
export function ios(name: any, fn: any): void;
export namespace ios {
function simulator(name: any, fn: any): void;
}
export function android(name: any, fn: any): void;
export namespace android {
function emulator(name: any, fn: any): void;
}
export function desktop(name: any, fn: any): void;
export function mobile(name: any, fn: any): void;
}
/**
* @typedef {(t: Test) => (void | Promise<void>)} TestFn
Expand Down

0 comments on commit 5e50a1d

Please sign in to comment.