-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.js
32 lines (27 loc) · 877 Bytes
/
util.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
************************
** By **
** Nicola Klemenc **
** github.com/nicklem **
************************
*/
var UTIL = ( function() {
var timeExec = function( f , context ) {
var initTime = performance.now();
// f.bind( context || window )() ;
f() ;
var endTime = performance.now();
return Math.round( endTime - initTime ) + " ms";
} ;
var consoleLog = function( msg , data ) {
var renderContainer = document.querySelector( "#console" ) ;
formattedMsg = "<div class=\"console-msg\">" + msg + "</div>" ;
formattedData = data ? "<div class=\"console-data\">" + data + "</div>" : "" ;
renderContainer.innerHTML = renderContainer.innerHTML + formattedMsg + formattedData ;
} ;
var API = {
"timeExec" : timeExec ,
"consoleLog" : consoleLog ,
} ;
return API ;
} () ) ; // END util