aboutsummaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
authorJan T <jans.tuomi@gmail.com>2018-03-03 17:27:21 +0200
committerJan Tuomi <jan.tuomi@eficode.com>2018-03-03 17:28:42 +0200
commitf050e5fdbfefe13f59bfca6bfdbc787ac06a53d2 (patch)
tree70f96d4ee3c31b8edacbd1d7ab413efaadd26f0c /index.js
Initial commit
Diffstat (limited to 'index.js')
-rw-r--r--index.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..1b1637b
--- /dev/null
+++ b/index.js
@@ -0,0 +1,22 @@
+import riot from 'riot';
+
+const store = {};
+
+const observe = name => {
+ if (name in store) {
+ return store[name];
+ }
+
+ function Observable() {
+ riot.observable(this);
+ }
+
+ const newObservable = new Observable();
+ store[name] = newObservable;
+
+ return newObservable;
+}
+
+export {
+ observe,
+}; \ No newline at end of file