aboutsummaryrefslogtreecommitdiff
path: root/js/io/system
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-05 10:42:58 -0800
committerJose Antonio Marquez2012-02-05 10:42:58 -0800
commit8c530e9291721083ba11746fc5b3da66dc692120 (patch)
tree937fae004df02bfb3769c1d696cd1109eff108bf /js/io/system
parentd1fda420f898965b5dd57de0c8340886cef308a8 (diff)
downloadninja-8c530e9291721083ba11746fc5b3da66dc692120.tar.gz
Setting up IO Ninja Library
This class will be used to copy locally the library needed for Ninja's IO.
Diffstat (limited to 'js/io/system')
-rw-r--r--js/io/system/chromeapi.js49
-rwxr-xr-xjs/io/system/coreioapi.js6
-rwxr-xr-xjs/io/system/fileio.js13
-rw-r--r--js/io/system/ninjalibrary.js29
4 files changed, 96 insertions, 1 deletions
diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js
index d1ff6da3..04e62b11 100644
--- a/js/io/system/chromeapi.js
+++ b/js/io/system/chromeapi.js
@@ -7,6 +7,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7/* ///////////////////////////////////////////////////////////////////// 7/* /////////////////////////////////////////////////////////////////////
8//////////////////////////////////////////////////////////////////////// 8////////////////////////////////////////////////////////////////////////
9NOTES: 9NOTES:
10 The init function starts up the file system API, and a size must be
11 set, no unlimited available as of now.
10//////////////////////////////////////////////////////////////////////// 12////////////////////////////////////////////////////////////////////////
11///////////////////////////////////////////////////////////////////// */ 13///////////////////////////////////////////////////////////////////// */
12// 14//
@@ -24,9 +26,11 @@ exports.ChromeApi = Montage.create(Object.prototype, {
24 //Current way to init Chrome's fileSystem API 26 //Current way to init Chrome's fileSystem API
25 window.webkitRequestFileSystem(window.PERSISTENT, size*1024*1024, function (fs) { 27 window.webkitRequestFileSystem(window.PERSISTENT, size*1024*1024, function (fs) {
26 this.fileSystem = fs; 28 this.fileSystem = fs;
27 }).bind(this); 29 }.bind(this));
30 return true;
28 } else { 31 } else {
29 //No fileSystem API 32 //No fileSystem API
33 return false;
30 } 34 }
31 } 35 }
32 }, 36 },
@@ -46,6 +50,49 @@ exports.ChromeApi = Montage.create(Object.prototype, {
46 set: function(value) { 50 set: function(value) {
47 this._fileSystem = value; 51 this._fileSystem = value;
48 } 52 }
53 },
54 ////////////////////////////////////////////////////////////////////
55 //
56 directoryNew: {
57 enumerable: true,
58 value: function() {
59 }
60 },
61
62 ////////////////////////////////////////////////////////////////////
63 //
64 directoryDelete: {//TODO: Make sure it uses a force delete
65 enumerable: true,
66 value: function() {
67 }
68 },
69 ////////////////////////////////////////////////////////////////////
70 //
71 directoryContents: {
72 enumerable: true,
73 value: function() {
74 }
75 },
76 ////////////////////////////////////////////////////////////////////
77 //
78 directoryCopy: {
79 enumerable: true,
80 value: function() {
81 }
82 },
83 ////////////////////////////////////////////////////////////////////
84 //
85 directoryRename: {
86 enumerable: true,
87 value: function() {
88 }
89 },
90 ////////////////////////////////////////////////////////////////////
91 //
92 directoryMove: {
93 enumerable: true,
94 value: function() {
95 }
49 } 96 }
50 //////////////////////////////////////////////////////////////////// 97 ////////////////////////////////////////////////////////////////////
51 //////////////////////////////////////////////////////////////////// 98 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index c34e0736..73d9fa76 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -28,6 +28,12 @@ exports.CoreIoApi = Montage.create(Component, {
28 //////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////
29 //Getting reference of chrome file system API 29 //Getting reference of chrome file system API
30 this.chromeFileSystem = ChromeApi; 30 this.chromeFileSystem = ChromeApi;
31 //Sending size in MBs for file system storage
32 if (this.chromeFileSystem.init(20)) {
33 //Available
34 } else {
35 //Not available
36 }
31 //////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////
32 //Checking for local storage of URL for IO 38 //Checking for local storage of URL for IO
33 if (window.localStorage['ioRootUrl']) { 39 if (window.localStorage['ioRootUrl']) {
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index 355812da..2c49e849 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -91,6 +91,19 @@ exports.FileIo = Montage.create(Object.prototype, {
91 }, 91 },
92 //////////////////////////////////////////////////////////////////// 92 ////////////////////////////////////////////////////////////////////
93 // 93 //
94 deleteFile: {
95 enumerable: true,
96 value: function() {
97 //Checking for API to be available
98 if (!this.application.ninja.coreIoApi.cloudAvailable()) {
99 //API not available, no IO action taken
100 return null;
101 }
102 //
103 }
104 },
105 ////////////////////////////////////////////////////////////////////
106 //
94 copyFile: { 107 copyFile: {
95 enumerable: true, 108 enumerable: true,
96 value: function() { 109 value: function() {
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js
new file mode 100644
index 00000000..3f8585ed
--- /dev/null
+++ b/js/io/system/ninjalibrary.js
@@ -0,0 +1,29 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7/* /////////////////////////////////////////////////////////////////////
8////////////////////////////////////////////////////////////////////////
9NOTES:
10////////////////////////////////////////////////////////////////////////
11///////////////////////////////////////////////////////////////////// */
12//
13var Montage = require("montage/core/core").Montage;
14////////////////////////////////////////////////////////////////////////
15//
16exports.NinjaLibrary = Montage.create(Object.prototype, {
17 ////////////////////////////////////////////////////////////////////
18 //
19 init: {
20 enumerable: true,
21 value: function() {
22 //
23 }
24 }
25 ////////////////////////////////////////////////////////////////////
26 ////////////////////////////////////////////////////////////////////
27});
28////////////////////////////////////////////////////////////////////////
29//////////////////////////////////////////////////////////////////////// \ No newline at end of file