RoutesMaker/Public/ecma/Interfaces/MapDriverInterface.ecma.js

110 lines
2.6 KiB
JavaScript

"use strict";
import {EventModel} from "../Models/EventModel.ecma.js";
/**
* @typedef {import("../Application/RoutesMaker.ecma.js").RoutesMaker} RoutesMaker
* @typedef {import("../Models/DotModel.ecma.js").DotModel} DotModel
*/
/**
* @class
* @constructor
* @param {!RoutesMaker} routes_maker
* @param {?(Object.<string, any|null>|Array.<any|null>)} [inputs = null]
* @returns {void}
* @access public
* @static
*/
export const MapDriverInterface = (function(){
/**
* @constructs MapDriverInterface
* @param {!RoutesMaker} routes_maker
* @param {?(Object.<string, any|null>|Array.<any|null>)} [inputs = null]
* @returns {void}
* @access public
* @static
*/
const MapDriverInterface = function(routes_maker, inputs = null){
this.map = null;
/** @type {HTMLElement} */
this.box = null;
/** @type {EventModel} */
this.on_click = new EventModel();
/**
* @param {!HTMLElement} box
* @returns {void}
* @access public
*/
this.build = box => {};
/**
* @param {!DotModel} dot
* @returns {void}
* @access public
*/
this.add_dot = dot => {};
/**
* @param {!DotModel} dot
* @returns {void}
* @access public
*/
this.remove_dot_line = dot => {};
/**
* @param {!DotModel} dot
* @returns {void}
* @access public
*/
this.remove_dot_lines = dot => {};
/**
* @param {!DotModel} dot
* @returns {void}
* @access public
*/
this.redraw_dot_lines = dot => {};
/**
* @param {!DotModel} dot
* @returns {void}
* @access public
*/
this.remove_dot = dot => {};
};
/**
* @param {?any} item
* @returns {boolean}
* @access public
* @static
*/
MapDriverInterface.check = item => {
/** @type {boolean} */
let ok = !!item
if(ok)
[
"map", "box", "on_click", "build", "add_dot", "remove_dot_line",
"remove_dot_lines", "redraw_dot_lines", "remove_dot"
].forEach(key => {
if(item[key] === undefined){
console.error([item, key, "attribute_not_exists"]);
ok && (ok = false);
};
});
else
console.error([item, null, "null_empty_undefined"]);
return ok;
};
return MapDriverInterface;
})();