Source: jaws/View.js

import { Shark } from "../Shark";
import RenderableJaw from "./RenderableJaw";

/**
 * The Class to extend to create View classes.
 * 
 * @constructor
 * @param {string} jawId - The internal id taht will identify the View class.
 * @param {object} jawDefinition - An object with method to assign to this class. <strong>This parameter is deprecated and will be removed. Still exisists for back-compatibility reason.</strong>
 * 									The <code>jawDefinition</code> parameter is deprecated and will be removed. Still exisists for back-compatibility reason.
 */
class View extends RenderableJaw {
	constructor (jawId, jawDefinition) {
		super(jawId, jawDefinition);
		
		// Dave: nice, but should manage different values for locale
		Object.defineProperty(this, "$mainRoute", {
			configurable: false,
			enumerable: true,
			value: "",
			writable: true,
		});

		Object.defineProperty(this, "type", {
			configurable: false,
			enumerable: true,
			value: "view",
			writable: false,
		});

		Shark.registerView(this);
	}

	/**
	 * Add an HTML template to this View.
	 *
	 * @returns {object} The complete list of Templates.
	 * @static
	 * @version 1.0.0, 2020.09.08
	 *
	 * @param {string} name - The name that will be used in container templates to print this template. If <code>null</code> or empty this will be the default template. There could be only one default template. Can be any string except "__default__" that is a reserved name.
	 * @param {string} content - The template HTML content.
	 * @deprecated
	 */
	addTemplate (name, content) {
		//throw(new Error("View instance's can only have one template, use setTemplate method."))
		console.warn("View instance's can only have one template, addTemplate method will be removed, use setTemplate method.")
		return super.setTemplate(content);
	}
}

export default View ;