EMY - receiving an asynchronous request

16 views
Skip to first unread message

Rune Back

unread,
Mar 21, 2018, 4:08:44 AM3/21/18
to iphone...@googlegroups.com
Hi!

I use only one section tag "HOME" in my code. When the user navigates to "another" section tag, I only change the code of the section tag. - Very fast!

I do have another section tag called "DUMP", for internal use only. That's where I receive the answers for any asynchronous requests sent to the server. After I've sent something to the server I check the "DUMP" every second. 

It seems to me that the section tag isn't the right tag for this use. - Any suggestions?

Thanks,

Rune

Rune Back

unread,
Mar 21, 2018, 11:49:33 AM3/21/18
to iphone...@googlegroups.com
I tried...

<p id="DUMP" hidden></p>

​...​
and theat seems to work fine
​, so far at least​
. / R

Remi Grumeau

unread,
Mar 21, 2018, 6:31:13 PM3/21/18
to iphonewebdev
Humm

I'd rather put this in a DIV rather than a SECTION then.
Emy uses all direct SECTION tags child nodes as views.
So it won't bother you with this DIV (just put a display:none on it would be enough)

But ... if you're doing the ajax call on your side and uses one single section to replace its content without any navigation transition, why using Emy ? :)

Also, <div id="dump" hidden>, you forgot a "

Remi

--
You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iphonewebdev...@googlegroups.com.
To post to this group, send email to iphone...@googlegroups.com.
Visit this group at https://groups.google.com/group/iphonewebdev.
For more options, visit https://groups.google.com/d/optout.

Rune Back

unread,
Mar 22, 2018, 5:02:24 AM3/22/18
to iphone...@googlegroups.com
I like Emy. I use callbacks only in order to send/receive something to/from another App via the server. I've also made it possible for making  a backup of the ldb in the server and of course to retrieve the ldb from there. At leat 95% of my code is JavaScript. I tiny little bit of my code is in the server.

The link may look like this: href="javascript:goingTo(11);"

In goingTo(val) I have switch (val) ...
...
case 11: MAKE_MAIN(); break
...
MAKE_MAIN() stuffs the html code into a variable dump, and finally I have
document.getElementById("HOME").innerHTML=dump

I have two variables "comingFrom" and "whereAmI". I have a back button up in the right corner with goingTo(comingFrom). As I already mentioned, it's very fast.

If not Emy, what then?

Rune


2018-03-22 0:31 GMT+02:00 Remi Grumeau <remi.g...@gmail.com>:
Humm

I'd rather put this in a DIV rather than a SECTION then.
Emy uses all direct SECTION tags child nodes as views.
So it won't bother you with this DIV (just put a display:none on it would be enough)

But ... if you're doing the ajax call on your side and uses one single section to replace its content without any navigation transition, why using Emy ? :)

Also, <div id="dump" hidden>, you forgot a "

Remi
Le 21 mars 2018 à 16:49, Rune Back <rune...@gmail.com> a écrit :

I tried...

<p id="DUMP" hidden></p>

​...​
and theat seems to work fine
​, so far at least​
. / R


2018-03-21 10:08 GMT+02:00 Rune Back <rune...@gmail.com>:
Hi!

I use only one section tag "HOME" in my code. When the user navigates to "another" section tag, I only change the code of the section tag. - Very fast!

I do have another section tag called "DUMP", for internal use only. That's where I receive the answers for any asynchronous requests sent to the server. After I've sent something to the server I check the "DUMP" every second. 

It seems to me that the section tag isn't the right tag for this use. - Any suggestions?

Thanks,

Rune


--
You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iphonewebdev+unsubscribe@googlegroups.com.

To post to this group, send email to iphone...@googlegroups.com.
Visit this group at https://groups.google.com/group/iphonewebdev.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iphonewebdev+unsubscribe@googlegroups.com.

Remi Grumeau

unread,
Mar 22, 2018, 6:08:45 AM3/22/18
to iphone...@googlegroups.com

I like Emy.

Me too :)


I use callbacks only in order to send/receive something to/from another App via the server. I've also made it possible for making  a backup of the ldb in the server and of course to retrieve the ldb from there. At leat 95% of my code is JavaScript. I tiny little bit of my code is in the server.

The link may look like this: href="javascript:goingTo(11);"

In goingTo(val) I have switch (val) ...
...
case 11: MAKE_MAIN(); break
...
MAKE_MAIN() stuffs the html code into a variable dump, and finally I have
document.getElementById("HOME").innerHTML=dump

I have two variables "comingFrom" and "whereAmI". I have a back button up in the right corner with goingTo(comingFrom). As I already mentioned, it's very fast.

If not Emy, what then?

If you use emy.ajax() for the ajax calls, emy.$ for selectors or other screens transitions to the rest of the app, or simply like the UI themes, then stick with it :)
--> document.getElementById("HOME") can be emy.$(‘#HOME’) or emy.getSelectedView() if you are on this view.


If not, then you probably don’t need a library at all to just pull / push data from a server.

Remi

Rune Back

unread,
Mar 22, 2018, 10:19:52 AM3/22/18
to iphone...@googlegroups.com
I have only ONE section:

<section id="HOME" class="panel" selected="true" data-title="Name of the APP" data-hidebackbutton="true"></section>

In the function goingTo(val) I also have document.getElementById("viewTitle").innerHTML=getTitle(val) which updates the title, so the user gets the feeling of moving between different screens. I don't use emy.ajax(), but I have made my own function for it.

R


Remi Grumeau

unread,
Mar 24, 2018, 3:20:19 AM3/24/18
to iphone...@googlegroups.com
Why not use emy.ajax?

Usage is really easy

var urlToSend = “http://mydomain.com/“;
var param = {“foo”:”bar”, “test”:true};

emy.ajax(urlToSend, param, “get”, function(success){
    // do what you want with the success text callback
},function(error){
    // if a problem or timeout occurred 
});

Any custom needs this method doesn’t have that you needed ?
What it doesn’t support for ex is file upload (ishould create a plugin for that...)

Remi
To unsubscribe from this group and stop receiving emails from it, send an email to iphonewebdev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages