Observer constructor.
@param Cptfn {Function} the component constructor
343899
function (Cptfn) {
        if (!Cptfn || Cptfn.constructor !== Function) {
            log.error("[CptWrapper] Invalid Component constructor!");
        } else {
            this.cpt = new Cptfn();
            this.nodeInstance = null; // reference to set the node instance adirty when an attribute changes
            this.root=null; // reference to the root template node
            this.initialized = false;
            this.needsRefresh = true;

            // update attribute values for simpler processing
            var atts = this.cpt.$attributes, att, bnd;
            if (atts) {
                for (var k in atts) {
                    att = atts[k];
                    if (k.match(/^on/)) {
                        // this is a callback
                        if (!att.type) {
                            log.error("Attribute type 'callback' should be set to '" + k + "'");
                        } else if (att.type !== "callback") {
                            log.error("Attribute type 'callback' should be set to '" + k + "' instead of: "
                                    + att.type);
                            att.type = "callback";
                        }
                        continue;
                    }

                    bnd = att.binding;
                    // set the internal _binding value 0=none 1=1-way 2=2-way
                    if (bnd) {
                        bnd = BINDING_VALUES[bnd];
                        if (bnd !== undefined) {
                            att._binding = bnd;
                        } else {
                            log.error("Invalid attribute binding value: " + att.binding);
                            att._binding = 0;
                        }
                    } else {
                        att._binding = 0;
                    }

                    // check type
                    if (att.type) {
                        if (att.type === "callback") {
                            log.error("Attribute of type 'callback' must start with 'on' - please rename: " + k);
                        } else if (ATTRIBUTE_TYPES[att.type] === undefined) {
                            log.error("Invalid attribute type: " + att.type);
                            att.type = 'string';
                        }
                    } else {
                        att.type = 'string';
                    }
                }
            }
        }
    }
10212
def observer(self, component_type=ComponentType):
        
        def inner(func):
            self.add_observer(func, component_type)
            return func
        return inner
107836
static void addAttachObserver(HTMLElement element, ObserverCallback callback) {
        if (!ready) {
            startObserving();
        }
        attachObservers.add(createObserver(element, callback, ATTACH_UID_KEY));
    }
1258746
function (component) {
	_invoke_change_detector(component);

	var i = 0;
	for (; i < component.directives.length; ++i) {
		_invoke_change_detector(component.directives[i]);
	}

	for (i = 0; i < component.children.length; ++i) {
		invoke_change_detector(component.children[i]);
	}
}
458190
function (config) {
  events.EventEmitter.call(this);

  this.config = config;
  this.ignoreFiles = config.ignoreFiles || ['.codiusignore'];

  this._filesystem = Compiler.RealFilesystem;
}
544779
@SuppressWarnings("unused")
    private void initializeClientPolling(Component component) {

        if (component instanceof AbstractComponent) {
            AbstractComponent acomp = (AbstractComponent)component;
            for (Extension extension : acomp.getExtensions()) {
                if (extension instanceof CmsPollServerExtension) {
                    return;
                }
            }
            new CmsPollServerExtension((AbstractComponent)component);
        }
    }
912189
function callObservers(object, chgeset) {
    var ln = object[OBSERVER_PROPERTY];
    if (ln) {
        var elt;
        for (var i = 0, sz = ln.length; sz > i; i++) {
            elt = ln[i];
            if (elt.constructor === Function) {
                elt(chgeset);
            }
        }
    }
}
770817
protected static function init_all_observers() {
        global $CFG;

        if (is_array(self::$allobservers)) {
            return;
        }

        if (!PHPUNIT_TEST and !during_initial_install()) {
            $cache = \cache::make('core', 'observers');
            $cached = $cache->get('all');
            $dirroot = $cache->get('dirroot');
            if ($dirroot === $CFG->dirroot and is_array($cached)) {
                self::$allobservers = $cached;
                return;
            }
        }

        self::$allobservers = array();

        $plugintypes = \core_component::get_plugin_types();
        $plugintypes = array_merge(array('core' => 'not used'), $plugintypes);
        $systemdone = false;
        foreach ($plugintypes as $plugintype => $ignored) {
            if ($plugintype === 'core') {
                $plugins['core'] = "$CFG->dirroot/lib";
            } else {
                $plugins = \core_component::get_plugin_list($plugintype);
            }

            foreach ($plugins as $plugin => $fulldir) {
                if (!file_exists("$fulldir/db/events.php")) {
                    continue;
                }
                $observers = null;
                include("$fulldir/db/events.php");
                if (!is_array($observers)) {
                    continue;
                }
                self::add_observers($observers, "$fulldir/db/events.php", $plugintype, $plugin);
            }
        }

        self::order_all_observers();

        if (!PHPUNIT_TEST and !during_initial_install()) {
            $cache->set('all', self::$allobservers);
            $cache->set('dirroot', $CFG->dirroot);
        }
    }
650260
function ComponentHint(options) {
	// Make this an event emitter
	EventEmitter.call(this);

	// List of all components that have been checked, we keep this list so that the same components
	// are not checked twice.
	this.lintedComponents = [];

	// Object holding all external dependencies and their versions
	this.dependencyVersions = {};

	// Set linting options from given options or defaults
	options = options || {};
	this.depPaths = options.depPaths || [];
	this.lookupPaths = options.lookupPaths || [];
	this.recursive = options.recursive || false;
	this.verbose = options.verbose || false;
	this.quiet = options.quiet || false;
	this.silent = options.silent || false;
	this.ignorePaths = options.ignorePaths || [];
	this.warnPaths = options.warnPaths || [];

	// Inject default dep path if it exists
	if (!this.depPaths.length && fs.existsSync('./components')) {
		this.depPaths.push('./components');
	}

	// Keep a count of total errors and warnings
	this.totalErrors = 0;
	this.on('lint.error', function () {
		this.totalErrors += 1;
	});

	this.totalWarnings = 0;
	this.on('lint.warning', function () {
		this.totalWarnings += 1;
	});
}
859328
function () {
            /*  determine parameters  */
            var params = $cs.params("observe", arguments, {
                name:        { pos: 0, req: true,   valid: "string"        },
                func:        { pos: 1, req: true,   valid: "function"      },
                touch:       {         def: false,  valid: "boolean"       },
                boot:        {         def: false,  valid: "boolean"       },
                op:          {         def: "set",  valid: /^(?:get|set|changed|splice|delete)$/ },
                spool:       {         def: null,   valid: "(null|string)" },
                noevent:     {         def: false,  valid: "boolean"       }
            });

            /*  parse the value name into selection path segments  */
            var path = _cs.select_parse(params.name);

            /*  determine the actual component owning the model
                as we want to subscribe the change event there only  */
            var owner = null;
            var model = null;
            var comp  = this;
            while (comp !== null) {
                owner = comp.property({ name: "ComponentJS:model", returnowner: true });
                if (!_cs.isdefined(owner))
                    throw _cs.exception("observe", "no model found containing value \"" + path[0] + "\"");
                model = owner.property("ComponentJS:model");
                if (_cs.isdefined(model.spec[path[0]]))
                    break;
                comp = owner.parent();
            }
            if (comp === null)
                throw _cs.exception("observe", "no model found containing value \"" + path[0] + "\"");

            /*  support wildcard matching and always match childs  */
            var name = path.join(".")
                .replace(/\./g, "\\.")
                .replace(/\*\*/g, ".+?")
                .replace(/\*/g, "[^.]+");
            name += "(?:\\.[^.]+)*";

            /*  subscribe to model value change event  */
            var id = owner.subscribe({
                name:      new RegExp("ComponentJS:model:" + name + ":" + params.op),
                capturing: false,
                spreading: false,
                bubbling:  false,
                noevent:   params.noevent,
                func:      params.func
            });

            /*  mark component for having subscribers of operation
                (for performance optimization reasons)  */
            var key = "ComponentJS:model:subscribers:" + params.op;
            var subscribers = owner.property({ name: key, def: 0 });
            subscribers += 1;
            owner.property({ name: key, value: subscribers });

            /*  optionally spool reverse operation  */
            if (params.spool !== null) {
                var info = _cs.spool_spec_parse(this, params.spool);
                info.comp.spool(info.name, this, "unobserve", id);
            }

            /*  if requested (for a one-time initial observer run),
                either touch the model value once (which causes _all_ observers to trigger!)
                or do a "bootstrapping execution" of only our callback function once  */
            if (params.touch)
                this.touch(params.name);
            else if (params.boot) {
                var value = this.value(params.name);
                var args = [ value, value, params.op, path.join(".") ];
                if (!params.noevent) {
                    args.unshift($cs.event({
                        name:        params.name,
                        spec:        {},
                        async:       false,
                        result:      undefined,
                        target:      this,
                        propagation: true,
                        processing:  true,
                        dispatched:  false
                    }));
                }
                params.func.apply(this, args);
            }

            return id;
        }
847811
function(value, fn) {
        if(value.constructor === Function ) {
            this.default_handler = value;
        } else if(value.constructor === Number) {
            this.on_args[value] = fn;
        } else {
            this.on_switches[value] = fn;
        }
    }
530478
function(arg) {
    this.isCptComponent = true;
    this.ctlConstuctor=arg.ctlConstuctor;

    if (this.template) {
      // this component is associated to a template
      this.createPathObservers();
      this.createCommentBoundaries("cpt");
      this.createChildNodeInstances();

      // $init child components
      this.initChildComponents();
      this.ctlWrapper.refresh(); // first refresh
    } else if (arg.cptattelement) {
      // this component is an attribute of another component
      var cw=cptwrapper.createCptWrapper(this.ctlConstuctor, this.getCptArguments());
      this.ctlWrapper=cw;
      this.controller=cw.cpt;
      if (cw.cpt.tagName) {
          log.error(this+" 'tagName' is a reserved keyword and cannot be used in component controllers");
      }
      cw.cpt.tagName=this.tagName;
      // NB the controller $init has not been called yet - this will be done once the parent component has initialized
    }
  }
1006658
function addComponentNodeListener (node, eventName, handler) {
  /* istanbul ignore next */
  if (!node.componentOptions.listeners) {
    node.componentOptions.listeners = {};
  }

  mergeVNodeListeners(node.componentOptions.listeners, eventName, handler);
}
374677
function(node, component){
		node.component = component;
		component.nodes.push(node);
		this.setComponentInfo(component);
	}
221288
function AsyncSubject() {
      __super__.call(this);
      this.isDisposed = false;
      this.isStopped = false;
      this.hasValue = false;
      this.observers = [];
      this.hasError = false;
    }
707938
function (object, property, value) {
        if (object[OBSERVER_PROPERTY]) {
            var exists = ownProperty.call(object, property), oldVal = object[property], sz1 = object.length, chgset=null;
            object[property] = value;

            if (!exists) {
                chgset=[changeDesc(object, property, value, oldVal, "new")];
            } else if (oldVal !== value) {
                // do nothing if the value did not change or was not created:
                chgset=[changeDesc(object, property, value, oldVal, "updated")];
            }
            if (object.constructor === Array) {
                var sz2 = object.length;
                if (sz1 !== sz2) {
                    if (!chgset) {
                        chgset=[];
                    }
                    chgset.push(changeDesc(object, "length", sz2, sz1, "updated"));
                }
            }
            if (chgset) {
                callObservers(object, chgset);
            }
        } else {
            object[property] = value;
        }
        return value;
    }
1277052
function ( fn, state ) {
		state = state || "all";

		return observer.add( global, "message", fn, "message", global, state );
	}