From be3c7406bf1da1ce0b85bc2d16d07529e2a64e51 Mon Sep 17 00:00:00 2001 From: Piotr Roszatycki Date: Tue, 24 Oct 2017 14:38:00 +0200 Subject: [PATCH] Examples --- examples/test-timers-ts.ts | 15 +++++++++++++++ examples/test-timers.coffee | 6 +++--- examples/test-timers.js | 8 +++++--- examples/test-timers.ls | 6 +++--- 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 examples/test-timers-ts.ts diff --git a/examples/test-timers-ts.ts b/examples/test-timers-ts.ts new file mode 100644 index 0000000..1cc8e41 --- /dev/null +++ b/examples/test-timers-ts.ts @@ -0,0 +1,15 @@ +#!/usr/bin/env ts-node + +import * as timers from '../lib/timers-obj' + +const ticker = timers.interval(1000, () => { + console.info('Tick') +}) + +timers.timeout(5000, () => { + ticker.remove() +}) + +timers.immediate(() => { + console.info('Time is ticking...') +}) diff --git a/examples/test-timers.coffee b/examples/test-timers.coffee index aa6159c..75ca1c5 100644 --- a/examples/test-timers.coffee +++ b/examples/test-timers.coffee @@ -1,12 +1,12 @@ #!/usr/bin/env coffee -timers = require 'timers-obj' +timers = require '../lib/timers-obj' ticker = timers.interval 1000, -> - console.log 'Tick' + console.info 'Tick' timers.timeout 5000, -> ticker.remove() timers.immediate -> - console.log 'Time is ticking...' + console.info 'Time is ticking...' diff --git a/examples/test-timers.js b/examples/test-timers.js index 4530352..c047139 100644 --- a/examples/test-timers.js +++ b/examples/test-timers.js @@ -1,9 +1,11 @@ +#!/usr/bin/env node + 'use strict' -const timers = require('timers-obj') +const timers = require('../lib/timers-obj') let ticker = timers.interval(1000, () => { - console.log('Tick') + console.info('Tick') }) timers.timeout(5000, () => { @@ -11,5 +13,5 @@ timers.timeout(5000, () => { }) timers.immediate(() => { - console.log('Time is ticking...') + console.info('Time is ticking...') }) diff --git a/examples/test-timers.ls b/examples/test-timers.ls index 5ca4edb..e0e25aa 100644 --- a/examples/test-timers.ls +++ b/examples/test-timers.ls @@ -1,12 +1,12 @@ #!/usr/bin/env lsc -require! 'timers-obj': timers +require! '../lib/timers-obj': timers ticker = timers.interval 1000 -> - console.log 'Tick' + console.info 'Tick' timers.timeout 5000 -> ticker.remove! timers.immediate -> - console.log 'Time is ticking...' + console.info 'Time is ticking...'