How to use the metal.getUid 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 metal / metal.js / packages / metal-incremental-dom / src / render / render.js View on Github external
let Ctor = tagOrCtor;
	if (isString(Ctor)) {
		Ctor = ComponentRegistry.getConstructor(tagOrCtor);
	}

	const ref = getRef_(owner, config);
	let comp;
	if (isDef(ref)) {
		comp = match_(owner.components[ref], Ctor, config, owner);
		owner.components[ref] = comp;
		owner.refs[ref] = comp;
	} else {
		const data = getCurrentData();
		let key = config.key;
		if (!isDef(key)) {
			const type = getUid(Ctor, true);
			data.currCount = data.currCount || {};
			data.currCount[type] = data.currCount[type] || 0;
			key = `__METAL_IC__${type}_${data.currCount[type]++}`;
		}
		comp = match_(
			data.prevComps ? data.prevComps[key] : null,
			Ctor,
			config,
			owner
		);
		data.currComps = data.currComps || {};
		data.currComps[key] = comp;
	}

	return comp;
}
github liferay / senna.js / src / screen / HtmlScreen.js View on Github external
assertSameBodyIdInVirtualDocument() {
		var bodySurface = this.virtualDocument.querySelector('body');
		if (!globals.document.body.id) {
			globals.document.body.id = 'senna_surface_' + getUid();
		}
		if (bodySurface) {
			bodySurface.id = globals.document.body.id;
		}
	}
github liferay / senna.js / src / app / AppDataAttributeHandler.js View on Github external
updateElementIdIfSpecialSurface_(element) {
		if (!element.id && element === globals.document.body) {
			element.id = 'senna_surface_' + getUid();
		}
	}
github liferay / senna.js / src / screen / Screen.js View on Github external
constructor() {
		super();

		/**
		 * Holds the screen id.
		 * @type {string}
		 * @protected
		 */
		this.id = this.makeId_(getUid());

		/**
		 * Holds the screen meta tags. Relevant when the meta tags
		 * should be updated when screen is rendered.
		 */
		this.metas = null;

		/**
		 * Holds the screen title. Relevant when the page title should be
		 * upadated when screen is rendered.
		 * @type {?string=}
		 * @default null
		 * @protected
		 */
		this.title = null;
	}