Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 66 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,80 @@ Although this library does not provide game engine facilities, the API is design

---

## Usage

Totum is composed of two major parts:


## API



API part exposes `setAPI` a dynamic routine that can be used to set the methods which can be then used by loaded modules/apps. API is based on [Singleton Design Pattern](https://en.wikipedia.org/wiki/Singleton_pattern)


## Usage `setAPI`

```js

let object;
try {
object = await metaversefileApi.load(url);
} catch (err) {
console.warn(err);
}
return object;
metaversefile.setApi({
async load() =>{}

async import() =>{}

useApp() =>{}

.
.
.
can be anything

})

```

### Inputs
* url: {URL of the asset that can be downloadable by the screenshot system} **[Required]**
* object with key/value pairs can be anything even an async/Promise based function.

### Returns
* Promise:
* Based on the methods used in setAPI

### Example Usage


#### Initialisation

```js

import metaversefile from 'metaversefile';

### Output
* Object of application
metaversefile.setApi({
helloWorld() =>{
return 'Hello World'
}
})

```

#### Usage in other modules


```js

import metaversefile from 'metaversefile';

metaversefile.helloWorld()

```


---

## Rollup.JS

Totum also provides a [Rollup.JS](https://rollupjs.org/) plugin located under `plugins/rollup.js` that provides transformation, loading and resolution based on the different module/asset loaders registered in totum.

### Supported Loaders by totum/rollup.js

### Supported Assets
* `VRM`
* `VOX`
* `JS`
Expand All @@ -46,8 +96,10 @@ Although this library does not provide game engine facilities, the API is design
* `HTML`
* `GLB`
* `GIF`
* `Relative/Absolute URL`


## Motivations
### Motivations for loaders

- A system which takes any URL (or token) and manifests it as an object in a 3D MMO
- Totum transmutes data on the backend, serving composable little WASM+JS apps your browser can import()
Expand Down