Skip to content

Commit f309738

Browse files
committed
Removed comments from sample.js
1 parent b920be0 commit f309738

File tree

1 file changed

+0
-103
lines changed

1 file changed

+0
-103
lines changed

sample.js

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767

6868
/**
6969
* Fetch the template from the service.
70-
* TODO: Implement promises.
7170
*/
7271
function fetchSpecTemplate() {
7372

@@ -77,16 +76,7 @@
7776
var getTemplateUrl = getCurrentUrl() + 'gettemplate';
7877

7978
// Fetch the template and then insert it into the current document's body.
80-
// httpGetAsync(getTemplateUrl, insertFileIntoBody);
81-
82-
// httpGetAsync(getTemplateUrl)
83-
// .then(insertFileIntoBody(results))
84-
// .catch(function(error) {
85-
// console.log('Error: ' + JSON.stringify(error));
86-
// });
87-
8879
var urlPromise = httpGetAsync(getTemplateUrl);
89-
9080
urlPromise.then(insertFileIntoBody)
9181
.catch(function(err) {
9282
console.log('Error: ' + err);
@@ -125,8 +115,6 @@
125115

126116
/**
127117
* Gets a JSON document that contains a blacklist of words.
128-
*
129-
* TODO: Implement promises.
130118
*/
131119
function getBlackList() {
132120

@@ -141,9 +129,6 @@
141129

142130
// Call the service to get the blacklist, and then cache it in
143131
// localStorage, then return the promise.
144-
// httpGetAsync(getBlacklistUrl, function(json) {
145-
// localStorage.setItem('badwordcache', json);
146-
// });
147132
return httpGetAsync(getBlacklistUrl)
148133
.then(function(json) {
149134
localStorage.setItem('badwordcache', json);
@@ -154,8 +139,6 @@
154139
/**
155140
* Gets the boilerplate text. This demonstrates how to initialize the
156141
* current document with boilerplate stored in a service.
157-
*
158-
* TODO: Implement promises.
159142
*/
160143
function getBoilerplate() {
161144

@@ -166,26 +149,6 @@
166149

167150
// Call the service to get the boilerplate and add it to localStorage,
168151
// then return the promise.
169-
// httpGetAsync(getBoilerplateUrl, function(json) {
170-
171-
// // Put the array of bad words into local storage so that we can
172-
// // access them.
173-
// localStorage.setItem('boilerplate', json);
174-
// var boilerplate = JSON.parse(json);
175-
176-
// var elements = boilerplate.elements;
177-
178-
// // Add the boilerplate names to the drop down.
179-
// for (var i = 0; i < elements.length; i++) {
180-
// $('#boilerplateDropdown').append(new Option(elements[i].name,
181-
// elements[i].name));
182-
// }
183-
184-
// // Initialize stylized fabric UI for dropdown and call the dropdown
185-
// // function to populate dropdown with values. You need to call this
186-
// // when you update contents of a dropdown.
187-
// $(".ms-Dropdown").Dropdown();
188-
// });
189152
return httpGetAsync(getBoilerplateUrl)
190153
.then(function(json) {
191154

@@ -211,8 +174,6 @@
211174

212175
/**
213176
* Save the current boilerplate state with the services.
214-
*
215-
* TODO: Implement promises.
216177
**/
217178
function saveBoilerplate() {
218179

@@ -223,10 +184,6 @@
223184

224185
var boilerplate = localStorage.getItem('boilerplate');
225186

226-
// httpPostAsync(postBoilerplateUrl, boilerplate, function() {
227-
// console.log('Posted the boilerplate back to the service.')
228-
// });
229-
230187
httpPostAsync(postBoilerplateUrl, boilerplate)
231188
.then(function(value) {
232189
console.log(value);
@@ -239,55 +196,9 @@
239196
/**
240197
* GET helper to call a service.
241198
*
242-
* TODO: Implement promises.
243-
*
244199
* @param theUrl {string} The URL of the service.
245200
* @param callback {function} The callback function.
246201
*/
247-
// function httpGetAsync(theUrl, callback) {
248-
// var request = new XMLHttpRequest();
249-
// request.open("GET", theUrl, true);
250-
// request.onreadystatechange = function() {
251-
// if (request.readyState === 4 && request.status === 200)
252-
// callback(request.responseText);
253-
// }
254-
// request.send(null);
255-
// }
256-
257-
// function httpGetAsync(url) {
258-
// var request = new XMLHttpRequest();
259-
// var deferred = Q.defer();
260-
261-
// request.open("GET", url, true);
262-
// // request.onreadystatechange = onreadystatechange;
263-
// request.onload = onload;
264-
// request.onerror = onerror;
265-
// request.send(null);
266-
267-
// // function onreadystatechange() {
268-
// // if (request.readyState === 4 && request.status === 200) {
269-
// // deferred.resolve(request.responseText);
270-
// // } else {
271-
// // deferred.reject(new Error('Status code: ' + request.status));
272-
// // }
273-
274-
// // }
275-
276-
// function onload() {
277-
// if (request.status === 200) {
278-
// deferred.resolve(request.responseText);
279-
// } else {
280-
// deferred.reject(new Error('Status code: ' + request.status));
281-
// }
282-
// }
283-
284-
// function onerror() {
285-
// deferred.reject(new Error('Status code: ' + request.status));
286-
// }
287-
288-
// return deferred.promise;
289-
// }
290-
291202
function httpGetAsync(url) {
292203

293204
return Q.Promise(function(resolve, reject) {
@@ -316,24 +227,10 @@
316227
/**
317228
* POST helper to call a service.
318229
*
319-
* TODO: Implement promises.
320-
*
321230
* @param theUrl {string} The URL of the service.
322231
* @param payload {string} The JSON payload.
323232
* @param callback {function} The callback function.
324233
*/
325-
// function httpPostAsync(theUrl, payload, callback) {
326-
// var request = new XMLHttpRequest();
327-
328-
// request.open("POST", theUrl, true);
329-
// request.setRequestHeader("Content-type", "application/json");
330-
// request.onreadystatechange = function() {
331-
// if (request.readyState === 4 && request.status === 200)
332-
// callback(request.responseText);
333-
// }
334-
// request.send(payload);
335-
// }
336-
337234
function httpPostAsync(url, payload) {
338235
var request = new XMLHttpRequest();
339236
var deferred = Q.defer();

0 commit comments

Comments
 (0)