[Early warning: long read]
]
Roi, thank you for responding, you´re about the only one. I think I have got the problem solved, but for you and maybe others that run into the same problem, I will explain what I suspect was/is going on.
My problem was that, in earlier stages of the html-component (HC), $w was processed before/during (async) the loading of the HC. So when from within $w you sent a postMessage, the HC ignored it, because it was not loaded yet. So I made a workaround, starting the conversation from the HC in the html body onLoad (function) by sending a heart beat to $w, whereupon that side would send a message with data to display. Many people had the same problem, I emailed my solution to many and eventually put it onto my blog. One of you wanted to put me up for the Nobel Prize for this. That would be hugely overrated, but at least I offered a solution to a problem.
I was working on a alternative date picker for Wix (another natural language), a job way over my pay grade. I finally got it working on a Friday. Next Monday I press F5 and all goes boom.
I wrote all kind of posts on this forum, but I was not even taken seriously, better still, I am shunned. Yes, I was very p&//%ed off: working code just broke in front of my very eyes.
Now, I am perfectly aware that Wix Code is still in beta and things do change. What worries me is that Wix updates components significantly without an early warning to its user, thereby stating what has changed and offering a sandboxed environment where we can test the new component before deploying. If not, Wix runs the risk of having the same dreaded problems like WordPress on a shared environment: a component/plugin/addon (whatever you call it) is updated, and if your site still runs is up for grabs. It worries me because I see no effort to address this problem during beta, with the possible risk that this continues when finally released.
It worries me because this is not an exception, but rather a rule: I have had it with the dropdown component, with .save(), with the keyword “sleep” and now with the HC. A conservative estimate is that I have lost one month during one project because of this.
In short: we know this can happen during beta, but I see no provisions to solve this when released. That worries me a lot.
Back to the HT: in earlier versions, as I said, $w was processed before/during the loading of the component. This is no longer so. I see a constant opposite behaviour: the HC is loaded first, then $w.
I assumed you had done some major updating on the HC. No answer. But when I looked at the documentation, I found all kind of new things: full screen, ready to run inside the Repeater, etc. So you did a major upgrade. And this update changed the order of loading $w and HC, I suppose.
In my simple code example (see above), the following now happens:
- HC is loaded and sends a heart beat postMessage to $w (like it used to work)
- $w is not processed yet, so the message goes out into space
- function html_onMessage () does receive it, because it is outside $w
- result; $w(…).onMessage does not receive a heart beat postMessage from HC, the opposite of earlier stages.
I later called this behaviour erratic because in some browsers (Opera) $w would receive it, once or twice, but not constantly (I did not notice this on FireFox or Chrome). function html_onMessage () was ALWAYS received.
My solution is now: don´t even wait for the heart beat in $w, it is unreliable, just do postMessage, the HC is loaded in every case that I could test and ready to receive.
It would have saved us all a lot of aggravation and frustration if Wix would just document their changes better AND offer a Sandbox for testing/deploying. I THINK the above is what´s going on, but you are so tight lipped that I do not know this for sure.
I hope you take this the way it is meant: yes, critical, but pointing out real problems.