Page 1 of 1

Popup and set property priority / blocking

Posted: Mon Jun 17, 2013 8:29 am
by Luke Szemis

hello,

I am having a problem in getting localStorage variable to be applied correctly to text field. Trick is a mesh of service invocation and invoke priorities

here is the scenario.
actions:

  1. Taphold on Button1 on page1 - open popup_page

  2. popup_page has load event which startup service1 . Service1 populates clickable labels using REST api on popup_page

  3. on popup_page user taps clickable label and stores text value in localstorage, closes popup

  4. Button1 on page1 is updated with localstorage valuable stored in point 3.

    Problem is that action 4 is being invoked first before action 1.
    Although the Taphold button in priority shows that popup should open first I can see that action 4 is being run before popup opens. .

    My question is how can I block events allowing for popup_page actions complete first and then resume with actions in 4 ?

    Is it possible to open popup_page in service success event ?

    thanks and regards,
    Luke


Popup and set property priority / blocking

Posted: Mon Jun 17, 2013 8:42 am
by Luke Szemis

Is it possible to open popup_page in service success event ?
I know it is possible, but still won't work for me, since the service needs to update already open popup to populate the labels.


Popup and set property priority / blocking

Posted: Mon Jun 17, 2013 8:58 am
by Luke Szemis

Meanwhile I've circumvented the problem it by adding open page1 and refresh as last action in label click actions. But there has to be better nicer way of doing this ?

thanks!


Popup and set property priority / blocking

Posted: Mon Jun 17, 2013 1:13 pm
by Maryna Brodina

Hello! Working on it.


Popup and set property priority / blocking

Posted: Mon Jun 17, 2013 7:14 pm
by Kateryna Grynko

Hi Luke,

To check if there is the value in the storage run the following JavaScript code:
codeif (localStorage.getItem("item_name") == undefined) {
// default button text
} else {
// change button text
}/code
Delete the value as soon as you don't need it. Otherwise the button will get an old value when run next time.