Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mycard Mobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mycard Mobile
Commits
24cbe02c
Commit
24cbe02c
authored
Jun 18, 2018
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sw
parent
0fb3e190
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
3 deletions
+43
-3
package.json
package.json
+4
-3
service-worker.patch
service-worker.patch
+39
-0
No files found.
package.json
View file @
24cbe02c
{
"name"
:
"mycard-mobile"
,
"version"
:
"1.0.2
4
"
,
"version"
:
"1.0.2
5
"
,
"license"
:
"UNLISENCED"
,
"scripts"
:
{
"ng"
:
"ng"
,
"start"
:
"ng serve --aot"
,
"build"
:
"ng build --i18n-locale zh-CN --base-href /mobile/ --prod"
,
"build:dev"
:
"ng build --i18n-locale zh-CN --base-href /mobile2/ --prod"
,
"build"
:
"ng build --i18n-locale zh-CN --base-href /mobile/ --prod && npm run fuck"
,
"build:dev"
:
"ng build --i18n-locale zh-CN --base-href /mobile2/ --prod && npm run fuck"
,
"fuck"
:
"patch -i service-worker.patch dist/ngsw-worker.js"
,
"postinstall"
:
"patch -i webpack.patch -p0 -t"
,
"lint"
:
"ng lint"
},
...
...
service-worker.patch
0 → 100644
View file @
24cbe02c
4c4,39
<
---
> const waitUntil = ExtendableEvent.prototype.waitUntil;
> const respondWith = FetchEvent.prototype.respondWith;
> const promisesMap = new WeakMap();
>
> ExtendableEvent.prototype.waitUntil = function(promise) {
> const extendableEvent = this;
> let promises = promisesMap.get(extendableEvent);
>
> if (promises) {
> promises.push(Promise.resolve(promise));
> return;
> }
>
> promises = [Promise.resolve(promise)];
> promisesMap.set(extendableEvent, promises);
>
> // call original method
> return waitUntil.call(extendableEvent, Promise.resolve().then(function processPromises() {
> const len = promises.length;
>
> // wait for all to settle
> return Promise.all(promises.map(p => p.catch(()=>{}))).then(() => {
> // have new items been added? If so, wait again
> if (promises.length != len) return processPromises();
> // we're done!
> promisesMap.delete(extendableEvent);
> // reject if one of the promises rejected
> return Promise.all(promises);
> });
> }));
> };
>
> FetchEvent.prototype.respondWith = function(promise) {
> this.waitUntil(promise);
> return respondWith.call(this, promise);
> };
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment