You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
ScottDowne edited this page May 26, 2014
·
15 revisions
Collections
A shared data storage that components can use. Example: A component that creates and stores form data, can store it in the collections so another component can see or use the same data. It'll save it, and persist between app loads.
The Collection Object
var collections = document.querySelector("ceci-collections");
collections is a thing you can call collections related functions from. You can access this and use it from inside your component.
Collection Functions
collections.addSchema(name)
collections.removeSchema(schemaid)
collections.getSchema(schemaid)
collections.getSchemas()
collections.getField(schemaid, fieldid)
collections.getFields(schemaid)
Collection Events
Listen for changes in schema or data. You can add events using collections.addEventListener(event, function() {})
schemachange
Schemas
The Schema Object
var schema = collection.getSchemas()[0];
schema is a thing you can call schema related functions from. You can access this and use it from inside your component.
Schema Functions
schema.addField(name)
schema.removeField(fieldid)
schema.getField(fieldid)
schema.getFields()
schema.name
schema.addItem(item)
schema.removeItem(index)
schema.updateItem(index, item)
schema.saveData()
Schema Events
Listen for changes in schema or data. You can add events using schema.addEventListener(event, function() {})
itemchange
fieldchange
propertychange
Fields
The Field Object
var field = schema.getFields()[0];
field is a thing you can call field related functions from. You can access this and use it from inside your component.