Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Tp.Helpers.Http.get(url).then((response) => {
console.log(response);
var parsed = JSON.parse(response);
if (parsed.code != 200)
throw new Error('Failed to translate');
return [[text, new TT.Entity(parsed.lang, languages[parsed.lang])]];
});
},
constructor(engine, app, compiled, output) {
super(engine.platform.locale, engine.platform.timezone, engine.schemas);
this.engine = engine;
this.app = app;
this._programId = new ThingTalk.Entity(this.app.uniqueId, null);
this._output = output;
this._functions = compiled.functions;
this._states = [];
this._states.length = compiled.states;
for (let i = 0; i < compiled.states; i++)
this._states[i] = new ChannelState(engine.platform, 'app:' + app.uniqueId + ':' + i);
this._trigger = null;
this._execCache = [];
}