How to use the ember-concurrency.waitForQueue function in ember-concurrency

To help you get started, we’ve selected a few ember-concurrency examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CenterForOpenScience / ember-osf-web / app / services / analytics.ts View on Github external
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) {
github CenterForOpenScience / ember-osf-web / app / services / ready.ts View on Github external
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();
github CenterForOpenScience / ember-osf-web / app / locations / history.ts View on Github external
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(),
}) {