How to use the metal.isServerSide function in metal

To help you get started, we’ve selected a few metal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electricjs / electric / packages / electricjs.com / src / partials / Sidebar.js View on Github external
disposed() {
		if (isServerSide()) {
			return;
		}

		this._toggler.dispose();
	}
};
github electricjs / electric / packages / electric-base-components / src / ElectricReadingProgress.js View on Github external
attached() {
		if (isServerSide()) {
			return;
		}

		this.renderReadingProgress_();
	}
github electricjs / electric / packages / electric-base-components / src / ElectricCode.js View on Github external
attached() {
		if (isServerSide()) {
			return;
		}

		const selector = '.code-container .btn-copy';

		if (!window.electricClipboardTooltip) {
			window.electricClipboardTooltip = new Tooltip({
				delay: [300, 150],
				elementClasses: 'fade',
				events: {
					visibleChanged: function(event) {
						if (event.newVal) {
							this.title = 'Copy';
						}
					}
				},
github metal / metal.js / packages / metal-incremental-dom / src / render / attributes.js View on Github external
function setBooleanAttr_(element, name, value) {
	if (isServerSide()) {
		return;
	}
	element[name] = value;
	if (value) {
		element.setAttribute(name, '');
	} else {
		element.removeAttribute(name);
	}
}
github electricjs / electric / packages / electric-base-components / src / ElectricSearch.js View on Github external
attached() {
		if (isServerSide()) {
			return;
		}

		ElectricSearchBase.prototype.attached.apply(this);

		const queryString = window.location.search;
		const queryIndex = queryString.indexOf('q=');

		if (queryIndex !== -1) {
			this.query = queryString.substr(queryIndex + 2);
		}
	}
github electricjs / electric / packages / electric-marble-components / src / ElectricNavigation.js View on Github external
attached() {
  	if (isServerSide()) {
      return;
    }

    this.toggler = new Toggler({
      content: `.${this.listClasses}`,
      header: `.${this.togglerClasses}`,
      expandedClasses: 'topbar-list-expanded'
    });
  }
github metal / metal.js / packages / metal-incremental-dom / src / render / attributes.js View on Github external
function setValueAttrAsProperty_(element, name, value) {
	if (isServerSide()) {
		return;
	}
	if (name === 'value' && element.value !== value) {
		element[name] = value;
	}
}
github LiferayCloud / marble / packages / marble-chart / src / Chart.js View on Github external
attached() {
    if (isServerSide()) {
      return;
    }

    this.chart = new ChartJS(this.refs.canvas, {
      type: this.type,
      data: this.data,
      options: this.options,
    });
  }
github metal / metal.js / packages / metal-dom / src / events.js View on Github external
};
	Object.keys(animationEventMap).forEach(function(eventType) {
		const eventName = animationEventMap[eventType];
		registerCustomEvent(eventName, {
			event: true,
			delegate: true,
			handler: function(callback, event) {
				event.customType = eventName;
				return callback(event);
			},
			originalEvent: features.checkAnimationEventName()[eventType]
		});
	});
}

if (!isServerSide()) {
	registerEvents();
}