Author: ygrego Date: 2015-03-18 16:32:36 +0000 (Wed, 18 Mar 2015) New Revision: 955 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/955 Log: Addition of following methods : "upperCaseFirstChar", "logTest", "createCustomEvent", "updateProperty". Modified: oipf/js/utils/Utils.js Modified: oipf/js/utils/Utils.js =================================================================== --- oipf/js/utils/Utils.js 2015-03-18 10:44:54 UTC (rev 954) +++ oipf/js/utils/Utils.js 2015-03-18 16:32:36 UTC (rev 955) @@ -33,4 +33,27 @@ return new Promise(function(resolve, reject) { setTimeout(resolve, time); }); -} \ No newline at end of file +} + +function upperCaseFirstChar(string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} + +function logTest(message) { + console.log("[TEST-INFO] "+message); +} + +function createCustomEvent(type, param) { + return new CustomEvent(type, {detail :param}); +} + +function updateProperty(id, property, value){ + var getElById = document.getElementById.bind(document); + + if (property == "backgroundColor") { + getElById(id)["style"][property] = value; + } else { + getElById(id)[property] = value; + } + +}
participants (1)
-
ygregoï¼ users.nuiton.org