Skip to content

Global References

Brandon Jordan edited this page Oct 29, 2024 · 6 revisions

Spark provides a global map of object references that can be accessed anywhere.

Define Reference

You can define a global reference using define(key, object).

const randomX = new RandomStore(0, 0, window.innerWidth);

spark.define('randomX', randomX);

Get Object Reference

In another part of your application, you can then get the exact same object by reference using ref(key).

spark.ref('randomX');
Clone this wiki locally