value: function update()

in lib/Bootstrapper.js [199:240]


		value: function update(node) {
			var _this3 = this;

			var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

			// Check if we have a container before attempting an update
			if (!this.__container__) {
				_callback(cb);
				return;
			}

			var target = node || window.document.body;
			var query = target.querySelectorAll('[' + this.componentSelector + ']');

			if (!query.length) {
				// Nothing to update
				return;
			}

			// Lifecycle event
			// Hook to allow developers to cancel operation
			if (typeof this.shouldUpdate === 'function') {
				if (this.shouldUpdate(target, query) === false) {
					_callback(cb, this);
					return;
				}
			}

			// Lifecycle event
			if (typeof this.willUpdate === 'function') {
				this.willUpdate(target, query);
			}

			this._apply(query, function () {
				// Lifecycle event
				if (typeof _this3.didUpdate === 'function') {
					_this3.didUpdate(target);
				}

				_callback(cb, _this3);
			});
		}