« get me outta code hell

wiki-data.js « lib « test - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/lib/wiki-data.js
blob: c4083a56860c8755327ab8f4e064139a0c847f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import {linkWikiDataArrays} from '#yaml';

export function linkAndBindWikiData(wikiData) {
  linkWikiDataArrays(wikiData);

  return {
    // Mutate to make the below functions aware of new data objects, or of
    // reordering the existing ones. Don't mutate arrays such as trackData
    // in-place; assign completely new arrays to this wikiData object instead.
    wikiData,

    // Use this after you've mutated wikiData to assign new data arrays.
    // It'll automatically relink everything on wikiData so all the objects
    // are caught up to date.
    linkWikiDataArrays:
      linkWikiDataArrays.bind(null, wikiData),

    // Use this if you HAVEN'T mutated wikiData and just need to decache
    // indirect dependencies on exposed properties of other data objects.
    // See documentation on linkWikiDataArarys (in yaml.js) for more info.
    XXX_decacheWikiData:
      linkWikiDataArrays.bind(null, wikiData, {XXX_decacheWikiData: true}),
  };
}