How to use the thingtalk/lib/utils.generatorToAsync function in thingtalk

To help you get started, we’ve selected a few thingtalk 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 stanford-oval / thingengine-core / test / manual.js View on Github external
function doTest(fn, engine) {
    let env = new ExecWrapper(engine, { icon: 'org.foo' }, {
        functions: [{ selector: new Ast.Selector.Device('org.thingpedia.builtin.test', 'org.thingpedia.builtin.test', null), channel: 'get_data', type: 'query', }],
        states: 0
    }, {
        output(icon, outputType, outputvalue) {
            console.log('output', outputType, outputvalue);
        },
        error(icon, err) {
            console.error(err);
        }
    });

    return Promise.resolve((Utils.generatorToAsync(fn))(ThingTalk.Builtin, env));
}