INDEX

Remote operation

Spaceify is designed to be remote operatable. It applies only to web pages and Spaceify can not be remote operated by any other way than through web pages. To make the remote operation system workable, application developers must take into account some special considerations. First of all, using the remote operation system is mandatory. Even if the application is intended to be used solely locally the guidelines for remote operation must be followed.

There are two main rules

  • URLs must be declared using special attributes and src and href must not be used.
  • The URLs must be relative. Spaceify completes the relative URLs automatically, based on various parameters, and makes them absolute. Relative URLs can contain pathname, search and hash parts.

The special attributes

The special attributes replacing the conventional tags are as follows. Notice the relative urls in the examples.

Attribute Description
sp_src URL to applications own resources in its application/www directory.

E.g.
<img sp_src="images/middleware-eventchannel.png">

The remote operation system completes the URL and the resource is loaded safely.
spe_src URL to Spaceifys resource.

E.g.
<script spe_src="js/spaceify.api.js"></script>

The minified API class is loaded from Spaceify edges URL.
sp_href URL to applications own style sheet.

E.g.
<link rel="stylesheet" sp_href="css/tile.css">
spe_href URL to Spaceify edges style sheet (applications can use the styles for formatting their tiles etc.).

<link rel="stylesheet" spe_href="css/spaceify.edge.css" type="text/css">

Usage

The remote operation system is taken into use by placing script tag for it into web page. There is no need to do anything else because Spaceify processes the page automatically after the script tag is loaded.

<script src="http://edge.spaceify.net/js/spaceify.loader.js"></script>

Ready event

It is often required, and actually preferred, to wait for Spaceify to finish processing the web pages. After the processing is done, Spaceify emits spaceifyReady event that can be catched with event listeners. If applications tile or web page uses Spaceify's API classes, the classes are ready to use after the event is emitted.

window.addEventListener("spaceifyReady", function()
  {
  });

Application web page

Sometimes it might be required to open an 'application web page'. For example lights controller might want to open a web page with all of its controllers on it. See the Web pages documentation about this subject.

Eeample

Below is an example of a custom application tile. The logic contained in the spaceify.loader.js JavaScript file loads the resources defined in the sp_* and spe_* attributes and after the resources are loaded emits the spaceifyReady event. The tile initializes itself after it gets the spaceifyReady event.

<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">

	<title></title>

	<link rel="stylesheet" sp_href="src/assets/fonts/roboto/roboto.base64.css">
	<link rel="stylesheet" sp_href="css/tile.css">

	<script src="http://edge.spaceify.net/js/spaceify.loader.js"></script>
	<script spe_src="js/spaceify.api.js"></script>

	<script>
		window.addEventListener("spaceifyReady", function()
			{
			
			});

		window.addEventListener("click", function()
			{
			window.open("spaceify/eventchannel", "index.html", "_blank");
			});
	</script>
</head>

<body>
	<div class="appTile">
		<img sp_src="images/middleware-eventchannel.png" width="64" height="64">

		<div class="appText">
			Event Channel
		</div>

		<div class="appText appSubText">
			Spaceify Oy
		</div>
	</div>

</body>

</html>
Close
copyright © Spaceify.org 2014