How to use the metal-state.getStateStatic function in metal-state

To help you get started, we’ve selected a few metal-state 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 metal / metal.js / packages / metal-component / src / ComponentDataManager.js View on Github external
createState_(component, data) {
		const state = new State(
			component.getInitialConfig(),
			component,
			component
		); // eslint-disable-line
		state.setKeysBlacklist(BLACKLIST);
		state.configState(
			object.mixin({}, data, State.getStateStatic(component.constructor))
		);
		this.getManagerData(component).state_ = state;
	}
github metal / metal.js / packages / metal-web-component / src / define_web_component.js View on Github external
export function defineWebComponent(tagName, Ctor) {
	if (!('customElements' in window)) {
		return;
	}

	let observedAttributes = Object.keys(State.getStateStatic(Ctor));

	const props = getStaticProperty(Ctor, 'PROPS', mergeState);

	const hasProps = isObject(props) && Object.keys(props).length;

	if (hasProps) {
		observedAttributes = Object.keys(props);
	}

	/**
	 * Custom Element wrapper for Metal components.
	 *
	 * @constructor
	 * @extends HTMLElement
	 */
	function CustomElement() {
github metal / metal.js / packages / metal-jsx / src / JSXDataManager.js View on Github external
data.props_ = new State(comp.getInitialConfig(), comp.props, comp);
		data.props_.configState(
			object.mixin(
				{},
				config,
				getStaticProperty(ctor, 'PROPS', State.mergeState)
			)
		);
		this.addUnconfiguredProps_(comp, data.props_, comp.getInitialConfig());

		data.state_ = new State({}, comp.state, comp);
		data.state_.setEventData({
			type: 'state',
		});
		data.state_.configState(State.getStateStatic(ctor));
	}