File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed
Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ p3.then(() => alert('frame'))
4444Promise .all ([p1, p2, p3]).then (() => alert (' We are all done!' ))
4545```
4646
47+ ### Clear timer eventyally
48+ Thanks to [ this pull request] ( https://github.com/GianlucaGuarini/allora/pull/3 ) it's now also possible to clear the timers
49+ ``` js
50+ const myWindow = allora (window )
51+ const timer = myWindow .setTimeout (3000 )
52+ timer .then (_ => console .log (' time over' ))
53+ clearTimeout (timer)
54+ ```
55+
4756## "allora" meaning
4857
4958"allora" is the Italian :it : word for ` then `
Original file line number Diff line number Diff line change 2929 "eslint-config-standard" : " ^5.3.5" ,
3030 "eslint-plugin-promise" : " ^2.0.0" ,
3131 "eslint-plugin-standard" : " ^2.0.0" ,
32- "mocha" : " ^2.5.3" ,
33- "sinon" : " ^1.17.4" ,
34- "sinon-chai" : " ^2.8.0"
32+ "mocha" : " ^2.5.3"
3533 }
3634}
Original file line number Diff line number Diff line change 11const allora = require ( '../' )
22
33const chai = require ( 'chai' )
4- // const sinon = require('sinon')
5- const sinonChai = require ( 'sinon-chai' )
6- const EventEmitter = require ( 'events' )
74const expect = chai . expect
8- chai . use ( sinonChai )
5+ const EventEmitter = require ( 'events' )
96
107describe ( 'core' , function ( ) {
118 var emitter
@@ -48,4 +45,11 @@ describe('core', function () {
4845 coolGlobal . setTimeout ( 500 )
4946 ] ) . then ( ( ) => done ( ) )
5047 } )
48+
49+ it ( 'Reject the promise' , function ( done ) {
50+ const coolGlobal = allora ( global )
51+ coolGlobal . setImmediate ( ) . then ( ( ) => {
52+ throw new Error ( 'Random error' )
53+ } ) . catch ( ( ) => done ( ) )
54+ } )
5155} )
You can’t perform that action at this time.
0 commit comments