Releases: std4453/bilibili-danmaku-client
2.0.0 - The future is here
Overview
v2
is the new major version of bilibili-danmaku-client
, not compatible with the previous v1.x
versions, with many improvements and changes.
The README file is recommended for first-time users. For those migrating from v1.x
, see below.
Migration Guide
To migrate from v1.x
to v2.0
, the following API are facing a breaking change:
Creating a new DanmakuClient
Previously you write:
const client = new DanmakuClient({ room: 5440 });
While now you should write:
const client = new DanmakuClient(5440);
The first parameter is no longer an object, but a number describing the Live Room id.
Listening to events
Previously you write:
client.on('danmaku', ({ content, sender }) => console.log(`${sender.name}: ${content}`));
client.on('gift', ({ sender, giftName, num }) => console.log(`${sender.name} => ${giftName} * ${num}`));
While now you should write:
const onDanmaku = ({ content, sender }) => console.log(`${sender.name}: ${content}`);
const onGift = ({ sender, gift, num }) => console.log(`${sender.name} => ${gift.name} * ${num}`));
client.on('event', ({ name, content }) => {
switch (name) {
case 'danmaku': onDanmaku(content); break;
case 'gift': onGift(content); break;
}
}
That is, you must listen to event
event instead of the name of the event itself. See Wiki for details.
And you might have noticed, that the giftName
, giftId
and several other properties no longer exist in the gift
event. That is because we've further improved readability and uniformity of the events. For further docmentation, see Wiki.
Changelog
- Rewritten code completely. Now the code should be more elegant, more readable, and more robust.
- Added detailed in-code documentation for all code files.
- Added an integration test file at
test.js
. Use it as an example or an demonstration. - Added detailed documentation in project Wiki.
- Decoupled code and improved coherence.
- Added CI and automatic code review support.
- Added babel support. Now the code should be running on all ES5-compatible platforms. (under
@babel/polyfill
) - Added a bunch of Wiki pages and improve README.
- Added more tests to make the project more robust.
- Added a bunch of new transformers so that the package is more powerful.
- Fixed a great deal of bugs.
See commit history for a complete list of changes.
A few words
Now that bilibili-danmaku-client
has released its version 2.0, the development will be slowing down since no future release is planned at this time. Coming changes will only contain bug fixes, new transformers and small improvements like typo or documentation.
Github-related templates will be added soon, and users are welcome to add new issue, give PRs, leave comments, etc.. bilibili-danmaku-client
will always be there to listen to you!
1.3.1 - Busy working towards 2.0.0 release
Changelog
- Use babel v7 to transpile ES6 code to ES5
- Build for v1.3.0
Notes
Perhaps I should open a new branch...
1.3.0 - On the way to a standard open source project
Changelog
- Add tons of new transformers.
- Add README.md.
- Add README.zh-cn.md.
- Add LICENSE.
- Refractor
transformers.js
anddefinition.js
to form a module namedtransformers
. - Rename package to
bilibili-danmaku-client
and remove the@std4453
scope. - Rearrange tests.
1.2.0 - Refinements and Simplifications
Changelog (from 1.1.0)
- Replace self-written utility functions with well-tested packages like lodash.
- Make
transformers.js
more powerful and elegant & cleanup code. - Split former
transformers.js
into two files. Nowtransformers.js
only contain the definitions of the messages, whiledefinition.js
contain the utility methods and definition compiler. - Rename
test.js
totest.defitions.js
to make place for other test files. - Fix bug that cause the client to be defunctional on browsers.
- Update dependencies.
- Fix typos in message definitions.
bilibili-danmaku-client v1.1.0 update
Changelog
- Import
buffer
explicitly so that build tools like webpack can use the browser-side shim automatically. - Change
ws
dependency tox-platform-ws
to be compatible on browser side.
First stable release
Bilibili Danmaku Client v1.0.1
Get in on npm.
Install
npm install @std4453/bilibili-danmaku-client
Usage
const DanmakuClient = require('@std4453/bilibili-danmaku-client');
const client = new DanmakuClient({ room: 5440 });
client.on('danmaku', event => console.log(`${event.sender.name}: ${event.content}`));
And you've created a simple danmaku listener on room 5440!