0

is there a way to callback a class object from popup window.

i know there is way to callback a function:

window.opener.MyFunction();

but i want to know, how to call class method

new Profile('me', 'id');

im not sure how to do it, but just to give you idea

window.opener.'new Profile('me', 'id');';

yes i know, its not valid js code, but its just to give you idea :)

Basit
  • 16,316
  • 31
  • 93
  • 154

1 Answers1

1

Profile is a property of window.opener.
You can use it like any other property:

new window.opener.Profile(...);

new is an operator that acts on a function; you can use it with any expression that returns a function.
You can even write

new (function() { ...}) (...);

For more pathological corner cases of this behavior, see this answer.

Community
  • 1
  • 1
SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964