- or download this
repl.link = function(obj) {
if (! repl.linkedVars) {
...
} else {
return undefined
}
- or download this
sub link {
my ($repl,$obj) = @_;
...
return undef
};
};
- or download this
package MozRepl::RemoteObject;
sub new {
...
my ($class, $js) = @_;
return $class->new( javascript_eval($js)); # assuming that it retu
+rns an object
};
- or download this
sub DESTROY {
my ($self) = @_;
...
$self->expr("repl.breakLink($self->{id})");
};
};
- or download this
repl.breakLink = function(id) {
delete repl.linkedVars[ id ];
}
- or download this
sub breakLink {
my ($repl,$id) = @_;
delete $repl->{linkedVars}->{id};
};
- or download this
my $doc_a = MozRepl::RemoteObject->expr('window.document'); # id 42
my $doc_b = MozRepl::RemoteObject->expr('window.document'); # id 43