1.0.23 • Published 2 years ago

@elastosfoundation/elastos-cordova-plugin-hive v1.0.23

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

title: hive

description: The Hive javascript API.

elastos-cordova-plugin-hive

This plugin defines a global cordova.hivePlugin object, which provides an API for hive library.

Although in the global scope, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log(hivePlugin);
}

Installation

    cordova plugin add elastos-cordova-plugin-hive

Supported Platforms

  • Android
  • iOS

API Reference

Classes

File

Kind: global class

new File()

The class representing File.

file.getLastInfo(onSuccess, onError) ⇒

Get the information(ID, name size, type) of the file got last time.

Kind: instance method of File Returns: onSuccess will be called on success, otherwise onError will be called.

ParamTypeDescription
onSuccessfunctionThe function to call on success.
onErrorfunctionThe function to call on error.

file.getInfo() ⇒

Get the information(ID, name, size, type) of the file from the server.

Kind: instance method of File Returns: A promise object that contains the information(ID, name, size, type) of the file will be returned on success, otherwise a promise object that contains error information will be returned.

file.moveTo(destPath) ⇒

Move to a new path.

Kind: instance method of File Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
destPathstringThe new path.

file.copyTo(newPath) ⇒

Copy to a new path.

Kind: instance method of File Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
newPathstringThe new path.

file.deleteItem() ⇒

Delete.

Kind: instance method of File Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

file.readData(length) ⇒

Read data of a specified length sequentially.

Kind: instance method of File Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
lengthnumberThe length of data to write.

file.writeData(data) ⇒

Write local change on File.

Kind: instance method of File Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
datastringThe data to write.

file.commit() ⇒

Commit local change on File to backend.

Kind: instance method of File Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

file.discard(onSuccess) ⇒

Discard local change on File.

Kind: instance method of File Returns: onSuccess will be called on success.

ParamTypeDescription
onSuccessfunctionThe function to call on success.

Directory

Kind: global class

new Directory()

The class representing Directory.

directory.getLastInfo(onSuccess, onError) ⇒

Get the information(ID, name, childCount) of the directory got last time.

Kind: instance method of Directory Returns: onSuccess will be called on success, otherwise onError will be called.

ParamTypeDescription
onSuccessfunctionThe function to call on success.
onErrorfunctionThe function to call on error.

directory.getInfo() ⇒

Get the information(ID, name, childCount) of the directory from the server.

Kind: instance method of Directory Returns: A promise object that contains the information(ID, name, childCount) of the file will be returned on success, otherwise a promise object that contains error information will be returned.

directory.createDirectory(name) ⇒

Create directory with name.

Kind: instance method of Directory Returns: A directory will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
namestringThe directory name.

directory.getDirectory(name) ⇒

Get the directory with a specified name.

Kind: instance method of Directory Returns: A directory will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
namestringThe directory name.

directory.createFile(name) ⇒

Create file with name.

Kind: instance method of Directory Returns: A file will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
namestringThe file name.

directory.getFile(name) ⇒

Get the File with a specified name.

Kind: instance method of Directory Returns: A file will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
namestringThe file name.

directory.getChildren() ⇒

Get children for current directory.

Kind: instance method of Directory Returns: The children for current directory will be returned on success, otherwise a promise object that contains error information will be returned.

directory.moveTo(destPath) ⇒

Move to a new path.

Kind: instance method of Directory Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
destPathstringThe destination path.

directory.copyTo(newPath) ⇒

Copy to a new path.

Kind: instance method of Directory Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

ParamTypeDescription
newPathstringThe new path.

directory.deleteItem() ⇒

Delete.

Kind: instance method of Directory Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

Drive

Kind: global class

new Drive()

The class representing Drive.

drive.getLastInfo(onSuccess, onError) ⇒

Get the information(ID) of the drive got last time.

Kind: instance method of Drive Returns: onSuccess will be called on success, otherwise onError will be called.

ParamTypeDescription
onSuccessfunctionThe function to call on success.
onErrorfunctionThe function to call on error.

drive.getInfo() ⇒

Get the information(ID) of the drive from the server.

Kind: instance method of Drive Returns: A promise object that contains the information(ID) of the file will be returned on success, otherwise a promise that contains error information will be returned.

drive.rootDirctory() ⇒

Get the root directory.

Kind: instance method of Drive Returns: A directory will be returned on success, otherwise a promise that contains error information will be returned.

drive.createDirectory(path) ⇒

Create directory with path.

Kind: instance method of Drive Returns: A directory will be returned on success, otherwise a promise that contains error information will be returned.

ParamTypeDescription
pathstringThe directory path.

drive.getDirectory(path) ⇒

Get the directory with a specified path.

Kind: instance method of Drive Returns: A directory will be returned on success, otherwise a promise that contains error information will be returned.

ParamTypeDescription
pathstringThe directory path.

drive.createFile(path) ⇒

Create file with path.

Kind: instance method of Drive Returns: A file will be returned on success, otherwise a promise that contains error information will be returned.

ParamTypeDescription
pathstringThe file path.

drive.getFile(path) ⇒

Get the File with a specified path.

Kind: instance method of Drive Returns: A file will be returned on success, otherwise a promise that contains error information will be returned.

ParamTypeDescription
pathstringThe file path.

drive.getItemInfo(path) ⇒

Get the information(ID, name, size, type) of the drive with a specified path.

Kind: instance method of Drive Returns: A promise object that contains success information will be returned on success, otherwise a promise that contains error information will be returned.

ParamTypeDescription
pathstringThe drive path.

Client

Kind: global class

new Client()

The class representing Client.

client.login(onSuccess, onError, handler) ⇒

Associate a user with the Client.

Kind: instance method of Client Returns: onSuccess will be called on success, otherwise onError will be called.

ParamTypeDescription
onSuccessfunctionThe function to call on success.
onErrorfunctionThe function to call on error.
handlerfunctionThe function to call.

client.logout(onSuccess, onError) ⇒

Dissociate the user from the Client.

Kind: instance method of Client Returns: onSuccess will be called on success, otherwise onError will be called.

ParamTypeDescription
onSuccessfunctionThe function to call on success.
onErrorfunctionThe function to call on error.

client.getLastInfo(onSuccess, onError) ⇒

Get the last associated user's information with client information.

Kind: instance method of Client Returns: onSuccess will be called on success, otherwise onError will be called.

ParamTypeDescription
onSuccessfunctionThe function to call on success.
onErrorfunctionThe function to call on error.

client.getInfo() ⇒

Get associated user's information with client information.

Kind: instance method of Client Returns: A promise object that contains success information will be returned on success, otherwise a promise object that contains error information will be returned.

client.getDefDrive() ⇒

Get the current backend's Drive instance associated with the client's drive.

Kind: instance method of Client Returns: A drive will be returned on success, otherwise a promise object that contains error information will be returned.

1.0.23

2 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago