Last active
July 28, 2016 17:12
Revisions
-
SergProduction renamed this gist
Jul 28, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
SergProduction created this gist
Jul 28, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ let id = 0; let init = []; socket.ws.send('{"cmd":"GetScript"}'); socket.onMessage( data => { if (data.cmd == 'SetScript') { Parse(data.script); } }) function Parse(mod, parent = 0 ){ let my = {}; mod.forEach((el, i, arr) => { id+=1; my = { id: id, parent: parent, key: el.keyname, question: el.qwest, answer: el.ans, file: null, url: null }; init.push(my); if (el.node.length) { Parse(el.node, id) } }) return init } export default init