Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28842

Re: Overwriting existing fucntion

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Overwriting existing fucntion
Date 2015-10-19 13:14 +0200
Organization albasani.net
Message-ID <n02jb7$qrl$1@news.albasani.net> (permalink)
References <CbCdnUFUDeXC3rnLnZ2dnUU7-amdnZ2d@westnet.com.au> <n01mji$k3l$1@news.albasani.net>

Show all headers | View raw


On 2015-10-19 05:04, Stefan Weiss wrote:
> Object.defineProperty(window, "action70", { value: my_action70 });

Actually, scratch that. If a simple `action70 = ...` works in the
context you describe, then that's all you need. It would be cleaner to
explicitly set `window.action70` in your code, or to declare a global
`action70` variable (if you can), so that the purpose of the assignment
is immediately obvious to the reader.

`Object.defineProperty()` only has an advantage if the application code
also tries to set `window.action70` or assigns to `action70` without
declaring it, which sounds unlikely from what you wrote.


- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Overwriting existing fucntion Andrew Poulos <ap_prog@hotmail.com> - 2015-10-19 12:12 +1100
  Re: Overwriting existing fucntion Andrew Poulos <ap_prog@hotmail.com> - 2015-10-19 13:57 +1100
  Re: Overwriting existing fucntion Stefan Weiss <krewecherl@gmail.com> - 2015-10-19 05:04 +0200
    Re: Overwriting existing fucntion Stefan Weiss <krewecherl@gmail.com> - 2015-10-19 13:14 +0200
  Re: Overwriting existing fucntion Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-19 19:49 +0200
    Re: Overwriting existing fucntion Andrew Poulos <ap_prog@hotmail.com> - 2015-10-20 10:18 +1100
      Re: Overwriting existing fucntion Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-20 02:17 +0200
    Re: Overwriting existing fucntion Stefan Weiss <krewecherl@gmail.com> - 2015-10-21 19:47 +0200
      Re: Overwriting existing fucntion Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-10-21 21:40 +0200
        Re: Overwriting existing fucntion Stefan Weiss <krewecherl@gmail.com> - 2015-10-22 03:04 +0200
  Re: Overwriting existing fucntion Danny <dann90038@gmail.com> - 2015-10-19 13:29 -0700

csiph-web