MOBILE-4362 siteplugins: Add helper function to update cached data
parent
1250779328
commit
df81617588
|
@ -22,6 +22,7 @@ import { CoreSitePlugins, CoreSitePluginsContent, CoreSitePluginsProvider } from
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { CoreEvents } from '@singletons/events';
|
import { CoreEvents } from '@singletons/events';
|
||||||
|
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component to render a site plugin content.
|
* Component to render a site plugin content.
|
||||||
|
@ -238,6 +239,19 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
CoreEvents.trigger(CoreSitePluginsProvider.UPDATE_COURSE_CONTENT, { cmId, alreadyFetched });
|
CoreEvents.trigger(CoreSitePluginsProvider.UPDATE_COURSE_CONTENT, { cmId, alreadyFetched });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update this content stored in the app's cache. This function will not reload the view, it will only update the data stored
|
||||||
|
* in the device so it's updated for the next usage. If you want to update the view, please use refreshContent.
|
||||||
|
*/
|
||||||
|
async updateCachedContent(): Promise<void> {
|
||||||
|
await CoreSitePlugins.getContent(
|
||||||
|
this.component,
|
||||||
|
this.method,
|
||||||
|
this.args,
|
||||||
|
CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.ONLY_NETWORK),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CoreSitePluginsPluginContentLoadedData = {
|
export type CoreSitePluginsPluginContentLoadedData = {
|
||||||
|
|
Loading…
Reference in New Issue