2021-10-10 14:29:58 +02:00
|
|
|
# SocialvoidJS
|
2021-10-09 18:35:41 +02:00
|
|
|
|
2021-10-10 20:17:32 +02:00
|
|
|
> [Deno](https://deno.land), [Node.js](https://nodejs.org) and browser
|
2021-10-10 18:02:22 +02:00
|
|
|
> Socialvoid client.
|
2021-10-09 19:02:19 +02:00
|
|
|
|
2021-10-10 14:29:58 +02:00
|
|
|
## Introduction
|
|
|
|
|
2021-10-10 20:17:32 +02:00
|
|
|
SocialvoidJS is a Deno Socialvoid client which is backported to Node.js using
|
2021-10-11 12:11:54 +02:00
|
|
|
the tool [`deno2node`](https://github.com/fromdeno/deno2node). Also, it can be
|
|
|
|
bundled for browsers using the bundle command of Deno or with Webpack.
|
2021-10-10 14:29:58 +02:00
|
|
|
|
2021-10-10 14:30:53 +02:00
|
|
|
### Features
|
|
|
|
|
2021-10-10 18:02:22 +02:00
|
|
|
- Everything works on Node.js, Deno and browsers
|
|
|
|
([2 ways](#bundling-for-browsers)).
|
2021-10-10 14:30:53 +02:00
|
|
|
- Multiple ways to store session and other data: MemoryStore, FileStore,
|
|
|
|
LocalStorageStore and the ones you define!
|
2021-10-11 12:11:23 +02:00
|
|
|
- Typings for Socialvoid types.
|
2021-10-11 12:11:54 +02:00
|
|
|
- Most thrown errors can be used with `instanceof`.
|
2021-10-10 14:30:53 +02:00
|
|
|
- CDN upload and download support.
|
2021-10-11 12:11:23 +02:00
|
|
|
- Account, Cloud, Help and Network methods.
|
2021-10-10 14:30:53 +02:00
|
|
|
- Capability of sending raw requests.
|
|
|
|
|
2021-10-10 14:31:30 +02:00
|
|
|
## Bundling for browsers
|
2021-10-10 14:29:58 +02:00
|
|
|
|
|
|
|
### Method 1: Deno's bundle command (recommended)
|
|
|
|
|
|
|
|
```bash
|
2021-10-10 18:02:22 +02:00
|
|
|
npm run bundle:deno
|
2021-10-10 14:29:58 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Method 2: Webpack
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run build
|
|
|
|
```
|
|
|
|
|
2021-10-18 18:02:54 +02:00
|
|
|
## Using with Next.js
|
2021-10-18 17:59:16 +02:00
|
|
|
|
|
|
|
SocialvoidJS can be used with Next.js, with the following configuration:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
{
|
|
|
|
webpack: (config) => {
|
|
|
|
if (typeof config.resolve.fallback !== "undefined") {
|
|
|
|
config.resolve.fallback.fs = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return config;
|
|
|
|
},
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
React.js support is untested, but should work if you can configure Webpack like mentioned in above.
|
|
|
|
|
2021-10-09 19:02:19 +02:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
See [`examples/`](./examples).
|