create3000 / x_ite

X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.
https://create3000.github.io/x_ite/
Other
66 stars 13 forks source link

feat: Add typing for browser.getContextMenu #154

Closed gwhitney closed 9 months ago

gwhitney commented 9 months ago

I realize it may be too late for the first release of x_ite.d.ts, but I just discovered that the first pass at typing x_ite did not include typings for browser.getContextMenu(), which I now would like to call. So this PR supplies (a hopefully reasonable attempt) at typings for this call and the data structures it returns and allows you to manipulate.

create3000 commented 9 months ago

You have made public the functions getAvailableViewers() and getViewerName(), my intension was, that these function are private. Do you use/need this functions?

interface XiteContextMenu {
   getAvailableViewers(): Record<string, ViewerInfo>;
   getViewerName(viewer: ViewerInfo): string;
   // getViewpoints(): unknown; // couldn't get this to return anything...
}
gwhitney commented 9 months ago

No, feel free to adjust. I had no way of knowing which methods in the prototype were meant for clients to use. So I guessed just based on the names/behavior/whether they seemed like something a client might want. Thanks.