Thanks for your good intentions, but again JS is not new to me..
If you would like to help please read my initial e-mail, take a look at the
mooshell example I put up and check your console.log I printed.

My point is that I want to keep the scope to the calling functions own scope
while passing in parameters from another object instance scope, hope this
will help clarify a bit:
http://mootools.net/shell/ck72p/1/


On Sun, Jan 24, 2010 at 3:33 PM, Barry van Oudtshoorn <
[email protected]> wrote:

>  I didn't mean to condescend... It looks like I didn't quite understand the
> question. Sorry about that.
>
> Does this (http://mootools.net/shell/Jwsxu/) answer the question, or am I
> completely missing your intention here?
>
>
> On 24/01/2010 9:01 PM, Roman Land wrote:
>
> Hi Barry,
>
> The basic and some of the advanced concepts are clear to me in JS, this
> does not answer my question..
>
> Thanks,
> Roman
>
> On Sun, Jan 24, 2010 at 2:56 PM, Barry van Oudtshoorn <
> [email protected]> wrote:
>
>>  Hopefully this (http://mootools.net/shell/gs4QG/) will help to explain
>> it. :)
>>
>>
>>
>> On 24/01/2010 7:58 PM, Roman Land wrote:
>>
>> This is not what I need, I need a way to access the properties of object
>> who called this function, while when defining the function also access
>> inside of it two other objects..
>>
>> var myobj = new Object();
>> mypbj.val1 = 'useful param';
>> mypbj.useParam = function(val1/* but not really*/){
>>    //somehow get the val1 inside this function
>>    var _val1 = val1;
>>    this.process(_val1);
>> } // here I can use .bind / .pass - but they are not work since they will
>> override the instance variables of the calling object
>>
>> otherobj = new Object();
>> otherobj.process = function(val){
>>    console.log(val);
>> }
>> otherobj.callback = myobj.useParam;
>>
>> Can this be done in JS somehow?
>>
>> Thanks!
>> Roman
>>
>> On Sun, Jan 24, 2010 at 12:18 PM, ken <[email protected]> wrote:
>>
>>> (function() {console.log(this)}.bind('Hello world'))(); // this refers
>>> to Hello world
>>> (function() {console.log(this)}.pass('Hello world'))(); // this refers
>>> to window
>>> (function(message) {console.log(message)}.pass('Hello world'))(); //
>>> this refers to window but logs Hello world
>>>
>>> On Jan 24, 6:00 pm, Roman Land <[email protected]> wrote:
>>> > Hi,
>>> >
>>> > After reading the code I understand that .pass and .bind are
>>> essentially the
>>> > same, the difference being that with .pass the bind can be null.
>>> > Although the binding is null the original object closure is still lost
>>> in
>>> > the current context, example:http://mootools.net/shell/ck72p/
>>> >
>>> > I dont know if its possible but I am looking for a way to pass an
>>> argument
>>> > at function deceleration time and get it as part of the "this" or as an
>>> > argument, is there a way to achieve this?
>>> >
>>> > Thanks!
>>> > Roman
>>> >
>>> > --
>>> > ---
>>> > "Make everything as simple as possible, but not simpler."
>>> >
>>> > - Albert Einstein
>>>
>>
>>
>>
>> --
>> ---
>> "Make everything as simple as possible, but not simpler."
>>
>> - Albert Einstein
>>
>>
>>
>
>
> --
> ---
> "Make everything as simple as possible, but not simpler."
>
> - Albert Einstein
>
>
>


-- 
---
"Make everything as simple as possible, but not simpler."

- Albert Einstein

Reply via email to