Cannot read property 'getAppToken' of undefined

@yisrael-wix Hi. It worked. I posted here because I considered it bad to start a new thread with the same title. Will act accordingly in the future though.

Now, I’ve been browsing the Page documentation (https://www.wix.com/corvid/reference/$w/page) in order to understand how to use the onReady() function, as you suggest on Pages but I can’t find such a function related to Page element. What am I doing so completely wrong? (and again, code worked/works without the Page onReady() mod… (???).

(and again, code worked/works without the Page onReady() mod… (???).
Perhaps it worked this time for you also without the onLoad-command, but you should use the onLoad-command at first, like Yisrael said it. He knows very well why and what he tells you.

Normaly try always to work like this…

VERY FIRST codeline (starting point of your whole CODE)

$w.onReady(function () {
    console.log("The page is ready");
})

And in most situations the SECOND codeline is often…

$w("#myDataset").onReady( () => {
  console.log("The dataset is ready");
} );

So you always should start with something like…(if using DATASET for example)

$w.onReady(function () {
    console.log("The page is ready");
    $w("#myDataset").onReady( () => {
      console.log("The dataset is ready");
    });
});

END-RESULT…

$w.onReady(function () {
    $w("#myDataset").onReady( () => {
    
        //here put in all your CODE
        
        //for example put in a button On-Click-Function here....
        $w("#myButton1").onClick(()=>{
            console.log("Button1 clicked.")
        })
        //with coding-structure like this, you do not need to connect your button with the code anymore. It does do it automatically.

    });
});

Why using all this onReady-Coding?
Because sometimes there are laoding-times which need time, but your code do not stop and wait for this LOADING-TIMES, and it is very often the situation, where you will get wrong results or even NO-RESULTS (like in your own example), because you have programmed your code in that way, that it do not wait for completed LOADINGS. The CODE just runs and ignores everything else (does not wait for response/answer.)

And now, this post can be closed i think.

P.S.: This is why i told you in one of my posts, that you have to be careful working with —> Async-Await / .then(()=>{} commands. The “onLoad”-command is also one of these very important commands.

@russian-dima @yisrael-wix You’ve been very helpful and I appreciate your precious time spent in explaining (seemingly) trivial things to unexperienced Corvid users. I admire all your dedicated work to support us.

Please though, have in mind, that there are times where a user literally struggles to understand what you’re saying because you presuppose, due to your high expertise, that whatever you say can be digested as easily as said. Even your last post, @russian-dima , talks about an onLoad command but there is no such a command in your beautiful introductory code you provided.

So you made me visit (again) the documentation (API reference) and search for onLoad command but my query returns no results which makes me think that you used the word onLoad ‘loosely’, trying to express in general, with rather ‘algorithmic’ language, the concept of ’ what is to happen upon page loading or once page loads, etc '. May be I am still wrong, don’t know, but I’m sure I’ll follow your advice regarding provisions that need to be made regarding loading times, etc.

Respectfully.

@gemats
My bad, i meant of course onReady and not onLoad !
Don’t know where i was with my minds. SORRY :roll_eyes::persevere:

@gemats The Page onReady() function isn’t described under Page since it’s so important that it deserves its own treatment. BTW - the site itself also has an onReady() function which can be found in the masterPage.js file.

This small article might help you understand what the onReady() function is for: $w.onReady() :: a guide for the perplexed

@russian-dima

You wrote: " Don’t know where i was with my minds."

Well, I know where you were, you were in HTML… HTML onload Event Attribute .