sebi2k1 / node-can

NodeJS SocketCAN extension
215 stars 72 forks source link

Improve typescript documentation/support #112

Closed Kheirlb closed 9 months ago

Kheirlb commented 1 year ago

Hello! Really excited to see the folks here merge in some typescript support! I'm having trouble getting started though and I was wondering if someone can take a pass at updating the documentation? Thanks!

For example, it would be nice to have something as simple as below in the README. I can create the PR if that is helpful.

import { createRawChannel, Message } from "socketcan";

const channel = createRawChannel("vcan0", true);

// Log any message
channel.addListener("onMessage", function(msg: Message) { console.log(msg); });

// Reply any message
channel.addListener("onMessage", channel.send, channel);

channel.start();
sebi2k1 commented 1 year ago

Hey! That's a great idea and I'd appreciate a PR. Thanks.

jbcpollak commented 1 year ago

Here's a sample project I just drafted, I hope its a good starting point:

https://github.com/arcmotive/scutils-ts