Skip to main content

All Questions

Tagged with
0 votes
0 answers
24 views

How can i list root objects JavaScript [duplicate]

So I have several objects and classes in my script tag const Main = {} const App = {} class Game {} let state = 777 etc. I'd like to list them. I've tried Object.keys(Object.getOwnPropertyDescriptors(...
agiopnl's user avatar
  • 1,287
-1 votes
1 answer
41 views

How can I delete an object and capture the deletion of the object event?

There are two things I am trying to do: delete an object whether a const or let - right way to do it in node.js capture the delete or assignation of null or undefined to cInst or dInst object in the ...
Gary's user avatar
  • 2,333
0 votes
2 answers
67 views

How to do this the right way? Declaring static object in function

The way I did it works, but feels like unbelievably bad programming. void draw_display() { static DISPLAY mydisplay = DISPLAY(parameters); mydisplay.set_orientation(0); do something with ...
Jnx's user avatar
  • 3
-2 votes
1 answer
640 views

How to make an onclick event change a variable in the global scope?

I need to change a global variable through a click event, but it seems (I suspect) that it won't change that variable value outside the event. i'm looking for making some calculations based on local ...
JhulianR's user avatar
1 vote
2 answers
557 views

How to convert a string to a variable name in python

I have a list of two strings: x = ['feature1','feature2'] I need to create the following list y from the list x: y = [feature1, feature2] How can I do that in Python?
Giampaolo Levorato's user avatar
0 votes
0 answers
16 views

Javascript console.log(globalThis.object) is undefined but console.log(globalThis) shows that it exists [duplicate]

Goal Set a global variable in one script and access it from another. Description In the translator class i have a method which loads custom translations depending on the user language (i take german ...
leonp5's user avatar
  • 305
2 votes
0 answers
798 views

Cannot see a global variable declared by var/let under globalThis [duplicate]

In D.Flanagan's 'Javascript the Definite Guide' there's an example: var x = 1; console.log(delete globalThis.x) When I console log this code in node v14.15.1 then instead of false I get true....
Verner Keel's user avatar
0 votes
2 answers
33 views

Setting a static object for use across multiple projects

I need a sanity check on my approach to a "global" object... I have a dictionary in xml format that I wish to share across multiple projects running in the same main application, but I need ...
ByteCarp's user avatar
0 votes
2 answers
102 views

Creating objects of a class via globals()[]

I realize that what I am trying to do is not recommended but, for now, I am interested in pursuing it so as to better understand how object creation and globals()[] work. In the following code, I am ...
ZwiTrader's user avatar
  • 345
0 votes
0 answers
235 views

Var vs. Let Keyword With Global Object [duplicate]

When we use the var keyword outside of a function, it creates a global variable and attaches that global variable to window object in the browser. In contrast, when we use a let keyword to declare a ...
Kinta's user avatar
  • 57
0 votes
2 answers
556 views

Cannot delete python object instance

For an example, I have a class A: def start(): global object object = A() def stop(): del object I got an error local variable 'object' referenced before assignment I want to store a ...
user9212072's user avatar
0 votes
1 answer
58 views

Global scope object with constructor

I've created a function that iterates thru some data and creates several objects to hold that data. Everything works as expected, but i now realize that these objects aren't accessible outside the ...
Pacmyc's user avatar
  • 29
0 votes
1 answer
168 views

Javascript: Any way to shorten local usage of nested objects?

After coding a complex board game with a ton of variables, objects, and arrays, I've been told that global variables are bad, for various reasons. One solution given was to wrap the entire javascript ...
Jack Chandelier's user avatar
1 vote
2 answers
160 views

Where to declare a public object which refer to a VB object?

First time that I use Visual Studio and VB.net. Could someone explain to me where to declare a public object which refers to a VB object ? This code works fine : Public Class Form1 Private ThePen ...
Goood's user avatar
  • 21
0 votes
0 answers
61 views

Global objects in C# ASP.Net - always null when read back

In an ASP.Net project, using C#, I have a class (PlcComms.cs) for talking to a Controller (a PLC). I want the one class object to be globally available, for each web page in my project. I see from ...
ianRobo75's user avatar

15 30 50 per page
1
2 3 4 5 6