Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account
This post has been closed. You can still view previous posts, but you can't post any new replies.

[API] Update Functions to Standard "Async" Naming Schemes

What's wrong? In the current API Scheme, we are faced with naming schemes of Functions that are irregular, and, in some cases, the functions do not operate the same based on what you are querying. For example, if you do token.get("gmnotes"), that will be just fine, but if you do character.get("gmnotes"), that returns an error. This creates a needless complication error that isn't well documented in the JavaScript API Function Wiki. What is the Standard "Async" naming scheme? Across all platforms, C#, Javascript, and the like, any time you are executing an Async function, it is mentioned that it is Async. That way, if you attempt using it, you know what it does, and you are explicitly allowing an Asynchronous call. Wouldn't this make some scripts incompatible? It could, but, instead, I would suggest stopping this "Shortened" Function naming scheme. The old scripts would use the old naming scheme (and those functions would operate the same way), and the new scripts would have the option to use the naming scheme. Any script that utilizes the obsolete way of functions would report an "function is obsolete, use <NewFunction>" log line, so people could determine if the script is using the old way, but not need to worry about their script getting obliterated in the update. What do I mean? getAttrByName would change to: getAttributeByName(characterId, attributeName, valueType) and getAttributeByNameAsync(characterId, attributeName, valueType, callback) getObj would change to: getObject(type, id) and getObjectAsync(type, id, callback) What would this improve? Mainly, look and how things work. A good example I mentioned above is that if you try a character.get("gmnotes"), it returns an error that you must supply a callback. Usually, in coding schemes, you don't have a same function operate differently between async/non-async because it causes coding complications (and headaches).
1561021536
Roll20 Dev Team
Pro
Marketplace Creator
Thanks for the suggestion! After 30 days, Suggestions and Ideas with fewer than 10 votes are closed and the votes are refunded to promote freshness. Your suggestion didn't build the right momentum this time, but feel free to submit it again! We find that the best suggestions describe the problem you are having, and the solution you want. You can learn more about the process of making suggestions on the Roll20 Wiki! More details can be found here .