Need clarification on window.siteData in javascript - javascript

I have come across a variable in javascript called window.sitedata but tried to search the details regarding it but unable to find.
Can some explain what is window.sitedata in java script ? what is its purpose, any documentation regarding it would be helpful.

I think window.sitedata is not available. Refer below link for window object properties.
https://www.w3schools.com/js/js_ex_browser.asp
FYI
https://developer.mozilla.org/en-US/docs/Web/API/Window

sitedata is a custom variable because the native window object does not have a property called sitedata.
You may ask (if possible) the programmer who developed the code.
Reference:
W3Schools
MDN

Related

How can I distinguish typescript from javascript by looking at the source code?

I am inspecting some code on Github and I need to quickly understand if the script is javascript or typescript.
Are there any easy shortcuts or clues to this?
As an example, in this image from https://www.typescriptlang.org/ gives me a clue that if an array is declared with a bracket [] after the variable name, then it is typescript.
You can distinguish between the two formats by looking simply at the functions.
Are any of the functions specifying types such as 'string,integer,object,array,function?...' etc?
In traditionally javascript this is not allowed.
Best,
AT
Also as others may have pointed out, you can also check the file extension

How to get jsdoc generation for parms of class methods that use arrow functions?

I'm a student who's capstone project/work intergrated learning is about to end. I'm working on producing technical documentation to hand off to the next team that will continue on with this work, but I've hit a snag.
My class methods that use arrow functions aren't generating params documentation when I create documentation using the jsdoc tool.
i.e.:
becomes
The documentation works as intended in visual studio code/intellisense:
I've been googling around to try and figure out what the problem was, but I failed to find anything.
I mean, my research yielded:
Outdated way to make vscode play nice with arrow function
syntax: (https://github.com/Microsoft/vscode/issues/36283) (https://github.com/Microsoft/vscode/issues/22264) ((This one is the actual issue where the support was added) https://github.com/microsoft/TypeScript/issues/14134)
Outdated info on the jsdoc support for this feature:
https://github.com/jsdoc/jsdoc/issues/1310
etc., etc., again, nothing useful.
Of note is that I'm using the jsdoc-export-default-interop plugin so that jsdoc will actually generate things for export default [CLASS OR FUNCTION].
I've found a solution that fits my requirements
However, while it is good enough for my purposes, I'm not entirely sure it's acurate and would be happy to hear critisims, other people's viewpoints and solutions. I'll explain the concerns I have at the end.
The problem: It looks like jsdoc cannot automatically detect if a member assignment is a function when parsing.
I have no idea why VSCode is able to detect it automatically, but it appears the JSDoc tool cannot. Here it is stated in the official documentation
Link to documentation: (https://jsdoc.app/tags-function.html)
The solution: Document the member with the #function tag (or an alias like #method).
By documenting the class member with the #function tag like so:
I am able to get the arrow function to generate as a class method, and get params documentation:
My concerns
Well the biggest concern/annoyance is now I need to go through all the source code and add a bunch of #function tags. Ah whelp.
Other concerns are that I may have misunderstood the problem/I'm not quite sure if this is best practice.
And I'm not too certain if this documentation is accurate in terms of if there is actually a tangible difference between a class member arrow function and a class method that I need to capture in the API documentation.
Anyway, I think this will be what I go with, but I'll be monitoring this answer to read any input/feedback :)

Chrome console - what does this stuff that represents a Kendo UI widget actually mean?

So I'm using Kendo UI and attaching a widget. In the browser JavaScript console I can look up the object representing the widget:
$('#sidebar').data('kendoResponsivePanel')
and I see this in the console:
a.e…d.init {element: I.fn.init[1], _events: Object, options: Object, _guid: "_2d771e97-e660-4ee9-9141-8a9d9cc2e42e"}
followed by various properties of the object. What does this part actually mean? What is the a.e...d.init bit telling me? All I need is to know where to look for a reference, or some kind of pointer that gets me on the right track. I think I need to understand JavaScript prototyping also?
Apologies If if I don't understand your question entirely but I believe that if you assign this:
$('#sidebar').data('kendoResponsivePanel')
into a variable and the variable is not undefined or null the widget is created.
var myWidget = $('#sidebar').data('kendoResponsivePanel')
if(myWidget)
{
// then it exists.
}
UPDATE:
Ok based on your comment and looking at this image:
I believe these are the build in (non "public" widget functionality) being exposed by Chrome. The actual methods, fields and events which you should really then be interacting with are define din the API reference documentation for each particular widget type. You can see the Kendo UI JS combobox ones here: http://docs.telerik.com/kendo-ui/api/javascript/ui/combobox
I guess if you want a more detailed insight into it contacting Telerik directly may help.

Window is not a constructor error?

I have this code in a JavaScript file:
this.tooltipWindow = new Window("__tooltip__", TooltipManager.options);
This gives me the TypeError: Window is not a constructor error in Firefox. Is there something wrong with this code and yes, how can I rewrite it, so it works?
Thanks!
If you have a type defined by the word "Window", it's likely interfering with the actual 'window' object that exists on all pages.
If you're actually trying to create a new 'Window', as in the browser-typed object, that way, then I think that you're entering into some unfamiliar areas to me...are you just trying to create a popup window?
https://developer.mozilla.org/en-US/docs/Web/API/Window.open
A quick search on that line of code pointed me to a library called ATK, specifically the tooltip.js file. At first glance it's quite a complete library, but it seems like you are only using tooltip.js. Since the Window class is defined in window.js you'll need to include that script as well to make it work.
I don't know the framework myself, so it might be wise to check if it even supports cherry-picking specific pieces of code like that.

What kind of attributes does javascript get?

I want to get client information via javascript. However I do not know which attributes are gotten by javascript. How should I learn this?
Have a look at window and document object properties. All client-side information is here.
you can use Navigator userAgent Property for that , as i understood you question
example Navigator userAgent Property
a very good reference for useragent

Categories

Resources