Skip to content

Commit 8224f6e

Browse files
authored
Merge pull request #21 from matoruru/add-timelog
Add console.timeLog
2 parents add2bdb + de05157 commit 8224f6e

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/Effect/Class/Console.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ infoShow = liftEffect <<< EffConsole.infoShow
3333
time :: forall m. MonadEffect m => String -> m Unit
3434
time = liftEffect <<< EffConsole.time
3535

36+
timeLog :: forall m. MonadEffect m => String -> m Unit
37+
timeLog = liftEffect <<< EffConsole.timeLog
38+
3639
timeEnd :: forall m. MonadEffect m => String -> m Unit
3740
timeEnd = liftEffect <<< EffConsole.timeEnd

src/Effect/Console.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ exports.time = function (s) {
3535
};
3636
};
3737

38+
exports.timeLog = function (s) {
39+
return function () {
40+
console.timeLog(s);
41+
return {};
42+
};
43+
};
44+
3845
exports.timeEnd = function (s) {
3946
return function () {
4047
console.timeEnd(s);

src/Effect/Console.purs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,8 @@ infoShow a = info (show a)
4848
-- | Start a named timer.
4949
foreign import time :: String -> Effect Unit
5050

51+
-- | Print the time since a named timer started in milliseconds.
52+
foreign import timeLog :: String -> Effect Unit
53+
5154
-- | Stop a named timer and print time since it started in milliseconds.
5255
foreign import timeEnd :: String -> Effect Unit

0 commit comments

Comments
 (0)