Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    sense-js-enginepublic

    JavaScript Engine for Sense

    Build Status

    This module implements a JavaScript (NodeJS) engine for Sense using Sense's Engine API. It is preinstalled on Sense.

    Sense JavaScript Engine

    Installation and Usage

    You can install this engine locally using

    npm install sense-js-engine
    

    You can test it from the command line using

    grunt test
    

    If you install this package in your project's /home/sense, it will override the default JavaScript engine and can be used from Sense.

    Implementation Overview

    This module provides a complete example of how to implement an engine for Sense.

    The engine evaluates code chunks in a subprocess, keeping the main process's event loop relatively free. This allows the engine to receive interrupt events and emit output while code chunks are running.

    Each engine must define the chunk method that splits long strings of code into logical units such as statements and block comments. This engine's chunker uses the acorn parser with the comment-chunk-helper package.

    While evaluating code chunks, the subprocess generates output, which it sends to the engine according to its type using [process.send](h ttp://nodejs.org/api/child_process.html#child_process_child_send_messa ge_sendhandle). When the subprocess has finished evaluating a code chunk, it sends an output message of type result, indicating that it is ready for the next code chunk.

    The engine itself communicates with the frontend using the methods defined in the Engine API.

    Support

    LICENSE

    MIT

    Keywords

    none

    install

    npm i sense-js-engine

    Downloadsweekly downloads

    0

    version

    0.3.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar