minor fixes

This commit is contained in:
Rik Berkelder 2022-03-14 02:20:52 +01:00
parent ac2b4c4a67
commit 11b1702726
4 changed files with 8 additions and 59 deletions

View file

@ -1,55 +0,0 @@
{
"env": {
"es6": true
},
"extends": ["airbnb-base", "prettier"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"allowImportExportEverywhere": true
},
"plugins": [
"prettier",
"@typescript-eslint"
],
"rules": {
"prettier/prettier": "error",
"class-methods-use-this": [
"error",
{"exceptMethods": ["requestDidStart", "willSendRequest", "willSendResponse", "errorFromResponse"]}
],
"camelcase": 0,
"no-undef": 0,
"no-new": 0,
"no-shadow": 0,
"@typescript-eslint/no-shadow": ["error", { "allow": ["err"] }],
"no-console": "off",
"no-use-before-define": "warn",
"no-constant-condition": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "warn",
"import/extensions": "off",
"class-methods-use-this": "off",
"@typescript-eslint/array-type": [2, { "default": "array" }],
"@typescript-eslint/consistent-type-definitions": [2, "interface"],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-use-before-define": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "warn",
"no-underscore-dangle": "off",
"prefer-destructuring": "off"
},
"settings": {
"import/extensions": [".js", ".ts"],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
}
}
}

View file

@ -1,6 +1,6 @@
{ {
"name": "ts-osc", "name": "ts-osc",
"version": "0.3.1", "version": "0.3.2",
"description": "Fully TypeScript-native OSC Client based on osc-min", "description": "Fully TypeScript-native OSC Client based on osc-min",
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",

View file

@ -19,7 +19,7 @@ export class OSCClient {
this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true }); this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
} }
private sendPacket(packet: Buffer): void { public sendPacket(packet: Buffer): void {
this.socket.send(packet, 0, packet.length, this.port, this.host); this.socket.send(packet, 0, packet.length, this.port, this.host);
} }

View file

@ -15,7 +15,7 @@ export declare interface OSCServer {
Emitted whenever an OSC message is received on inPort Emitted whenever an OSC message is received on inPort
@event @event
*/ */
on(event: 'message', listener: (message: ReceivedOSCMessage<OSCType>) => void): this; on(event: 'message', listener: <T extends OSCType>(message: ReceivedOSCMessage<T>) => void): this;
/** /**
Emitted when OSC client is listening on inPort Emitted when OSC client is listening on inPort
@ -52,7 +52,11 @@ export class OSCServer extends EventEmitter {
super(); super();
this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true }); this.socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
this.socket.bind(port, bindAddress); this.socket.bind({
port,
address: bindAddress,
exclusive: true,
});
this.socket.on('listening', () => { this.socket.on('listening', () => {
this.emit('listening'); this.emit('listening');