Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Callback Function From External Javascript |
Wed, Aug 28 2013 6:31 AM | Permanent Link |
Chris Holland SEC Solutions Ltd. Team Elevate | Is there anyway that I can pass a callback function into an external
Javascript file from EWB. I am trying to access a geoLocation using something like the following code: =============== EWB Code =============== // not sure what to put in here as a parameter external function GetPosition(???????); function StartGetPosition() { // pass in the return function that I want called GetPosition(GetPositionSuccess); } function GetPositionSuccess(p) { // this function is called from external GetPosition() javascript } =========================== External Javascript File =========================== function GetPosition(geoSuccess) { var options = { enableHighAccuracy: true, timeout: 5000, maximumAge: 0 }; if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(callbackSuccess,geoError,options); } } -- Chris Holland [Team Elevate] |
Wed, Aug 28 2013 4:27 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Chris,
<< Is there anyway that I can pass a callback function into an external Javascript file from EWB. >> Yes, but it has to be a method of an object, not a generic function, and you have to prototype the external call appropriately in order to avoid compiler errors. Tim Young Elevate Software www.elevatesoft.com |
Wed, Aug 28 2013 4:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Chris,
Some code might help. type TGetPositionSuccess = function (<Params>): <Return> of object; external function GetPosition(PositionSuccess: TGetPositionSuccess); Of course, if the function doesn't return a result, then you can just use a procedure instead. If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, January 18, 2025 at 08:56 AM | Privacy PolicySite Map © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |