Record Registration
All subclasses of quip.apps.Record
defined by the developer must be registered with the apps API. The registration API is described here, along with the static methods and fields on the class that the developer can include in order to define the behavior of their quip.apps.Record
class.
quip.apps.registerClass
Function(recordClass: quip.apps.Record, recordKey?: string)
Registers a subclass of quip.apps.Record
(or RootRecord
|ImageRecord
|RichTextRecord
) for use in the apps API. recordKey
is required for all calls except for those registering subclasses of quip.apps.RootRecord
. recordKey
should be a string that is unique within the app namespace. It is stored in the Record data so that we can consistently instantiate the correct class for a stored Record object.
All quip.apps.registerClass
calls must be made before the quip.apps.initialize()
call.
Example
- Typescript
- Javascript
class MyRecord extends quip.apps.Record {
static id = "my-record";
static getProperties = () => ({
date: "number",
})
}
quip.apps.registerClass(MyRecord, MyRecord.id);
class Root extends quip.apps.RootRecord {
static getProperties = () => ({
date: "number",
myRecord: MyRecord,
})
}
quip.apps.registerClass(Root, "root");
class MyRecord extends quip.apps.Record {
static id = "my-record";
static getProperties = () => ({
date: "number",
})
}
quip.apps.registerClass(MyRecord, MyRecord.id);
class Root extends quip.apps.RootRecord {
static getProperties = () => ({
date: "number",
myRecord: MyRecord,
})
}
quip.apps.registerClass(Root, "root");