import files to git
This commit is contained in:
		
							
								
								
									
										46
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								README.md
									
									
									
									
									
								
							@@ -1,3 +1,47 @@
 | 
			
		||||
# fedwave-chat-client
 | 
			
		||||
Basic API client for [fedwave] chat. Provides minimal functionality.
 | 
			
		||||
 | 
			
		||||
Typescript client for Fedwave-compatible chat servers
 | 
			
		||||
Install with:
 | 
			
		||||
```bash
 | 
			
		||||
npm install fedwave-chat-client
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
----
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
import { FedwaveChat } from 'fedwave-chat-client';
 | 
			
		||||
 | 
			
		||||
const fedwaveChat = new FedwaveChat();
 | 
			
		||||
 | 
			
		||||
/* NOTE: These are the default implementations */
 | 
			
		||||
 | 
			
		||||
// 'ms' is an array of message objects delivered by the server
 | 
			
		||||
fedwaveChat.rcvMessageBulk = ms => {
 | 
			
		||||
  for( const m of ms ) {
 | 
			
		||||
    console.log( m.message );
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Global chat setting
 | 
			
		||||
fedwaveChat.global = true;
 | 
			
		||||
 | 
			
		||||
// Connects to chat, to the specified room, with the token
 | 
			
		||||
// Note: the token cannot be changed after init()
 | 
			
		||||
fedwaveChat.connect( 'myroom', 'chat-token', 'fedwavechatserverurl' );
 | 
			
		||||
 | 
			
		||||
fedwaveChat.sendMessage( 'Hello, world!' );
 | 
			
		||||
fedwaveChat.room = 'global';
 | 
			
		||||
fedwaveChat.sendMessage( 'Hi, global' );
 | 
			
		||||
 | 
			
		||||
fedwaveChat.sendMessage({
 | 
			
		||||
  message: 'Hello, all',
 | 
			
		||||
  channel: 'markpugner',
 | 
			
		||||
  global: false,
 | 
			
		||||
  showBadge: true
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The API is unstable because Fedwave itself is unstable. `src/api.ts` is entirely
 | 
			
		||||
JSDoc annotated, so go there for documentation.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10568
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										10568
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										43
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "fedwave-chat-client",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "description": "Basic API client for a [fedwave] chat server",
 | 
			
		||||
  "repository": "github:bitwave-tv/chat-client",
 | 
			
		||||
  "author": "dvdrw",
 | 
			
		||||
  "license": "LGPL-2.0",
 | 
			
		||||
  "types": "dist/index.d.ts",
 | 
			
		||||
  "source": "src/index.ts",
 | 
			
		||||
  "main": "dist/index.js",
 | 
			
		||||
  "unpkg": "dist/index.umd.js",
 | 
			
		||||
  "module": "dist/index.mjs",
 | 
			
		||||
  "exports": {
 | 
			
		||||
    ".": {
 | 
			
		||||
      "require": "./dist/index.js",
 | 
			
		||||
      "default": "./dist/index.mjs"
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "src",
 | 
			
		||||
    "dist",
 | 
			
		||||
    "LICENSE"
 | 
			
		||||
  ],
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "build": "microbundle --compress=false"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "api",
 | 
			
		||||
    "websocket",
 | 
			
		||||
    "socketio",
 | 
			
		||||
    "bitwave",
 | 
			
		||||
    "chat",
 | 
			
		||||
    "client"
 | 
			
		||||
  ],
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "socket.io-client": "^3.1.3"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/node": "^14.0.22",
 | 
			
		||||
    "microbundle": "^0.15.1",
 | 
			
		||||
    "typescript": "^4.7.4"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "module": "es2020",
 | 
			
		||||
    "lib": ["es2015", "es2020", "dom"],
 | 
			
		||||
    "target": "es6",
 | 
			
		||||
    "moduleResolution": "node",
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "sourceMap": true,
 | 
			
		||||
    "outDir": "build",
 | 
			
		||||
    "sourceRoot": "src"
 | 
			
		||||
  },
 | 
			
		||||
  "exclude": ["node_modules", "build"]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								tsfmt.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								tsfmt.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "indentSize": 4,
 | 
			
		||||
  "tabSize": 4,
 | 
			
		||||
  "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
 | 
			
		||||
  "placeOpenBraceOnNewLineForFunctions": false,
 | 
			
		||||
  "placeOpenBraceOnNewLineForControlBlocks": false
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user