Skip to content

Commit

Permalink
throw an error type
Browse files Browse the repository at this point in the history
  • Loading branch information
TomK committed Oct 13, 2021
1 parent 5769174 commit 227b477
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@packaged-ui/ready-promise",
"version": "1.0.0",
"version": "1.0.1",
"main": "src/index.js",
"author": {
"name": "Tom Kay",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function onReadyState(state = readyStates.loaded)
state = readyStates[state] || state;
if(typeof state !== 'number')
{
throw 'not a valid state';
throw new Error('not a valid state');
}

let promise;
Expand Down Expand Up @@ -61,14 +61,14 @@ document.addEventListener(
'readystatechange', () =>
{
_setCurrentReadyState(document.readyState);
}
},
);

document.addEventListener(
'DOMContentLoaded', () =>
{
_setCurrentReadyState(readyStates.loaded);
}
},
);

// initialize to current state
Expand Down

0 comments on commit 227b477

Please sign in to comment.