# @link-intersystems/console-proxy-dom

> DOM extension for the @link-intersystems/console-proxy lib.

Latest version **1.1.1** (published 2021-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @link-intersystems/console-proxy-dom
pnpm add @link-intersystems/console-proxy-dom
yarn add @link-intersystems/console-proxy-dom
bun add @link-intersystems/console-proxy-dom
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-11-02 |
| First published | 2021-10-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 44.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | rene.link |
| Keywords | console, proxy, redirect, dom |

## Links

- npm: https://www.npmjs.com/package/@link-intersystems/console-proxy-dom
- Repository: https://github.com/link-intersystems/console-proxy-dom
- Homepage: https://github.com/link-intersystems/console-proxy-dom#readme
- Issues: https://github.com/link-intersystems/console-proxy-dom/issues
- npm.io page: https://npm.io/package/@link-intersystems/console-proxy-dom

## Dependencies (1)

- [@link-intersystems/console-proxy](https://npm.io/package/@link-intersystems/console-proxy.md) ^1.0.1

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2021-11-02
- 1.1.0 — 2021-10-22
- 1.0.1 — 2021-10-22

## README

# Console Proxy Dom Library

![GitHub Workflow Status](https://img.shields.io/github/workflow/status/link-intersystems/console-proxy-dom/Node.js%20CI)
![Coveralls](https://img.shields.io/coveralls/github/link-intersystems/console-proxy-dom)
![GitHub issues](https://img.shields.io/github/issues-raw/link-intersystems/console-proxy-dom)
[![GitHub](https://img.shields.io/github/license/link-intersystems/console-proxy-dom?label=license)](LICENSE.md)

An extension library for [@link-intersystems/console-proxy](https://github.com/link-intersystems/console-proxy) that contains utilities to redirect console logs to dom elements, e.g. a textarea.

## Install

     npm i "@link-intersystems/console-proxy-dom"

## Use

    import {
        createConsoleProxy,
        createConsoleTemplate,
    } from "@link-intersystems/console-proxy";
    import {
        valueLogConfig,
        defaultLogConfig
    } from "@link-intersystems/console-proxy-dom";

    const consoleProxy = createConsoleProxy();

    const domConsoleLogInterceptor = createDOMConsoleLogInterceptor();
    domConsoleLogInterceptor.setLogTargetSelector("#console"); // the default

    // The defaultLogConfig redirects logs by appending them to the target's innerHtml.
    domConsoleLogInterceptor.setLogConfig(defaultLogConfig); // the default
    
    // The valueLogConfig redirects logs by appending them to the target's value property.
    // E.g. can be used for textareas.
    // domConsoleLogInterceptor.setLogConfig(valueLogConfig);

    consoleProxy.setInterceptor(domConsoleLogInterceptor);

    // will be redirected to the dom element selected by the target css selector.
    consoleProxy.info("INFO", "Hello", "World");
    consoleProxy.debug("DEBUG", "Hellow", "World");     

E.g. a div target

    <div class="container">
        <div class="mb-3">
            <label for="console" class="form-label">Console div</label>
            <div data-testid="consoleOutput" class="form-control" id="console" style="height:8em; overflow: scroll;"></div>
        </div>
    </div>

## Live Demo at codepen.io

See [@link-intersystems/console-proxy-dom](https://codepen.io/rene-link/pen/gOxLvgO)

---
_Source: https://npm.io/package/@link-intersystems/console-proxy-dom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
