aboutsummaryrefslogtreecommitdiff
path: root/js/io/system/coreioapi.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-01-30 14:35:11 -0800
committerJose Antonio Marquez2012-01-30 14:35:11 -0800
commit2f61dfca4466661e1ea23888675a86b601b58c63 (patch)
treea86bf1b6d3f98776f0b329f2f8f0a3cc2e2dc71c /js/io/system/coreioapi.js
parent4d5f9c451524829f55ddf26642cb9fc28228b6ce (diff)
downloadninja-2f61dfca4466661e1ea23888675a86b601b58c63.tar.gz
Setting up new file
Adding base functionality to creating files.
Diffstat (limited to 'js/io/system/coreioapi.js')
-rwxr-xr-xjs/io/system/coreioapi.js64
1 files changed, 44 insertions, 20 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 1585fc33..a10063f5 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -7,7 +7,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7/* ///////////////////////////////////////////////////////////////////// 7/* /////////////////////////////////////////////////////////////////////
8//////////////////////////////////////////////////////////////////////// 8////////////////////////////////////////////////////////////////////////
9NOTES: 9NOTES:
10These methods should only be access through the file and project IO classes.
11//////////////////////////////////////////////////////////////////////// 10////////////////////////////////////////////////////////////////////////
12///////////////////////////////////////////////////////////////////// */ 11///////////////////////////////////////////////////////////////////// */
13var Montage = require("montage/core/core").Montage, 12var Montage = require("montage/core/core").Montage,
@@ -20,22 +19,29 @@ exports.CoreIoApi = Montage.create(Component, {
20 deserializedFromTemplate: { 19 deserializedFromTemplate: {
21 enumerable: false, 20 enumerable: false,
22 value: function () { 21 value: function () {
23 //////////////////////////////////////////////////////////// 22 //Checking for local storage of URL for IO
24 23 if (window.localStorage['ioRootUrl']) {
25 //TODO: Add logic for getting rooUrl from local storage 24 //Getting URL from local storage
26 25 this.rootUrl = window.localStorage['ioRootUrl'];
27 //////////////////////////////////////////////////////////// 26 //Checks for IO API to be active
28 27 this.ioServiceDetected = this.isIoServiceActive();
29 28 //
30 29 console.log('FileIO: localStorage URL detected | IO Service Detected: '+ this.ioServiceDetected);
31 //Checking for status of I/O API 30 //
32 this.ioDetected = this.isActive(); 31 } else {
33 //TODO: Add welcome screen logic, probably externally 32 //TODO: Remove, automatically prompt user on welcome
33 this.rootUrl = 'http://localhost:16380';
34 //TODO: Changed to false, welcome screen prompts user
35 this.ioServiceDetected = this.isIoServiceActive();
36 //
37 console.log('FileIO: localStorage URL NOT detected | IO Service Detected: '+ this.ioServiceDetected);
38 //
39 }
34 } 40 }
35 }, 41 },
36 //////////////////////////////////////////////////////////////////// 42 ////////////////////////////////////////////////////////////////////
37 //Method to check status of I/O API, will return false if not active 43 //Method to check status of I/O API, will return false if not active
38 isActive: { 44 isIoServiceActive: {
39 enumerable: false, 45 enumerable: false,
40 value: function () { 46 value: function () {
41 //Doing a directory root check, a 200 status means running 47 //Doing a directory root check, a 200 status means running
@@ -47,27 +53,27 @@ exports.CoreIoApi = Montage.create(Component, {
47 } 53 }
48 }, 54 },
49 //////////////////////////////////////////////////////////////////// 55 ////////////////////////////////////////////////////////////////////
50 //Root API URL 56 //
51 _ioDetected: { 57 _ioServiceDetected: {
52 enumerable: false, 58 enumerable: false,
53 value: false 59 value: false
54 }, 60 },
55 //////////////////////////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////
56 // 62 //Checking for service availability on boot
57 ioDetected: { 63 ioServiceDetected: {
58 enumerable: false, 64 enumerable: false,
59 get: function() { 65 get: function() {
60 return this._ioDetected; 66 return this._ioServiceDetected;
61 }, 67 },
62 set: function(value) { 68 set: function(value) {
63 this._ioDetected = value; 69 this._ioServiceDetected = value;
64 } 70 }
65 }, 71 },
66 //////////////////////////////////////////////////////////////////// 72 ////////////////////////////////////////////////////////////////////
67 //Root API URL 73 //Root API URL
68 _rootUrl: { 74 _rootUrl: {
69 enumerable: false, 75 enumerable: false,
70 value: 'http://localhost:16380' 76 value: null
71 }, 77 },
72 //////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////
73 // 79 //
@@ -78,6 +84,24 @@ exports.CoreIoApi = Montage.create(Component, {
78 }, 84 },
79 set: function(value) { 85 set: function(value) {
80 this._rootUrl = value; 86 this._rootUrl = value;
87 window.localStorage["ioRootUrl"] = value;
88 }
89 },
90 ////////////////////////////////////////////////////////////////////
91 //API service URL
92 _apiServiceURL: {
93 enumerable: false,
94 value: '/'
95 },
96 ////////////////////////////////////////////////////////////////////
97 //
98 apiServiceURL: {
99 enumerable: false,
100 get: function() {
101 return this.rootUrl+this._apiServiceURL;
102 },
103 set: function(value) {
104 this._apiServiceURL = value;
81 } 105 }
82 }, 106 },
83 //////////////////////////////////////////////////////////////////// 107 ////////////////////////////////////////////////////////////////////