1.1.1 • Published 2 years ago

@treecg/connector-all v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

1.1.0

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago