Skip to main content

Get started πŸš€

Installation​

The application is deployed with the client files to ease the usage.

You can always reference those files with a script tag:

<script type="module">
import { setup } from 'https://iframe.unionavatars.com/client/index.js'

const iframe = document.querySelector('iframe#id')
const client = setup(iframe)
</script>
caution

The client won't be properly set if the iframe is not yet loaded. If you have an Error about it not being loaded call setup on the onload event of the iframe

var eventer
iframe.onload = () => {
client = setup(iframe)
}

The variable client can be used to do plain requests, or to listen for events. For a more detailed list of what can be done you can refer to the API docs.

With that client you can do things like login, change the logo with set-logo, or list the avatars with avatars.

The calls are done with the request method of the client.

const avatars = await client.request('avatars')

Examples​

Some more detailed examples are hosted here: https://github.com/LinkingRealities/iframe-examples

Getting to know more about the API​

More information on what can be done with the client inside the Api section.