On Jun 26, 4:53*pm, Gregor Kofler <use...@gregork ofler.atwrote:
How can I access a private variable when replacing a private function,
which originally had access to this variable, with another one? Or is it
just not possible?
If possible for your scenario, you could potentially use eval for
this. For example: - function MyClass(val)
-
{
-
var printIt = function () { window.alert("1:" + val); }
-
this.callPrintIt = function () { printIt(); }
-
this.setPrintIt = function (evalStr) { eval("printIt = " +
-
evalStr); }
-
}
-
-
var c = new MyClass("test");
-
c.callPrintIt();
-
c.setPrintIt("function () { window.alert(\"2:\" + val); }");
-
c.callPrintIt();
Thanks
1 1405 ag*******@gmail .com meinte:
On Jun 26, 4:53 pm, Gregor Kofler <use...@gregork ofler.atwrote:
>How can I access a private variable when replacing a private function, which originally had access to this variable, with another one? Or is it just not possible?
If possible for your scenario, you could potentially use eval for
this.
No I never thought of eval() - for a lot of reasons. Anyway, it might
work in this example, but not in my real life problem, where a mousemove
listener is replaced by a custom function, which should still be able to
access the "hidden" variables of the object.
Gregor
-- http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie http://web.gregorkofler.com ::: meine JS-Spielwiese http://www.image2d.com ::: Bildagentur für den alpinen Raum This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy |
last post by:
1) Is there any use of defining a class with a single constructor
declared in private scope? I am not asking a about private copy
constructors to always force pass/return by reference.
2) Is this in any way used to create singletons. Can someone say how?
Cheers,
Andy
|
by: Suzi Carr |
last post by:
Hello,
We create querydefs in VB programs (i.e. CreateQueryDef). But as illustrated
below, Access regenerates the SQL code we specify -- particularly the WHERE
clause. While the new code is logically equivalent, it often results in MUCH
slower query performance and this has become a big problem in some
applications. If we go to query design mode, we can see that our code was
replaced. When we manually change it back, the query runs much...
|
by: jacob navia |
last post by:
Hi guys!
I like C because is fun. So, I wrote this function for the lcc-win32
standard library: strrepl.
I thought that with so many "C heads" around, maybe we could improve it
in a collective brainstorming session.
Let's discuss some C here, for a change :-)
|
by: Chris A via AccessMonster.com |
last post by:
I have an interesting problem that I have yet to come accross that I can't
change data structure on because it is an export from filemaker I am
reformatting for another dept. anyway. I have a table like so...
Table 1
Field1 Field2 Field3
E1 April 2006 AA, BB, CC
E2 April 2006 AA, BB, CC,DD, EE
E3 April 2006 AA, BB
|
by: amraam35 |
last post by:
Here is the problem. I have made a log in script that prompts you to log in with a username and password as the "splash screen" It is an unbounded forum that checks that the username and password are in the employee table, and that they are together, and if it is, it lets you log on. That works just fine. Then i tried to make a form that you can change your password if you please. It has 4 entrys, the user name, password, and then2 of the...
| |
by: CDMAPoster |
last post by:
About a year ago there was a thread about the use of global variables
in A97:
http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157
Best Practices by Kang Su Gatlin, casual mention was made about using
static variables as an alternative to using global variables. This
caused me to think of the following:
'-----Begin module code
|
by: rick |
last post by:
I have a situation where I want to write an extensible class that is
capable of saving / restoring properties of classes derived from it.
A simplified example is explained as follows;-
class A
{
private $Save ;
public function Push()
{
|
by: agendum97 |
last post by:
Is there a way of constructing a "class" in JavaScript to access a
private member of a different scope of the same type? It is important
that the variable remain private, and not accessible in anyway
publically. For example:
function SomeObj(privateKey)
{
this.process = function(someObj)
{
if (!(someObj instanceof SomeObj))
|
by: Thomas 'PointedEars' Lahn |
last post by:
Gregor Kofler wrote:
I am curious, why did you choose to use a factory instead of a constructor?
It's a closure and `privateVar' in privateFunc() is bound to the execution
context of foo(), in which `privateFunc' was declared a variable. However,
the function expression in the obj.replacePF() call creates a closure in
which `privateVar' is bound to the execution context in which the call is
executed and the anonymous Function object...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |