repo: janusweb
action: commit
revision: 
path_from: 
revision_from: e02f6cfa364bdfc45310e81d32a93acbbd66f88b:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit e02f6cfa364bdfc45310e81d32a93acbbd66f88b
Author: James Baicoianu 
Date:   Sun Jan 30 14:29:45 2022 -0800

    Added janusvfs translator

diff --git a/scripts/translators/janusvfs.js b/scripts/translators/janusvfs.js
new file mode 100644
index 0000000000000000000000000000000000000000..324608d26b3139d73d557f3ffc32d5a3826801f2
--- /dev/null
+++ b/scripts/translators/janusvfs.js
@@ -0,0 +1,20 @@
+elation.require([], function() {
+  elation.component.add('janusweb.translators.janusvfs', function() {
+    this.exec = function(args) {
+      return new Promise(async function(resolve, reject) {
+        setTimeout(async () => {
+          elation.engine.assetdownloader.fetchURL(args.url).then((ev) => {
+            let decoder = new TextDecoder('utf-8');
+            let src = decoder.decode(ev.target.data);
+            elation.events.fire({element: room._target, type: 'room_load_processing'});
+            room.loadFromSource(src);
+            resolve({room: { }, source: src});
+          }).catch((err) => {
+            console.log('oh no', err);
+            reject();
+          });
+        }, 1000);
+      });
+    }
+  });
+});

-----END OF PAGE-----