I'm writing a simple addon in Firefox - 24, on Linux. I get the error:
ReferenceError: TextEncoder is not defined
when I do: var encoder = new TextEncoder(); the function I'm using is:
function write_text(filename, text) {
var encoder = new TextEncoder();
var data = encoder.encode(text);
Task.spawn(function() {
let pfh = OS.File.open("/tmp/foo", {append: true});
yield pfh.write(text);
yield pfh.flush();
yield pfh.close();
});
}
See Question&Answers more detail:os