runtime/webinterface.js
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 05 Apr 2017 14:17:02 +0300
changeset 1672 9298ba0cd70a
parent 719 db54ccc96309
permissions -rw-r--r--
reset loaded messages counts on new PLC program trasnfer

This fixes the problem that first message from newer PLC program maybe
lost, if it's issued before first PLC log fetching.

Closes #23
// import Nevow.Athena

function init() {
  Nevow.Athena.Widget.fromAthenaID(1).callRemote('HMIexec', 'HMIinitialisation');
}

WebInterface.PLC = Nevow.Athena.Widget.subclass('WebInterface.PLC');
WebInterface.PLC.method(
	 'updateHMI',
	 function (self, data) {
	   d = self.callRemote('getPLCElement');
	   d.addCallback(
			 function liveElementReceived(le) {
				d2 = self.addChildWidgetFromWidgetInfo(le);
				d2.addCallback(
						function childAdded(widget) {
						var node = self.nodeById('content');
						node.replaceChild(widget.node, node.getElementsByTagName('div')[0]);
						init();
						});
				});
	   });

Divmod.Base.addLoadEvent(init);