This is a migrated thread and some comments may be shown as answers.

setTimeout causes error?

4 Answers 134 Views
Bugs & Issues
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
benallfree
Top achievements
Rank 1
benallfree asked on 07 Oct 2014, 12:05 AM
I was writing some Content Type event responders and noticed that any use of setTimeout causes a nonspecific error message. 

Is setTimeout not supported?

4 Answers, 1 is accepted

Sort by
0
Anton Dobrev
Telerik team
answered on 07 Oct 2014, 10:49 AM
Hi Ben,

You can use setTimeout as in any other JavaScript environment. For example:
var data = everlive.data('MyData');
 
setTimeout(function() {
    data.get().then(function(data) {
        console.log(data.result);
    }, function(err) {
        console.log(err);
    });
}, 5000);


If the problem persists could you share the code that raises the error so that we can investigate it on our side?

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Anton Dobrev
Telerik team
answered on 07 Oct 2014, 10:57 AM
Hi,

Just a quick follow-up.

In case you'd like to use setTimeout in the Cloud Code events and functions, I am afraid that this is not supported.

Let me know if you have questions.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
benallfree
Top achievements
Rank 1
answered on 07 Oct 2014, 02:17 PM
Yes, that was the question. Cloud Code. Is there a reason why setTimeout isn't supported? Or is there a list of things not supported in Cloud Code? 
0
Anton Dobrev
Telerik team
answered on 07 Oct 2014, 03:51 PM
Hello,

The execution of the cloud code events is time-limited thus maintaining a time-dependent code is not applicable in the Cloud Code. This would be the main reason that setTimeout, setInterval, etc., are not supported.

We have on our roadmap a functionality for scheduling cloud functions which will cover apps that require time-dependent scenarios.

The Cloud Code has its own API that you can explore here. Since this is a server logic layer, the API does not cover a lot of common JS functions like these mentioned above. Also, the context of the this keyword is limited.

You are welcome to share your suggestions or feedback.

Regards,
Anton Dobrev
Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Bugs & Issues
Asked by
benallfree
Top achievements
Rank 1
Answers by
Anton Dobrev
Telerik team
benallfree
Top achievements
Rank 1
Share this question
or