1.1.1 • Published 10 months ago

@treecg/connector-all v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@treecg/connector-all

Combine all implemented connectors.

Example usage

function sleep(mills: number): Promise<void> {
    return new Promise(res => setTimeout(res, mills));
}

export async function main() {
    const writerFactory = new AllWriterFactory();
    const readerFactory = new AllReaderFactory();

    const fileConfig: Typed<Config> = {
        type: "file",
        config: {
            path: "metadata.json",
            onReplace: true,
            readFirstContent: true
        }
    };

    const wsConfig: Typed<Config> = {
        type: "ws",
        config: {
            host: "localhost",
            port: 8000,
            url: "ws://localhost:8000"
        }
    };

    const configs = { data: wsConfig, metadata: fileConfig };

    const allReader = await readerFactory.buildReader(configs);

    allReader.data.data(data => console.log("Got data", data));
    allReader.metadata.data(data => console.log("Got metadata", data));

    const allWriter = await writerFactory.buildReader(configs);

    await allWriter.data.push("data");
    await sleep(500);

    await allWriter.data.push("more data");
    await sleep(500);

    await allWriter.metadata.push("metadata changed!")
    await allWriter.data.push(1);
    await sleep(500);

    await allWriter.data.push(2);
}
1.1.1

10 months ago

1.1.0

10 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

12 months ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.12

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago