Class ContentTransfer
Class defined in:content-hub.js:11
ContentTransfer is an object created by the ContentHub to and allows one to properly setup and manage a data transfer between two peers.
ContentTransfer( )
content-hub.js:11
Example
var api = external.getUnityObject('1.0');
var hub = api.ContentHub;
var pictureContentType = hub.ContentType.Pictures;
hub.defaultSourceForType(
pictureContentType
, function(peer) {
hub.importContentForPeer(
pictureContentType,
peer,
function(transfer) {
[setup the transfer options and store]
transfer.start(function(state) { [...] });
});
});
direction( callback )
content-hub.js:150
Retrieves the current transfer direction.
If the callback parameter is not set, the current "local" value is retrieved.
Parameters:-
callback<Function(ContentTransfer.Direction)>(optional)
finalize( )
content-hub.js:209
Sets State to ContentTransfer.Finalized and cleans up temporary files.
items( callback )
content-hub.js:177
Retrieves the list of items associated with the ContentTransfer.
Parameters:-
callback<Function( Objectname: , url:>} )}
onStateChanged( callback )
content-hub.js:115
Notifies the listener when the state of the transfer changes.
Parameters:-
callback<Function(ContentTransfer.State)>
selectionType( callback )
content-hub.js:125
Retrieves the current selection type.
Parameters:-
callback<Function(ContentTransfer.SelectionType)>
setDirection( direction, callback )
content-hub.js:165
Sets the transfer direction (import or export).
Parameters:-
direction<ContentTransfer.Direction> -
callback<Function()>called when the state has been updated
setItems( items, callback )
content-hub.js:186
Sets the list of items for the associated ContentTransfer (used when exporting).
Parameters:-
items<Array of Objectname: String, url: String>}
-
callback<Function()>called when the state has been updated
setSelectionType( selectionType, callback )
content-hub.js:138
Sets the selection type (single or multiple).
Parameters:-
selectionType<ContentTransfer.SelectionType> -
callback<Function()>called when the state has been updated
setState( state, callback )
content-hub.js:105
Sets the state of the transfer.
Parameters:-
state<ContentTransfer.State> -
callback<Function()>called when the state has been updated
setStore( store, callback )
content-hub.js:79
Sets the current store for the ContentTransfer.
Parameters:-
store<ContentStore> -
callback<Function()>(optional) called when the store has been updated
start( callback )
content-hub.js:199
Starts a transfer
Parameters:-
callback<Function(ContentTransfer.State)>
state( callback )
content-hub.js:90
Retrieves the current state.
If the callback parameter is not set, the current "local" value is retrieved.
Parameters:-
callback<Function(ContentTransfer.State)>(optional)
store( callback )
content-hub.js:64
Retrieves the current store.
If the callback parameter is not set, the current "local" value is retrieved.
Parameters:-
callback<Function(String)>(optional)
Content Hub JS API: ContentTransfer