wechaty handling in plain ES6 classes sample
Created by: suntong
Just a simple noob request,
Can someone provide me with a simple example that handles wechaty in plain ES6 classes please?
The reason I'm asking is that,
- I understand that wechaty was initially developed long before ES6 is mature enough to be used, however,
- Looking at the ES6 support in Node.js, I can see really really few ES6 features are unsupported now. I.e., only very few extreme end-cases are left.
- moreover, I don't know how well the transpiling is, e.g., for the advanced ES6 features like
map
,filter
andreduce
, I don't know how efficient the transpiled code is. - Starting with version 8.5.0, Node.js supports ES modules natively, so we can do
import {add} from './lib.mjs';
directly in ES6 now. - I.e., the ES6 is ready for prime time use, writing in TypeScript then have it transpiled into ES6 code seems like a redundant step now. (I'm not saying that TypeScript is not helpful, it is still good in big projects that you have some dummies really easily to shoot their own feet)
- I'm a long time programmer but never did JavaScript programming before, so it'll be a challenge for me to put all these puzzles together, Node.js, ES6 class that handles wechaty the OO way, etc, etc.
- Just FTA, I'm planning to contribute my code that logs weixin charts as html files back to the wechaty community, so your help is not in vain. I've long been planning write a tool to do that, however, the platform that I initially chose was so unstable that I have to look for something else, and start a brand new journey to learn and use JavaScript/TypeScript.
Let me know if you could help, so that I can elaborate more on what I have in mind (but still should be very simple for JavaScript programmers).
Thanks for helping!