Skip to content

Commit 4685da3

Browse files
author
Vladimir Upirov
authored
Merge pull request #111 from Backendless/vupirov/modules
Modules
2 parents 9f157d2 + 211372c commit 4685da3

File tree

174 files changed

+7014
-6288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+7014
-6288
lines changed

.babelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"stage-1"
5+
],
6+
"plugins": [
7+
"transform-object-assign",
8+
"transform-decorators-legacy"
9+
]
10+
}

.eslintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
**/dist/**
2+
**/lib/**
3+
**/es/**
4+
**/node_modules/**
5+
**/webpack.config*.js
6+
test/tsd.**
7+
src/backendless.js
8+
backendless.d.ts

.eslintrc

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"parser": "babel-eslint",
3+
"env": {
4+
"browser": true,
5+
"commonjs": true,
6+
"es6": true,
7+
"node": true
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": 6,
11+
"sourceType": "module",
12+
"ecmaFeatures": {
13+
"experimentalObjectRestSpread": true
14+
}
15+
},
16+
"rules": {
17+
// require function declarations instead of expressions
18+
"func-style": [
19+
"warn",
20+
"declaration",
21+
{ "allowArrowFunctions": true }
22+
],
23+
24+
// disallow declaration of variables already declared in the outer scope
25+
// "no-shadow": "warn",
26+
27+
// require let or const instead of var
28+
"no-var": "warn",
29+
30+
"no-unused-vars": "warn",
31+
32+
"max-len": [
33+
"warn",
34+
120
35+
],
36+
37+
// require or disallow use of semicolons instead of ASI
38+
"semi": [
39+
"warn",
40+
"never"
41+
],
42+
43+
// require the use of === and !== except null comparison
44+
"eqeqeq": [
45+
"warn",
46+
"smart"
47+
],
48+
49+
// specify whether double or single quotes should be used
50+
"quotes": [
51+
"warn",
52+
"single",
53+
"avoid-escape"
54+
],
55+
56+
// require space before/after arrow function"s arrow
57+
"arrow-spacing": [
58+
"warn",
59+
{
60+
"before": true,
61+
"after": true
62+
}
63+
],
64+
65+
"arrow-parens": ["warn", "as-needed"],
66+
67+
// suggest using of const declaration for variables that are never modified after declared
68+
"prefer-const": "warn",
69+
70+
// restrict what can be thrown as an exception
71+
"no-throw-literal": "warn",
72+
73+
// disallow Unused Expressions
74+
"no-unused-expressions": [
75+
"warn",
76+
{
77+
"allowShortCircuit": true
78+
}
79+
],
80+
81+
// require padding inside curly braces
82+
"object-curly-spacing": [
83+
"warn",
84+
"always"
85+
]
86+
}
87+
}

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
.DS_Store
12
.idea/*
23
!.idea/codeStyleSettings.xml
34
*.iml
4-
.DS_Store
5+
*.log
6+
57
node_modules
6-
dist
8+
9+
# Build results
10+
dist
11+
lib
12+
es

src/backendless.d.ts renamed to backendless.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ declare module __Backendless {
3434
**/
3535
function setupDevice(deviceProps:Object):void;
3636

37-
/**
38-
* @public
39-
* @type: Function
40-
**/
41-
function setUIState(state:string):void;
42-
4337
/**
4438
* @namespace Backendless.LocalCache
4539
**/

examples/data-service/todo-app/js/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ jQuery(function($) {
218218
var record = new Task(newTitle);
219219

220220
saveItem(record).then(function(savedItem) {
221-
App.todos.push(savedItem)
221+
App.todos.push(savedItem);
222+
App.render();
222223
}, console.error);
223224
}
224225

examples/file-service/css/fileService.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ body {
66
input[type="file"] {
77
line-height: 1;
88
}
9+
10+
.navbar-inner a {
11+
margin-right: 10px;
12+
}
13+
14+
.navbar-inner .container {
15+
margin-top: 15px;
16+
}
917
/* CUSTOMIZE THE CAROUSEL
1018
-------------------------------------------------- */
1119

@@ -47,7 +55,7 @@ input[type="file"] {
4755
margin-top: 10px;
4856
}
4957

50-
input[type="text"], input[type="password"] {
58+
input[type="text"], input[type="password"], textarea {
5159
width: 400px;
5260
}
5361

examples/file-service/index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525

2626
<div class="navbar navbar-inverse navbar-static-top">
2727
<div class="navbar-inner">
28-
       
2928
<div class="container">
3029
<a class="lead" href="#myCarousel" data-slide-to="0">Upload file</a>
31-
<a class="lead" href="#myCarousel" data-slide-to="1" id="browse-uploaded-link">Browse uploaded</a> 
30+
<a class="lead" href="#myCarousel" data-slide-to="1">Save to file</a>
31+
<a class="lead" href="#myCarousel" data-slide-to="2" id="browse-uploaded-link">Browse uploaded</a> 
3232
</div>
3333

3434
</div>
@@ -50,6 +50,20 @@
5050
</div>
5151
</div>
5252

53+
<div class="item" style="background-color: #FAFAFA">
54+
<div class="container">
55+
<div class="carousel-caption">
56+
<div class="container">
57+
<div><textarea id="textToSave" rows="10" placeholder="Enter text"></textarea></div>
58+
<div><input type="text" id="fileName" placeholder="File name, foo.txt by default"/></div>
59+
<div>
60+
<input id="save-btn" class="btn btn-large btn-primary" type="button" value="Save to File"/>
61+
</div>
62+
</div>
63+
</div>
64+
</div>
65+
</div>
66+
5367
<div class="item" style="background-color: #EFEDEF;">
5468
<div class="container">
5569
<div class="carousel-caption">

examples/file-service/js/files-example.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
$('.thumbnails').on('click', '.thumbnail', onClickFileItem);
2323
$('#browse-uploaded-link').on('click', refreshItemsList);
2424
$('#upload-btn').on('click', uploadFile);
25+
$('#save-btn').on('click', saveFile);
2526
$('#delete-btn').on('click', deleteSelectedFiles);
2627
}
2728

@@ -123,6 +124,20 @@
123124
});
124125
}
125126

127+
function saveFile() {
128+
var fileName = $('#fileName')[0].value || 'foo.txt';
129+
var fileContent = $('#textToSave')[0].value || '';
130+
131+
Backendless.Files.saveFile(TEST_FOLDER, fileName, new Blob([fileContent]), true).then(
132+
function(result) {
133+
console.log(result.fileURL);
134+
showInfo('Content was successfully saved to file.');
135+
}, function(e) {
136+
showInfo(e.message);
137+
}
138+
);
139+
}
140+
126141
function uploadFile() {
127142
var requests = files.map(function(file) {
128143
return Backendless.Files.upload(file, TEST_FOLDER, true).then(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test

0 commit comments

Comments
 (0)