Skip to content

Commit

Permalink
[SDK-1516] Web Workers (#409)
Browse files Browse the repository at this point in the history
* fetch in a web worker

* token worker

* known issue: doesn't work if user already logged in (need authorization_code grant_type to populate the refresh token)

* add iframe fallback

* fix tests

* We want to load:
`rollup-plugin-worker-loader::module:./token.worker.ts`
But not:
rollup-plugin-worker-loader::module:/Users/adammcgrath/dev/auth0-spa-js/src/token.worker.ts
TODO: check windows

* Fixed ES5 transpilation for rollup worker plugin

* Make messages serializable using `JSON.parse(JSON.stringify({}))`
Swap imports per https://github.com/mo/abortcontroller-polyfill/blob/3f1c13d2e4087ee15ded81786f1110ae547931bb/README.md#using-it-on-internet-explorer-11-msie11

* only use worker for non ie, local refresh token opts

TODO: fix tests

* Fix tests

* Removed refresh token from worker memory when not included in response

* Moved offline_access scope configuration to constructor

* Modified playground to use both factory func and constructor

* Remove Object.assign

* Remove checks to fix rebuild issue

* Abort timed out requests in the Web Worker

* Errors

* Fix tests

* Add some more tests

* DRY up the tests a little

* Moar tests

* unused import

* update rollup-plugin-web-worker-loader
don't run `addEventListener` in tests
add test for missing refresh token and localstorage

* add timeout tests

* add browser tests

* Only include files in the typings copy process

* Fix fallback logic when no RT and no worker

* add browser tests and comments

* bump node version in Jenkinsfile

* Removed unused import

* Added sanity check for web worker support

* Fixed tests for window.Worker check

* Moved constructor tests into Auth0Client

Co-authored-by: Steve Hobbs <[email protected]>
  • Loading branch information
adamjmcgrath and Steve Hobbs authored Apr 14, 2020
1 parent e0ae15c commit d1528fe
Show file tree
Hide file tree
Showing 18 changed files with 1,218 additions and 333 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
stats.html
cypress/screenshots
cypress/videos
.release
.release
.idea
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
},
{
"type": "node",
"request": "launch",
"name": "Build",
"program": "${workspaceFolder}/node_modules/.bin/rollup",
"args": ["-m", "-c"],
"console": "integratedTerminal"
}
]
}
12 changes: 6 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ pipeline {
agent {
label 'crew-brucke'
}

tools {
nodejs '10.15.1'
nodejs '12.9.1'
}

options {
timeout(time: 10, unit: 'MINUTES')
}

stages {
stage('SharedLibs') {
steps {
Expand Down Expand Up @@ -52,10 +52,10 @@ pipeline {
}
}
}

post {
cleanup {
deleteDir()
}
}
}
}
Loading

0 comments on commit d1528fe

Please sign in to comment.