Sidebar App

A simple example that shows a sidebar app widget and closes it by clicking the X button.

To put an image in a widget, you need to base64 encode the image and wrap it in an img tag as shown in the example html code.

1) File

2) main.js

// Function that works when the sidebar app is touched (clicked).
App.onSidebarTouched.Add(function (p) {
	p.tag.widget = p.showWidget("widget.html", "sidebar", 350, 350);
	p.tag.widget.onMessage.Add(function (player, data) {
		if (data.type == "close") {
			player.showCenterLabel("Widget has been closed.");
			player.tag.widget = null;

// Function is called when the player enters
App.onJoinPlayer.Add(function (p) {
	p.tag = {
		widget: null,

// Function is called when the player exits 
App.onLeavePlayer.Add(function (p) {
	if (p.tag.widget) {
		p.tag.widget = null;

3) Image of the Sidebar App Running

Last updated