forked from vvoovv/djeo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_TextEngineMixin.js
More file actions
43 lines (34 loc) · 764 Bytes
/
_TextEngineMixin.js
File metadata and controls
43 lines (34 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
define([
"dojo/_base/declare",
"dojo/has",
"dojo/_base/lang"
], function(declare, has, lang){
return declare(null, {
renderedText: "",
output: "toConsole",
outputFile: "output.txt",
provideOutput: function() {
if (this.output) {
if (lang.isFunction(this.output)) {
this.output(this.renderedText);
}
else if (this[this.output]) {
this[this.output]();
}
}
},
toConsole: function() {
console.log(this.renderedText);
},
toMapContainer: function() {
if (has("host-browser")) {
this.map.container.innerHTML = "<pre>"+this.renderedText+"</pre>";
}
},
toFile: function() {
if (has("host-browser")) return;
var fs = require.nodeRequire("fs");
fs.writeFileSync(this.outputFile, this.renderedText);
}
});
});