aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js37
1 files changed, 34 insertions, 3 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index fbabd780..b6d0e598 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -7,21 +7,52 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component,
10 FileIo = require("js/io/system/fileio").FileIo, 11 FileIo = require("js/io/system/fileio").FileIo,
11 ProjectIo = require("js/io/system/projectio").ProjectIo; 12 ProjectIo = require("js/io/system/projectio").ProjectIo;
12//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
13// 14//
14exports.IoMediator = Montage.create(require("montage/ui/component").Component, { 15exports.IoMediator = Montage.create(Component, {
16 ////////////////////////////////////////////////////////////////////
17 //
18 deserializedFromTemplate: {
19 enumerable: false,
20 value: function () {
21 }
22 },
23 ////////////////////////////////////////////////////////////////////
24 //
25 fio: {
26 enumerable: false,
27 value: FileIo
28 },
15 //////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////
16 // 30 //
17 fileNew: { 31 fileNew: {
18 enumerable: false, 32 enumerable: false,
19 value: function (file, template, callback) { 33 value: function (file, template, callback) {
20 // 34 //
35 var xhr = new XMLHttpRequest();
36 xhr.open("GET", template, false);
37 xhr.send();
38 if (xhr.readyState === 4) {
39 //
40 console.log(this.fio.newFile({uri: file, contents: xhr.response}));
41 } else {
42 //Error
43 }
44
45
46
47
48
49
21 50
22 51 //callback('win');
23 var returnObj = null; //like {"uri": "/gfdg/gdf/dfg.js", "success": true,...} 52 /*
53var returnObj = null; //like {"uri": "/gfdg/gdf/dfg.js", "success": true,...}
24 callback(returnObj); 54 callback(returnObj);
55*/
25 } 56 }
26 }, 57 },
27 //////////////////////////////////////////////////////////////////// 58 ////////////////////////////////////////////////////////////////////