
Parsifly Docs
IField
IField Represents a reference to a specific field within a Document.
parsifly-extension-base / index / IField
Interface: IField<T>
Defined in: lib/data-providers/index.ts:25
IField Represents a reference to a specific field within a Document.
Type Parameters
T
T
The type of the field's value.
Methods
onValue()
onValue(
callback):Promise<ISubscription>
Defined in: lib/data-providers/index.ts:51
Subscribes to real-time updates for this field.
Parameters
callback
(value) => Promise<void>
The function to call when the value changes.
Returns
An object with an unsubscribe method.
Example
const sub = await provider.doc('project').field('name').onValue(name => console.log(name));
await sub.unsubscribe();
set()
set(
newValue):Promise<void>
Defined in: lib/data-providers/index.ts:41
Sets the value of the field.
Parameters
newValue
T
The new value to set.
Returns
Promise<void>
A Promise that resolves when the operation is complete.
Example
await provider.doc('project').field('name').set('New Name');
value()
value():
Promise<T>
Defined in: lib/data-providers/index.ts:32
Retrieves the current value of the field.
Returns
Promise<T>
A Promise that resolves with the field's value.
Example
const name = await provider.doc('project').field('name').value();