watchSolanaConnection
Subscribe to changes to the solana connection for the id
Import
Usage
import { function watchSolanaConnection(config: AlchemyAccountsConfig): (onChange: (connection: SolanaConnection) => void) => () => voidSubscribe to changes to the solana connection for the id
watchSolanaConnection } from "@account-kit/core";
// see createConfig for more information on how to create a config
const const config: anyconfig = {} as any;
function watchSolanaConnection(config: AlchemyAccountsConfig): (onChange: (connection: SolanaConnection) => void) => () => voidSubscribe to changes to the solana connection for the id
watchSolanaConnection(const config: anyconfig)(var console: ConsoleThe console
module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A
Console
class with methods such as console.log()
, console.error()
and console.warn()
that can be used to write to any Node.js stream. * A global console
instance configured to write to process.stdout
and process.stderr
. The global console
can be used without importing the node:console
module.
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O
for more information.
Example using the global console
:
const name = 'Will Robinson'; console.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ```
Example using the `Console` class:
```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err);
myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson'; myConsole.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
console.Console.log(...data: any[]): void (+1 overload)log);
Parameters
config
AlchemyAccountsConfig
the account config of the connection
Returns
(onChange: (connection: Connection) => void) => (() => void)
a function which accepts an onChange callback that will be fired when the connection changes and returns a function to unsubscribe from the store