@@ -12,45 +12,32 @@ API.console.log("init panel");
1212 icon : "./FirePHP_16.png" ,
1313 url : "./panel.html" ,
1414
15- /**
16- * Executed by the framework when an instance of this panel is created.
17- * There is one instance of this panel per {@Toolbox }. The panel is
18- * instantiated when selected in the toolbox for the first time.
19- */
20- initialize : function ( options ) {
2115
22- API . console . log ( "initialize()" ) ;
23- API . console . log ( "initialize() this" , this ) ;
24- API . console . log ( "initialize() options" , options ) ;
2516
17+ setup : function ( { debuggee} ) {
18+ this . debuggee = debuggee ;
2619 } ,
27-
28- /**
29- * Executed by the framework when the panel is destroyed.
30- */
3120 dispose : function ( ) {
32- API . console . log ( "dispose()" ) ;
21+ this . debuggee = null ;
3322 } ,
3423
35- /**
36- * Executed by the framework when the panel content iframe is
37- * constructed. Allows e.g to connect the backend through
38- * `debuggee` object
39- */
40- setup : function ( options ) {
41- // TODO: connect to backend using options.debuggee
4224
43- API . console . log ( "setup()" ) ;
44- API . console . log ( "setup() options" , options ) ;
25+ onReady : function ( ) {
4526
46- /*
47- options.frame.contentWindow.addEventListener("message", function (event) {
48- API.console.log("GOT MESSAGE IN PANEL:", event.data);
49- }, false);
50- */
27+ API . console . log ( "this.debuggee" , this . debuggee ) ;
28+
29+ this . debuggee . onmessage = function ( event ) {
30+
31+ API . console . log ( "received message from devtools panel!!!" , event ) ;
32+
33+ }
34+
35+ this . postMessage ( "message from panel" , [ this . debuggee ] ) ;
36+ } ,
5137
5238
5339
40+ /*
5441 var panel = API.PANEL.Panel({
5542 contentURL: "./viewer.html",
5643 contentScriptFile: API.SELF.data.url("viewer.js")
@@ -69,14 +56,8 @@ API.TIMERS.setInterval(function () {
6956
7057}, 2000);
7158
59+ */
7260
73-
74-
75-
76-
77- API . console . log ( "setup() DONE" ) ;
78-
79- }
8061 } ) ;
8162
8263API . console . log ( "register panel" ) ;
0 commit comments