-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sw-background-sync-queue #72
Conversation
# Conflicts: # package.json
* Deploy to GitHub Pages * Removing jsdoc and docs * Fixes unit tests * Adding browser download to gulpfile * Minor console log tweak * Updating selenium assistant to make gulp download work
* Changing minification for babili * External sourcemap and tidy up of code * Adding license header file * Removing unused dep
* Pulling out minified JS Bundle * Moving to shared build config. Still needs some work * Moving to modular gulp taks and shared build * Removing travis typo * Removing travis TODO
* WIP * Some more updates to match the latest spec * Latest sw-routing updates * Latest sw-runtime-caching updates * Add .min. to output .js file * Broadcast cache update changes * Use .bind() to ensure this is set inside of callback * Syntax tweaks * Demo updates * CacheWrapper => RequestWrapper * CacheWrapper => RequestWrapper * Lint cleanup
JSDoc for the sw-broadcast-cache-update project.
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some high-level comments:
We're preferring const
over let
elsewhere in the project, so it would be good to switch those except for cases where you need let
.
There are a ton of things that should be picked up via linting, and I'm not flagging those now.
@@ -31,7 +31,7 @@ gulp.task('download-browsers', function() { | |||
}); | |||
}); | |||
|
|||
gulp.task('test', ['download-browsers'], () => { | |||
gulp.task('test', ['download-browsers'], () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,2 @@ | |||
# sw-background-sync-queue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, you can run gulp documentation:projects --project=sw-background-sync-queue
to generate some meaningful content for this file and then commit that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll keep this for the end, cuz i guess this needs me to write jsDoc for all
limitations under the License. | ||
*/ | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the double license comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,46 @@ | |||
<html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are various linting things here that would need to be cleaned up—putting the script in an external .js
file will make that easier, since you can lint that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still skipping demo folder, this will be scrapped in the end
* @param {Object=} broadcastChannel | ||
* @param {Object=} dbname | ||
*/ | ||
async function initialize({broadcastChannel, dbName}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the assert
library to validate these parameters if they're required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they are not required params, how do i assert them?
with simple ifs?
* | ||
* @memberOf Queue | ||
*/ | ||
async getRequestFromQueue(hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the assert
library to validate these parameters if they're required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* | ||
* @memberOf Queue | ||
*/ | ||
async getRequestFromQueue(hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you switch to using an anonymous object with named properties instead of position parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @memberOf Queue | ||
*/ | ||
async getRequestFromQueue(hash) { | ||
if(this._queue.indexOf(hash)===-1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be more readable if refactored as
if(this._queue.includes(hash)) {
return this._idbQHelper.get(hash);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
get queue() { | ||
return Object.assign([], this._queue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's odd seeing Object.assign()
used for a []
target.
What's going on here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returning a copy of the existing queue, making sure that any operations on the returned object should not polute the the private variable.
i guess i should add a comment about the same
let _idbQHelper = getDb(); | ||
// TODO: change desrialization of headers | ||
idbObject.response = { | ||
headers: JSON.stringify(response.headers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my previous comment about deserialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done and removed TODO
Thanks for making those changes and addressing my feedback! Is there anything else that you'd like to finish up prior to doing an initial merge? I'm fine with getting what's currently written into the (There are some style differences in your code that's not being flagged by our current linting setup. I don't think that's something you need to address in this PR, but something that can be addressed in a later PR that tightens our linting rules.) |
@jeffposnick Yay! Thanks for approving. |
R: @jeffposnick @addyosmani @wibblymat @gauntface @ebidel
sw-background-sync-queue library review