prepare-relay

0.0.1 • Public • Published

prepare-relay

Simple push messaging from server to client using prepare.js.

How to use:

In your server's root directory:

npm install prepare-relay

Then in a script executed on the server:

var relay = require('prepare-relay')(window);

var renderText = function(text) {
	var elem = document.createElement('p');
	elem.textContent = text;
	document.appendChild(elem);
};

var relayText = relay(renderText);
setTimeout(function(){ relayText('Boo!'); }, 5000);
// 'Boo!' appears on the user's page after 5 seconds

Readme

Keywords

none

Package Sidebar

Install

npm i prepare-relay

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • nardi