/pyjs/tests/test012.js
JavaScript | 30 lines | 30 code | 0 blank | 0 comment | 6 complexity | 88c0824571d59a1c0dae80b8145ad56f MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
- __Widget.prototype.__class__ = "Widget";
- function Widget() {
- return new __Widget();
- }
- function __Widget() {
- this.attached = false;
- }
- __Widget.prototype.setParent = function(parent) {
- this.parent = parent;
- if ((parent == null)) {
- this.onDetach();
- }
- else if (parent.attached) {
- this.onAttach();
- }
- };
- __Widget.prototype.onAttach = function() {
- if (this.attached) {
- return;
- }
- this.attached = true;
- DOM_setEventListener(this.getElement(), this);
- };
- __Widget.prototype.onDetach = function() {
- if (!(this.attached)) {
- return;
- }
- this.attached = false;
- DOM_setEventListener(this.getElement(), null);
- };