javascript - Classes not showing up in console: es6 and meteor -
i using grigio:babel
transpile es6 in meteor. have simple file called camera.es6
provide camera functionality
if (meteor.isclient) { class camera { constructor() { } getstream() { return new promise(function (resolve, reject) { navigator.webkitgetusermedia({ video: true }, resolve, reject); }); } } }
i go browser console , try instance new camera.
var c = new camera() vm1898:2 uncaught referenceerror: camera not defined @ <anonymous>:2:13 @ object.injectedscript._evaluateon (<anonymous>:905:140) @ object.injectedscript._evaluateandwrap (<anonymous>:838:34) @ object.injectedscript.evaluate (<anonymous>:694:21)
shouldn't camera available? babel seems should translate function-like structure make work in es5. tried run in babel's repl and translated fine
how access classes meteor , es6?
i suppose babel wrap code closure, unable reach camera console. try
window.camera = camera;
after class definition
Comments
Post a Comment