PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/pyjs/tests/test012.js

http://pyjamas.googlecode.com/
JavaScript | 30 lines | 30 code | 0 blank | 0 comment | 6 complexity | 88c0824571d59a1c0dae80b8145ad56f MD5 | raw file
 1__Widget.prototype.__class__ = "Widget";
 2function Widget() {
 3    return new __Widget();
 4}
 5function __Widget() {
 6    this.attached = false;
 7}
 8__Widget.prototype.setParent = function(parent) {
 9    this.parent = parent;
10    if ((parent == null)) {
11    this.onDetach();
12    }
13    else if (parent.attached) {
14    this.onAttach();
15    }
16};
17__Widget.prototype.onAttach = function() {
18    if (this.attached) {
19    return;
20    }
21    this.attached = true;
22    DOM_setEventListener(this.getElement(), this);
23};
24__Widget.prototype.onDetach = function() {
25    if (!(this.attached)) {
26    return;
27    }
28    this.attached = false;
29    DOM_setEventListener(this.getElement(), null);
30};