Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
trackPageTask = task(function *(
this: Analytics,
pagePublic: boolean | undefined,
resourceType: string,
withdrawn: string,
versionType: string,
) {
// Wait until everything has settled
yield waitForQueue('destroy');
const eventParams = {
page: this.router.currentURL,
title: this.router.currentRouteName,
};
logEvent(this, 'Tracked page', {
pagePublic,
resourceType,
withdrawn,
versionType,
...eventParams,
});
const gaConfig = metricsAdapters.findBy('name', 'GoogleAnalytics');
if (gaConfig) {
tryReady = task(function *(this: Ready) {
// Waiting until `destroy` makes sure that everyone in `render` and `afterRender`
// (e.g. components, jQuery plugins, etc.) has a chance to call `getBlocker`, and that
// all DOM manipulation has settled.
yield waitForQueue('destroy');
if (!get(this, 'blockers').length) {
set(this, 'isReady', true);
this.trigger(Events.IsReady);
}
}).restartable();
scrollToElement: task(function *(this: FragmentHistoryLocation, elementId: string) {
yield this.ready.ready();
yield waitForQueue('afterRender');
// Not using `#id` as fragment could contain a `.`
const element = document.querySelector(`[id="${elementId}"]`) as HTMLElement;
if (element) {
scrollTo(getOwner(this), element);
}
}).restartable(),
}) {