Hide

Class: CollaborativeMap

Property
size number

The number of keys in the map.

Methods
addEventListener(type, listener[, opt_capture]) void

Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched.

clear() void

Removes all entries.

delete(key) any type

Removes the entry for the given key (if such an entry exists).

get(key) any type

Returns the value mapped to the given key.

has(key) boolean

Checks if this map contains an entry for the given key.

id() string

The id of this collaborative object. Read-only.

isEmpty() boolean

Returns whether this map is empty.

items() non-null Array of Array

Returns an array containing a copy of the items in this map. Modifications to the returned array do not modify this collaborative map.

keys() non-null Array of string

Returns an array containing a copy of the keys in this map. Modifications to the returned array do not modify this collaborative map.

removeAllEventListeners() void

Removes all event listeners from this object.

removeEventListener(type, listener[, opt_capture]) void

Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.

set(key, value) any type

Put the value into the map with the given key, overwriting an existing value for that key.

toString() string

Returns a string representation of this collaborative object.

type() string

The type of this collaborative object. For standard collaborative objects, see gapi.drive.realtime.CollaborrativeType for possible values; for custom collaborative objects, this value is application-defined.

values() non-null Array of any type

Returns an array containing a copy of the values in this map. Modifications to the returned array do not modify this collaborative map.

new CollaborativeMap()

This class should not be instantiated directly. To create a new map, use gapi.drive.realtime.Model.prototype.createMap().

Extends
gapi.drive.realtime.CollaborativeObject
See also
gapi.drive.realtime.Model.prototype.createMap()
gapi.drive.realtime.EventType

Property

size  number

The number of keys in the map.

Methods

addEventListener(type, listener[, opt_capture])

Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched.

Parameters

Name Type Optional Description

type

string

 

The type of the event to listen for.

listener

(non-null function() or non-null EventListener)

 

The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.

opt_capture

boolean

Yes

Whether to handle the event target in the capture phase instead of the bubble phase.

Inherited from
gapi.drive.realtime.EventTarget#addEventListener

clear()

Removes all entries.

delete(key) → any type

Removes the entry for the given key (if such an entry exists).

Parameter

Name Type Optional Description

key

string

 

The key to unmap.

Returns

any type The value that was mapped to this key, or null if there was no existing value.

get(key) → any type

Returns the value mapped to the given key.

Parameter

Name Type Optional Description

key

string

 

The key to look up.

Returns

any type The value mapped to the given key.

has(key) → boolean

Checks if this map contains an entry for the given key.

Parameter

Name Type Optional Description

key

string

 

The key to check.

Returns

boolean Returns true if this map contains a mapping for the given key.

id()

The id of this collaborative object. Read-only.

Inherited from
gapi.drive.realtime.CollaborativeObject#id

isEmpty() → boolean

Returns whether this map is empty.

Returns

boolean Returns true if this map is empty.

items() → Array of Array

Returns an array containing a copy of the items in this map. Modifications to the returned array do not modify this collaborative map.

Returns

non-null Array of Array The items in this map. Each item is a [key, value] pair.

keys() → Array of string

Returns an array containing a copy of the keys in this map. Modifications to the returned array do not modify this collaborative map.

Returns

non-null Array of string The keys in this map.

removeAllEventListeners()

Removes all event listeners from this object.

Inherited from
gapi.drive.realtime.EventTarget#removeAllEventListeners

removeEventListener(type, listener[, opt_capture])

Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.

Parameters

Name Type Optional Description

type

gapi.drive.realtime.EventType

 

The type of the event to listen for.

listener

(non-null function() or non-null EventListener)

 

The function to or EventListener to remove.

opt_capture

boolean

Yes

Whether to handle the event target in the capture phase instead of the bubble phase.

Inherited from
gapi.drive.realtime.EventTarget#removeEventListener

set(key, value) → any type

Put the value into the map with the given key, overwriting an existing value for that key.

Parameters

Name Type Optional Description

key

string

 

The map key.

value

any type

 

The map value.

Returns

any type The old map value, if any, that used to be mapped to the given key.

toString() → string

Returns a string representation of this collaborative object.

Inherited from
gapi.drive.realtime.CollaborativeObject#toString
Returns

string A string representation.

type()

The type of this collaborative object. For standard collaborative objects, see gapi.drive.realtime.CollaborrativeType for possible values; for custom collaborative objects, this value is application-defined.

Inherited from
gapi.drive.realtime.CollaborativeObject#type

values() → Array of any type

Returns an array containing a copy of the values in this map. Modifications to the returned array do not modify this collaborative map.

Returns

non-null Array of any type The values in this map.

Send feedback about...

Realtime API