How to use js-interpreter - 2 common examples

To help you get started, we’ve selected a few js-interpreter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github binary-com / binary-bot / src / botPage / bot / Interpreter.js View on Github external
return;
                }

                globalObserver.emit('Error', e);
                const { initArgs, tradeOptions } = this.bot.tradeEngine;
                this.terminateSession();
                this.init();
                this.$scope.observer.register('Error', onError);
                this.bot.tradeEngine.init(...initArgs);
                this.bot.tradeEngine.start(tradeOptions);
                this.revert(this.startState);
            };

            this.$scope.observer.register('Error', onError);

            this.interpreter = new JSInterpreter(code, initFunc);

            this.onFinish = resolve;
            this.loop();
        });
    }
github binary-com / binary-bot / src / botPage / bot / JSI.js View on Github external
return new Promise(r => {
      const interpreter = new Interpreter(code, initFunc)

      const loop = () => {
        if (this.stopped || !interpreter.run()) {
          if (this.observer) {
            this.observer.unregisterAll('CONTINUE')
          }
          r(interpreter.pseudoToNative(interpreter.value))
          return
        }
        if (!this.observer.isRegistered('CONTINUE')) {
          this.observer.register('CONTINUE', () => setTimeout(loop, 0))
        }
      }

      loop()
    })

js-interpreter

NPM package for https://github.com/NeilFraser/JS-Interpreter

Apache-2.0
Latest version published 1 month ago

Package Health Score

68 / 100
Full package analysis

Popular js-interpreter functions