/** * Custom Code Component * @param id * @param name * @param parentEntity * @param code * @param domElementId * @param args * @constructor */ GameLib.D3.API.CustomCode = function ( id, name, parentEntity, code, domElementId, args ) { if (GameLib.Utils.UndefinedOrNull(id)) { id = GameLib.Utils.RandomId(); } this.id = id; if (GameLib.Utils.UndefinedOrNull(name)) { name = 'CustomCode (' + this.id + ')'; } this.name = name; if (GameLib.Utils.UndefinedOrNull(parentEntity)) { parentEntity = null; } this.parentEntity = parentEntity; if (GameLib.Utils.UndefinedOrNull(code)) { code = ''; } this.code = code; if (GameLib.Utils.UndefinedOrNull(domElementId)) { domElementId = "CustomCode_" + this.id; } this.domElementId = domElementId; if (GameLib.Utils.UndefinedOrNull(args)) { args = []; } this.args = args; }; GameLib.D3.API.CustomCode.prototype = Object.create(GameLib.Component.prototype); GameLib.D3.API.CustomCode.prototype.constructor = GameLib.D3.API.CustomCode; /** * Object to GameLib.D3.API.CustomCode * @param objectComponent * @returns {GameLib.D3.API.CustomCode} * @constructor */ GameLib.D3.API.CustomCode.FromObject = function(objectComponent) { return new GameLib.D3.API.CustomCode( objectComponent.id, objectComponent.name, objectComponent.parentEntity, objectComponent.code, objectComponent.domElementId, objectComponent.args ); };