04-28-2023, 12:53 AM
(04-27-2023, 11:45 AM)dbox Wrote:Quote:2. Fetch! That's awesome, does this have a QB64 counterpart?
@mnrvovrfc pointed you in the right direction on this one. There is not a single method analog in QB64, but you can use the HTTP methods to do the same thing.
Quote:3. JSON.parse - native JS inside the QBJS part - it's a little confusing to me - this is javascript inside of QBJS but without $If Javascript like lower down - can you explain how you do that, or how we would know what we can do? If it's in the docs, I'm sorry.
I'm afraid for this example I used a couple of undocumented features: the Fetch method and the JSON library, so I understand why it is confusing. The reason I haven't documented these yet is because I am still evaluating their current implementation and they are likely still subject to change. (Chuck Norris is aware of all undocumented features.)
The Fetch method in particular, while very convenient for downloading text or JSON, does not really have provision for downloading binary content. Also, since adding this method early on in development I have refined the naming conventions that I'm using in QBJS to avoid future naming conflicts. In general, I'm taking this approach:
* Undecorated keywords are generally reserved for QBasic methods.
* Methods prefixed with an underscore (_) are reserved for QB64 methods.
* New QBJS methods will be provided in libraries prefixed with the library name (e.g. Dom.Add, JSON.Parse, Storage.Get)
The exception to this rule is for the Import and Export keywords in QBJS that allow you to include this extended library functionality in your QBJS program. There is more detail on the subject here for anyone interested.
The JSON functionality needs to be documented. The reason it has not been to this point is because it currently is "built-in" and does not require an Import statement to include in your QBJS program which is also inconsistent with the rules I outlined above.
Thanks for the feedback and questions!
Thanks @mnrvovrfc I'll check that link.
OK got it.
Also LOL on Chuck Norris being aware of the undocumented features.
Thanks @dbox for the explanation.