floating-live 0.14.5 → 0.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "type": "commonjs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,3 @@
1
- import { FloatingLive } from "../../src/index";
2
- declare const _default: () => {
3
- name: string;
4
- register: (ctx: FloatingLive) => void;
5
- };
6
- export = _default;
1
+ import { FloatingLivePlugin } from "../../src/types";
2
+ declare const acfun: FloatingLivePlugin;
3
+ export = acfun;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  const acfunLive_1 = __importDefault(require("./acfunLive"));
6
- module.exports = () => {
6
+ const acfun = () => {
7
7
  return {
8
8
  name: "acfun",
9
9
  register: (ctx) => {
@@ -13,3 +13,4 @@ module.exports = () => {
13
13
  },
14
14
  };
15
15
  };
16
+ module.exports = acfun;
@@ -1,6 +1,6 @@
1
1
  import { FloatingLive } from "../..";
2
- declare const _default: () => {
2
+ declare const bilibili: () => {
3
3
  name: string;
4
4
  register: (ctx: FloatingLive) => void;
5
5
  };
6
- export = _default;
6
+ export = bilibili;
@@ -3,6 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  const room_1 = __importDefault(require("./room"));
6
+ const bilibili = () => {
7
+ return {
8
+ name: "bilibili",
9
+ register: (ctx) => {
10
+ ctx.room.generator.register("bilibili", (id, open, config) => {
11
+ return new room_1.default(Number(id), open, config);
12
+ });
13
+ ctx.auth.options.register("bilibili", authConfig);
14
+ },
15
+ };
16
+ };
6
17
  const authConfig = {
7
18
  info: "由于b站弹幕接口限制,在未登录账号的情况下,返回的弹幕用户名会变为星号且无法获取到uid。\n详见(github:simon300000/bilibili-live-ws#397)[https://github.com/simon300000/bilibili-live-ws/issues/397]",
8
19
  auth: {
@@ -14,14 +25,4 @@ const authConfig = {
14
25
  },
15
26
  // verify: { name: "key", type: "string" },
16
27
  };
17
- module.exports = () => {
18
- return {
19
- name: "bilibili",
20
- register: (ctx) => {
21
- ctx.room.generator.register("bilibili", (id, open, config) => {
22
- return new room_1.default(Number(id), open, config);
23
- });
24
- ctx.auth.options.register("bilibili", authConfig);
25
- },
26
- };
27
- };
28
+ module.exports = bilibili;
@@ -14,7 +14,7 @@ export declare class ModPlugin<T extends FloatingLive> {
14
14
  /** 访问插件操作对象 */
15
15
  access(name: string): object | undefined;
16
16
  /** 注册插件 */
17
- register(pluginFunc: FloatingLivePlugin<T>, pluginConfig?: object): object | undefined;
17
+ register<C extends object, E extends void | object>(pluginFunc: FloatingLivePlugin<C, E>, pluginConfig?: C): {} | undefined;
18
18
  /** 移除插件 */
19
19
  unregister(name: string): void;
20
20
  }
@@ -1,8 +1,8 @@
1
1
  import { FloatingLive } from "..";
2
2
  /** 插件模块, 加载时调用 */
3
- export declare type FloatingLivePlugin<T extends FloatingLive> = () => {
3
+ export declare type FloatingLivePlugin<C extends object = object, E extends object | void = object | void> = () => {
4
4
  /** 插件名称 */
5
5
  name: string;
6
- register: (ctx: T, config?: object) => object | void;
7
- destroy?: (ctx: T) => void;
6
+ register: (ctx: FloatingLive, config?: C) => E;
7
+ destroy?: (ctx: FloatingLive) => void;
8
8
  };