Prechádzať zdrojové kódy

replace => to function() for GUN DB

Nikolay Suslov 6 rokov pred
rodič
commit
703dc25eab

+ 11 - 11
public/app.js

@@ -88,7 +88,7 @@ class App {
       _LCSDB.get('lcs/app').load();
       _LCSDB.get('users').load();
 
-      _LCSDB.get('lcs/app').get('pub').once(res => {
+      _LCSDB.get('lcs/app').get('pub').once(function(res){
 
         if (res) {
           window._LCS_SYS_USER = _LCSDB.user(res);
@@ -285,7 +285,7 @@ class App {
         let files = res[1];
         Object.entries(files).forEach(file => {
 
-          _LCSDB.user().get('worlds').get(worldName).get(file[0]).not(res => {
+          _LCSDB.user().get('worlds').get(worldName).get(file[0]).not(function(res){
             _LCSDB.user().get('worlds').get(worldName).get(file[0]).put(file[1]);
           })
 
@@ -680,7 +680,7 @@ class App {
                       console.log("save new info");
                       let editor = document.querySelector("#aceEditor").env.editor;
                       let newInfo = editor.getValue();
-                      _LCSDB.user().get(worldType).get(worldName).get(file).get('file').put(newInfo, res => {
+                      _LCSDB.user().get(worldType).get(worldName).get(file).get('file').put(newInfo, function(res) {
                         if (res) {
 
                           let noty = new Noty({
@@ -809,7 +809,7 @@ class App {
   async setUserPaths(user) {
 
       let users = await _LCSDB.get('users');
-     await _LCSDB.get('users').get(user).get('pub').once(res => {
+     await _LCSDB.get('users').get(user).get('pub').once(function(res) {
       if (res)
         window._LCS_WORLD_USER = {
           alias: user,
@@ -1334,7 +1334,7 @@ class App {
     // "savestate_" + loadInfo[ 'save_revision' ] + '/' + loadInfo[ 'save_name' ] + '_vwf_json'
 
     var docName = 'savestate_/' + root + '/' + filename + '_vwf_json';
-    _LCSDB.user().get('documents').get(root).get(docName).put(stateForStore, res => {
+    _LCSDB.user().get('documents').get(root).get(docName).put(stateForStore, function(res) {
 
       if (res) {
 
@@ -1349,7 +1349,7 @@ class App {
       }
     });
 
-    _LCSDB.user().get('worlds').get(root).get('info_json').once(res => {
+    _LCSDB.user().get('worlds').get(root).get('info_json').once(function(res) {
 
       if (res) {
 
@@ -1368,11 +1368,11 @@ class App {
 
         let docInfoName = 'savestate_/' + root + '/' + filename + '_info_vwf_json';
 
-        _LCSDB.user().get('documents').get(root).get(docInfoName).not(res => {
+        _LCSDB.user().get('documents').get(root).get(docInfoName).not(function(res) {
           _LCSDB.user().get('documents').get(root).get(docInfoName).put(obj);
         });
 
-        _LCSDB.user().get('documents').get(root).get(docInfoName).get('created').not(res => {
+        _LCSDB.user().get('documents').get(root).get(docInfoName).get('created').not(function(res) {
           _LCSDB.user().get('documents').get(root).get(docInfoName).get('created').put(modified);
         });
 
@@ -1696,7 +1696,7 @@ class App {
 
     Object.keys(myWorlds).filter(el => el!=='_').forEach(w=>{
 
-      db.get('documents').get(w).map((res, datI)=>{
+      db.get('documents').get(w).map(function(res, datI){
         var doc = {};
 
          if (datI.includes('_info_vwf_json')){
@@ -1784,8 +1784,8 @@ class App {
         db = _LCSDB.user();
     }
 
-    db.get('worlds').map((val, index)=>{
-     db.get('worlds').get(index).get('info_json').load(res=>{
+    db.get('worlds').map(function(val, index){
+     db.get('worlds').get(index).get('info_json').load(function(res){
         
        var doc = {};
 

+ 5 - 5
public/vwf.js

@@ -490,7 +490,7 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
            
             let userDB = _LCSDB.user(_LCS_WORLD_USER.pub);
 
-            userDB.get('worlds').get(path.slice(1)).get(dbPath).get('file').load(res => {
+            userDB.get('worlds').get(path.slice(1)).get(dbPath).get('file').load(function(res) {
                 
                 var conf = "";
 
@@ -4902,7 +4902,7 @@ if ( ! childComponent.source ) {
                 if(dbName.includes("vwf_example_com")){
                     //userDB = await window._LCS_SYS_USER.get('proxy').then();
                    fileName = dbName;
-                   window._LCS_SYS_USER.get('proxy').get(fileName).get('file').load(r=>{
+                   window._LCS_SYS_USER.get('proxy').get(fileName).get('file').load(function(r){
                        //console.log(r);
                        parseComp(r);
 
@@ -4912,7 +4912,7 @@ if ( ! childComponent.source ) {
                     let worldName = dbName.split('/')[0];
                     //userDB = await window._LCS_WORLD_USER.get('worlds').path(worldName).then();
                    fileName = dbName.replace(worldName + '/', "");
-                   userDB.get('worlds').path(worldName).get(fileName).get('file').load(r=>{
+                   userDB.get('worlds').path(worldName).get(fileName).get('file').load(function(r){
                     //console.log(r);
                     parseComp(r);
 
@@ -4979,14 +4979,14 @@ if ( ! childComponent.source ) {
                 if(dbName.includes("vwf_example_com")){
                     //userDB = window._LCS_SYS_USER.get('proxy');
                     fileName = dbName;
-                    window._LCS_SYS_USER.get('proxy').get(fileName).get('file').load(r=>{
+                    window._LCS_SYS_USER.get('proxy').get(fileName).get('file').load(function(r){
                         //console.log(r);
                         parseComp(r);
                     },{wait: 200});
  
                 } else {
                     fileName = dbName.replace(worldName + '/', "");
-                    userDB.get('worlds').path(worldName).get(fileName).get('file').load(r=>{
+                    userDB.get('worlds').path(worldName).get(fileName).get('file').load(function(r){
                         //console.log(r);
                         parseComp(r);
     

+ 1 - 1
public/vwf/model/aframe.js

@@ -611,7 +611,7 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
                                 let dbPath = propertyValue.split(".").join("_");
 
                                 let userDB = _LCSDB.user(_LCS_WORLD_USER.pub);
-                                userDB.get('worlds').get(worldName).get(dbPath).get('file').load(response => {
+                                userDB.get('worlds').get(worldName).get(dbPath).get('file').load(function(response) {
                                     if (response) {
                                         console.log(JSON.parse(response));
                                         let assets = JSON.parse(response);

+ 1 - 1
public/vwf/view/document.js

@@ -57,7 +57,7 @@ define( [ "module", "vwf/view", "vwf/utility"], function( module, view, utility)
                let dbPath = appName + '_html';
               let worldName = path.slice(1);
               let userDB = _LCSDB.user(_LCS_WORLD_USER.pub);
-              userDB.get('worlds').get(worldName).get(dbPath).once().then(res => {
+              userDB.get('worlds').get(worldName).get(dbPath).once().then(function(res) {
                    
                    var responseText = "";
                    

+ 5 - 5
public/web/index-app.js

@@ -279,7 +279,7 @@ class IndexApp {
 
     initUser() {
 
-        _LCSDB.on('auth', (ack) => {
+        _LCSDB.on('auth', function(ack) {
 
             if (ack.sea.pub) {
 
@@ -291,7 +291,7 @@ class IndexApp {
                 // document.querySelector('#worldGUI').$update();
                 // document.querySelector('#main').$update();
 
-                _LCSDB.get('users').get(alias).not(res => {
+                _LCSDB.get('users').get(alias).not(function(res) {
                     let userObj = {
                         alias: alias,
                         pub: ack.sea.pub
@@ -400,7 +400,7 @@ class IndexApp {
                             {
                                 "label": 'Sign OUT',
                                 "onclick": function (e) {
-                                    _LCSDB.user().leave().then(ack => {
+                                    _LCSDB.user().leave().then(function(ack) {
                                         if (ack.pub) {
                                             window.sessionStorage.removeItem('alias');
                                             window.sessionStorage.removeItem('tmp');
@@ -561,7 +561,7 @@ class IndexApp {
                                                 } else {
                                                     //
                                                     _LCSDB.user().create(alias, pass,
-                                                        (ack) => {
+                                                        function(ack) {
                                                             if (!ack.wait) { }
                                                             if (ack.err) {
                                                                 console.log(ack.err)
@@ -590,7 +590,7 @@ class IndexApp {
                                             "label": 'Sign IN',
                                             "onclick": function (e) {
                                                 e.preventDefault();
-                                                _LCSDB.user().auth(this._aliasField.value, this._passField.value, ack => {
+                                                _LCSDB.user().auth(this._aliasField.value, this._passField.value, function(ack) {
 
                                                     if (ack.err) {
                                                         new Noty({

+ 1 - 1
public/web/world-app.js

@@ -385,7 +385,7 @@ class WorldApp {
 
         let self = this;
        let users =  await _LCSDB.get('users').then();
-        await _LCSDB.get('users').get(this.userAlias).get('pub').then(res=>{
+        await _LCSDB.get('users').get(this.userAlias).get('pub').then(function(res){
 
             self.makeGUI(res)