Skip to content

Commit b04e615

Browse files
committed
Finished docs. Uniformed events
1 parent 9b67d45 commit b04e615

File tree

2 files changed

+113
-11
lines changed

2 files changed

+113
-11
lines changed

README.md

+104
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,108 @@ try {
209209
} catch(e) {
210210
console.log(e);
211211
}
212+
```
213+
214+
### getProfiles
215+
216+
Returns a list of the backup profiles.
217+
The callback receives an array:
218+
```json
219+
[{id, name}]
220+
```
221+
222+
```js
223+
var akeeba = require('akeebabackup');
224+
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');
225+
226+
try {
227+
// yoursite.getProfiles(callback)
228+
yoursite.getProfiles(function(data){
229+
console.log(data);
230+
});
231+
} catch(e) {
232+
console.log(e);
233+
}
234+
```
235+
236+
### getVersion
237+
238+
Returns the version number of the API and the component.
239+
The callback receives an object:
240+
```json
241+
{api, component, date, edition, updateinfo}
242+
```
243+
244+
```js
245+
var akeeba = require('akeebabackup');
246+
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');
247+
248+
try {
249+
// yoursite.getVersion(callback)
250+
yoursite.getVersion(function(data){
251+
console.log(data);
252+
});
253+
} catch(e) {
254+
console.log(e);
255+
}
256+
```
257+
258+
### listBackups
259+
260+
Returns a (partial) list of the backup records known to the component.
261+
The records are presented in reverse order, i.e. the first record is the last backup attempt,
262+
whereas the last record is the earliest backup attempt known to the component.
263+
264+
```js
265+
var akeeba = require('akeebabackup');
266+
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');
267+
268+
try {
269+
// yoursite.listBackups(callback, start, limit)
270+
yoursite.listBackups(function(data){
271+
console.log(data);
272+
}, 0, 50);
273+
} catch(e) {
274+
console.log(e);
275+
}
276+
```
277+
278+
### update
279+
280+
Triggers the entire akeeba update process
281+
282+
```js
283+
var akeeba = require('akeebabackup');
284+
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');
285+
286+
try {
287+
yoursite.update();
288+
289+
yoursite.on('step', function(){
290+
console.log('step completed');
291+
});
292+
yoursite.on('completed', function(){
293+
console.log('update completed');
294+
});
295+
} catch(e) {
296+
console.log(e);
297+
}
298+
```
299+
300+
### updateGetInformation
301+
302+
Returns update status information, as returned by Live Update itself
303+
304+
```js
305+
var akeeba = require('akeebabackup');
306+
var yoursite = new akeeba('http://www.example.com', 'yoursecretkey');
307+
308+
try {
309+
// yoursite.updateGetInformation(callback, force_fetch_new_data)
310+
yoursite.updateGetInformation(function(data){
311+
console.log(data);
312+
}, true);
313+
} catch(e) {
314+
console.log(e);
315+
}
212316
```

index.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -411,18 +411,16 @@ AkeebaBackup.prototype.updateGetInformation = function(callback, force) {
411411
/**
412412
* Triggers the entire akeeba update process
413413
*
414-
* @fires updated
415-
* @fires update_download
416-
* @fires update_extract
417-
* @fires update_install
414+
* @fires step
415+
* @fires completed
418416
*/
419417
AkeebaBackup.prototype.update = function() {
420418
var $this = this;
421419

422420
this.updateDownload(function(){
423421
$this.updateExtract(function(){
424422
$this.updateInstall(function(data){
425-
$this.emit('updated', data);
423+
$this.emit('completed', data);
426424
});
427425
})
428426
});
@@ -433,7 +431,7 @@ AkeebaBackup.prototype.update = function() {
433431
*
434432
* @param {Function} callback The callback called at the end of the download
435433
*
436-
* @fires update_download
434+
* @fires step
437435
*/
438436
AkeebaBackup.prototype.updateDownload = function(callback) {
439437

@@ -442,7 +440,7 @@ AkeebaBackup.prototype.updateDownload = function(callback) {
442440
var json = this.getRequest('updateDownload');
443441

444442
this.sendRequest(json, function (data) {
445-
$this.emit('update_download', data);
443+
$this.emit('step', data);
446444
callback(data);
447445
});
448446
}
@@ -452,7 +450,7 @@ AkeebaBackup.prototype.updateDownload = function(callback) {
452450
*
453451
* @param {Function} callback The callback called at the end of the download
454452
*
455-
* @fires update_extract
453+
* @fires step
456454
*/
457455
AkeebaBackup.prototype.updateExtract = function(callback) {
458456

@@ -461,7 +459,7 @@ AkeebaBackup.prototype.updateExtract = function(callback) {
461459
var json = this.getRequest('updateExtract');
462460

463461
this.sendRequest(json, function (data) {
464-
$this.emit('update_extract', data);
462+
$this.emit('step', data);
465463
callback(data);
466464
});
467465
}
@@ -471,7 +469,7 @@ AkeebaBackup.prototype.updateExtract = function(callback) {
471469
*
472470
* @param {Function} callback The callback called at the end of the download
473471
*
474-
* @fires update_install
472+
* @fires step
475473
*/
476474
AkeebaBackup.prototype.updateInstall = function(callback) {
477475

@@ -480,7 +478,7 @@ AkeebaBackup.prototype.updateInstall = function(callback) {
480478
var json = this.getRequest('updateInstall');
481479

482480
this.sendRequest(json, function (data) {
483-
$this.emit('update_install', data);
481+
$this.emit('step', data);
484482
callback(data);
485483
});
486484
}

0 commit comments

Comments
 (0)