CoCreateJS

Learn how to convert your html into a dynamic realtime application.

CRUD Objects

Simple objects you can use to create custom components.

Create Document Parameters

  • namespace string optional

    create namespace

  • rooms string optional

    creates room

  • broadcast boolean optional

    broadcast or only save to db

  • collection string required

    collection to save to

  • data object optional

    data to save

  • metaData string array object optional

    Additonal data in the form of a string , array or object

  
  crud.createDocument({
    namespace:'string',
    room:'string',
    broadcast: true|false, //default to true
    broadcastSender: true|false, //default to true 

    collection: "string",
    data:{
      name1: "hello"
      name2: "hello1"
    },
    async: true|false, //defaults to false
    event: eventName,
    metaData: "xxxx"
  }),
  
						

Read Document Parameters

Update Document Parameters

Delete Document Parameters

Read Document List Parameters

CRDT Objects

Conflict resolving objects to create collabrative apps.

Init CRDT Parameters

  • namespace string optional

    create namespace

  • rooms string optional

    creates room

  • broadcast boolean optional

    broadcast or only save to db

  • collection string required

    collection to save to

  • data object optional

    data to save

  • metaData string array object optional

    Additonal data in the form of a string , array or object

  
  crdt.init({
    collection: "module",
    document_id: "",
    name: "",
    metadata: "xxxx"
  })
  
						

Get Data CRDT Parameters

Update Data CRDT Parameters

Replace Data CRDT Parameters

Cursor Objects

Send and receive cursor positions

Send Cursor position Parameters

  • collection string required

    collection to save to

  • document_id string required

    Document _id to save to

  • name string required

    Save data onChange. If attribute is empty or not used Default's to true.

  • startPosition string optional

    Save data onChange/submitBtn. If attribute is empty or not used Default's to true.

  • endPositon string array object optional

    Additonal data in the form of a string , array or object

  
  crdt.sendPosition({
	collection:"module_activities",
	document_id:"5e4802ce3ed96d38e71fc7e5",
	name:"name",
	start: 2,
	end: 2,
  )}
  
						

Get Cursor position Parameters

WebSocket Objects

Send and listen to messages

Create Socket Parameters

  • collection string required

    collection to save to

  • document_id string required

    Document _id to save to

  • name string required

    Save data onChange. If attribute is empty or not used Default's to true.

  • start string optional

    Save data onChange/submitBtn. If attribute is empty or not used Default's to true.

  • end string array object optional

    Additonal data in the form of a string , array or object

  
  socket.create({
    namespace: '',
    rooms: [r1, r2],
    broadcast: true/false,
    broadcastSender: true/false
	message': 'function name to trigger',
	data': 'let's play a game ....'
  })
  
						

Send Message Parameters

Listen Message Parameters