How to use the metal-incremental-dom.constructor 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-soy / src / Soy.js View on Github external
'use strict';

import 'metal-soy-bundle';
import { isFunction, isObject, isString, globals, object } from 'metal';
import { ComponentRegistry } from 'metal-component';
import HTML2IncDom from 'html2incdom';
import IncrementalDomRenderer from 'metal-incremental-dom';
import SoyAop from './SoyAop';

// The injected data that will be passed to soy templates.
let ijData = {};

class Soy extends IncrementalDomRenderer.constructor {
	/**
	 * Adds the template params to the component's state, if they don't exist yet.
	 * @param {!Component} component
	 * @return {Object}
	 */
	getExtraDataConfig(component) {
		let elementTemplate = component.constructor.TEMPLATE;
		if (!isFunction(elementTemplate)) {
			return;
		}

		elementTemplate = SoyAop.getOriginalFn(elementTemplate);
		this.soyParamTypes_ = elementTemplate.types || {};

		const keys = elementTemplate.params || [];
		const configs = {};
github metal / metal.js / packages / metal-soy / src / Soy.js View on Github external
'use strict';

import 'metal-soy-bundle';
import { ComponentRegistry } from 'metal-component';
import { isFunction, isObject, isString, object } from 'metal';
import { validators, Config } from 'metal-state';
import IncrementalDomRenderer, { HTML2IncDom } from 'metal-incremental-dom';
import SoyAop from './SoyAop';

// The injected data that will be passed to soy templates.
let ijData = {};

class Soy extends IncrementalDomRenderer.constructor {
	/**
	 * Adds the template params to the component's state, if they don't exist yet.
	 * @param {!Component} component
	 * @return {Object}
	 */
	getExtraDataConfig(component) {
		let elementTemplate = component.constructor.TEMPLATE;
		if (!isFunction(elementTemplate)) {
			return;
		}

		elementTemplate = SoyAop.getOriginalFn(elementTemplate);
		this.soyParamTypes_ = elementTemplate.types || {};

		const keys = elementTemplate.params || [];
		const configs = {};
github metal / metal.js / packages / metal-jsx / src / JSXRenderer.js View on Github external
'use strict';

import { isDefAndNotNull } from 'metal';
import IncrementalDomRenderer from 'metal-incremental-dom';

const COUNT_PROP = '__metalJsxCount';
const INC_DOM_DATA = '__incrementalDOMData';
const KEY_PREFIX = '_metal_jsx_';

/**
 * Renderer that handles JSX.
 */
class JSXRenderer extends IncrementalDomRenderer.constructor {
	/**
	 * @inheritDoc
	 */
	buildShouldUpdateArgs(changes) {
		return [changes.state, changes.props];
	}

	/**
	 * Called when generating a key for the next dom element to be created via
	 * incremental dom. Adds keys to elements that don't have one yet, according
	 * to their position in the parent. This helps use cases that use
	 * conditionally rendered elements, which is very common in JSX.
	 * @param {!Component} component
	 * @param {string} key
	 * @return {?string}
	 */

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