-
February 2nd, 2007, 04:45 PM
#1
How to access the LightstreamerEngine object from a Push-page
The preferred way to access the LightstreamerEngine object from a Push-page is through the onEngineReady() event handler callback of the PushPage object. You will be passed a reference to the LightstreamerEngine object (that you can save for subsequent uses) as soon as it is ready. A typical implementation could be the following:
Code javascript:
var e; //LightstreamerEngine object reference
var p = new PushPage();
p.onEngineReady = function(engine) { e = engine }
p.bind();
// one on the possible ways of setting the engine
p.loadEngine(“lsengine.html?config=lsengine_config.js”);
// first alternative way
// p.loadEngineMinimal(“lsengine.html”, “MyEngine”);
// second alternative way
// p.setEngineReference(parent.frames[“MY_ENGINE_FRAME”]);
// third alternative way
// p.setEngineReference(null, “MyEngine”);
The result is that the variable “e” of the Push-page will contain a reference to the LightstreamerEngine object only when the engine is actually ready.
-
March 2nd, 2007, 11:57 AM
#2
onEngineLost
Sometimes the "link" between the LightstreamerEngine and a Push-page is lost (eg. if the Push-page is a pop-up and the opener page - that contains the LightstreamerEngine - gets closed)
Lightstreamer web client detects such cases and notifies the PushPage object.
You should just remember to delete the stored reference when you get an onEngineLost call:
Code javascript:
p.onEngineLost = function() { e = null; }
Similar Threads
-
By tsezuu in forum Client SDKs
Replies: 2
Last Post: November 24th, 2011, 03:09 AM
-
By arunj in forum Adapter SDKs
Replies: 4
Last Post: February 10th, 2011, 12:32 PM
-
By eweinberg in forum Adapter SDKs
Replies: 3
Last Post: November 11th, 2010, 07:09 AM
-
By sachinpatel2 in forum Client SDKs
Replies: 1
Last Post: September 10th, 2010, 10:01 AM
-
By ivailo in forum Client SDKs
Replies: 1
Last Post: July 24th, 2008, 08:55 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 07:42 AM.
Bookmarks