wiki-data.js 960 B

12345678910111213141516171819202122232425
  1. import {linkWikiDataArrays} from '#yaml';
  2. export function linkAndBindWikiData(wikiData) {
  3. linkWikiDataArrays(wikiData);
  4. return {
  5. // Mutate to make the below functions aware of new data objects, or of
  6. // reordering the existing ones. Don't mutate arrays such as trackData
  7. // in-place; assign completely new arrays to this wikiData object instead.
  8. wikiData,
  9. // Use this after you've mutated wikiData to assign new data arrays.
  10. // It'll automatically relink everything on wikiData so all the objects
  11. // are caught up to date.
  12. linkWikiDataArrays:
  13. linkWikiDataArrays.bind(null, wikiData),
  14. // Use this if you HAVEN'T mutated wikiData and just need to decache
  15. // indirect dependencies on exposed properties of other data objects.
  16. // See documentation on linkWikiDataArarys (in yaml.js) for more info.
  17. XXX_decacheWikiData:
  18. linkWikiDataArrays.bind(null, wikiData, {XXX_decacheWikiData: true}),
  19. };
  20. }