How to use the metal-incremental-dom.renderChild function in metal-incremental-dom

To help you get started, we’ve selected a few metal-incremental-dom 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-jsx / src / iDOMHelpers.js View on Github external
scope.iDOMHelpers.renderArbitrary = function(child) {
	const type = typeof child;
	if (type === 'number' || (type === 'string' || child && child instanceof String)) {
		IncrementalDOM.text(child);
	} else if (type === 'function' && child.__jsxDOMWrapper) {
		child();
	} else if (Array.isArray(child)) {
		child.forEach(scope.iDOMHelpers.renderArbitrary);
	} else if (String(child) === '[object Object]') {
		// Renders special incremental dom nodes in a special way :)
		if (IncrementalDomRenderer.isIncDomNode(child)) {
			IncrementalDomRenderer.renderChild(child);
		} else {
			scope.iDOMHelpers.forOwn(child, scope.iDOMHelpers.renderArbitrary);
		}
	} else if (!child) {
		JSXRenderer.skipChild();
	}
};
github metal / metal.js / packages / metal-jsx / src / iDOMHelpers.js View on Github external
globals.window.iDOMHelpers.renderArbitrary = function(child) {
	const type = typeof child;
	if (type === 'number' || (type === 'string' || child && child instanceof String)) {
		IncrementalDOM.text(child);
	} else if (type === 'function' && child.__jsxDOMWrapper) {
		child();
	} else if (Array.isArray(child)) {
		child.forEach(globals.window.iDOMHelpers.renderArbitrary);
	} else if (String(child) === '[object Object]') {
		// Renders special incremental dom nodes in a special way :)
		if (IncrementalDomRenderer.isIncDomNode(child)) {
			IncrementalDomRenderer.renderChild(child);
		} else {
			globals.window.iDOMHelpers.forOwn(child, globals.window.iDOMHelpers.renderArbitrary);
		}
	} else if (!child) {
		JSXRenderer.skipChild();
	}
};

metal-incremental-dom

A Component renderer for templates compiled to incremental dom

BSD
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis