UIZE JavaScript Framework

2013 NEWS 2013-08-27 - New Uize.since Static Method

The new Uize.since static method, implemented in the Uize base module, returns the amount of time (in milliseconds) that has elapsed since the specified date.

SYNTAX

elapsedMsINT = Uize.since (dateOBJorINT);

The value provided for the dateOBJorINT parameter can be either a reference to an instance of JavaScript's built-in Date object, or an integer representing milliseconds since 1970 (POSIX time). The Uize.since method provides a semantically elegant way of dealing with the timing of processes in JavaScript and is provided merely as syntactic sugar.

INSTEAD OF...

var start = Uize.now ();

// ... ... ... ... ... ... ... ... ... ... ...
// do some stuff that may take a bunch of time
// ... ... ... ... ... ... ... ... ... ... ...

var duration = Uize.now () - start;

USE...

var start = Uize.now ();

// ... ... ... ... ... ... ... ... ... ... ...
// do some stuff that may take a bunch of time
// ... ... ... ... ... ... ... ... ... ... ...

var duration = Uize.since (start);