-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixes on payload and add dynamic import size
- Loading branch information
1 parent
ce7fd23
commit e4e602e
Showing
2 changed files
with
39 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { Ntp } from '../../ntp'; | ||
const meteorInstall = require('meteor/modules').meteorInstall; | ||
|
||
let oldFetch; | ||
let oldMeteorInstallFetch; | ||
export function wrapDynamicImport () { | ||
oldFetch = meteorInstall.fetch; | ||
oldMeteorInstallFetch = meteorInstall.fetch; | ||
meteorInstall.fetch = function (ids) { | ||
const start = Ntp._now(); | ||
const promise = oldFetch(ids); | ||
const promise = oldMeteorInstallFetch(ids); | ||
Kadira.webVitals.pendingObjects += 1; | ||
return promise.then((...args) => { | ||
Kadira.webVitals.importTime.push({start, end: Ntp._now(), ids}); | ||
Kadira.webVitals.importTime.push({start, end: Ntp._now(), ids: Object.keys(ids)}); | ||
Kadira.webVitals.completedObjects += 1; | ||
return Promise.resolve(...args); | ||
}); | ||
}; | ||
} | ||
export function unwrapDynamicImport () { | ||
meteorInstall.fetch = oldFetch; | ||
meteorInstall.fetch = oldMeteorInstallFetch; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters