Skip to content

Instantly share code, notes, and snippets.

@ayal
Last active October 22, 2021 14:32
Show Gist options
  • Save ayal/e99c2490963355fb1fc26c27e5c811d1 to your computer and use it in GitHub Desktop.
Save ayal/e99c2490963355fb1fc26c27e5c811d1 to your computer and use it in GitHub Desktop.
velo presence package readme

Site Members Presence

Use this package to add a widget showing the site members that are currently on your site.

Setup

Add a repeater with id onlineUsers inside the repeater you can set: image with id profilePic text with id userName How to Use the Package in your Site In your home page paste the following code:

import { connect } from '@ofird11/presence1';
$w.onReady(() => {
    connect({
        reportAddtionalInfo: () => {},
        onRender: ($item, itemData) => {}
    });
});

Extensions points (see examples):

reportAddtionalInfo - In case you would like to add additional info on the user presence object (it will populate it on the itemData as data property) onRender - render hook in case you would like to render specific UI onto the repeater Content

Examples

$w.onReady(async function () {
    connect({
        reportAddtionalInfo: () => {
            return { myData: 'hello' };
        },
        onRender: ($item, itemData) => {
            if (itemData.data) {
                $item('#data').text = JSON.stringify(itemData.data);
                $item('#data').show();
            }
        }
    });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment