473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

multiple actions in eval() on safari asynchronous

First I have a script file like:

alert('a');
if(***) alter('b');

saved on the server.

I'm using AngularJS developing a mobile app which reads and executes it using eval().

On iOS safari alter('b') will come up first then alter('a') and it seems codes after eval() will run asynchronously.

However on Android & PC Chrome the sequence is as expected as alter('a')->alter('b')->things after eval().

How can I run run scripts synchronously on Safari? Many thanks.
Mar 4 '17 #1
1 1414
gits
5,390 Expert Mod 4TB
i am not aware of such behaviour of eval but 2 things - 1st: using eval is pretty much very bad practice - i've never seen a reason to use it except bad design of a software or (in the old days) evaluating a JSON response from a XMLHttpRequest. 2nd: if something is async there is usually 2 solutions - you can use a timeout which is very bad practice as well - or refactor everything so that the code uses callbacks whenever it should proceed with the next step - which would be the preferable solution. ES6 provides promises that can be used to achieve the same goal - and basically transpile into an appropriate callback-chain.
Mar 16 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Polaris | last post by:
Hi: I'm using VC 7.1. I like to have multiple actions taken after a build is complete. For example, I'd like to copy the files into multiple directories. But so far I can only specify ONE...
17
by: petermichaux | last post by:
Hi, Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server. Thanks, Peter
2
by: jimfromsd | last post by:
I have a particular problem where I need to have one form perform two actions. Can you just have 2 actions in the action parameter ("action = ....blahblah.asp, ...yaddayadda.jsp") or is there some...
7
by: petermichaux | last post by:
Hi, I have tried the following based on suggestions of the best way to insert JavaScript into a page. This is instead of using eval(). Unfortunately IE says "unexpected call to property or...
3
by: danny relic | last post by:
Is it possible for inet to access a webpage, fill out post data, and then do another action afterwards? How would I do that? For instance, I've got inet accessing a site where it needs to do a...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
1
by: shaileshkumar | last post by:
my application-homepage is built of four frames top left middle bottom each frame is a jsp. there is a hyperlink on top frame a click on it should refresh the four frames.
1
by: rncr | last post by:
I would like to get your kind help for the database I am creating now.. I have a field "Action" which is a look-up wizard and will type later the values I want. What I need is, to track all the...
8
by: abdan | last post by:
how to do Multiple Actions in one button vb
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.