Skip to content

Commit

Permalink
add-update-metadata-method (#146)
Browse files Browse the repository at this point in the history
Co-authored-by: metapage CI Robot <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent 6228713 commit 6ac14ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/libs/src/metapage/Metapage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
} from './v0_4';
import {
MetapageDefinitionV1,
MetapageMetadataV1,
MetapageOptionsV1,
} from './v1';
import { VersionsMetapage } from './versions';
Expand Down Expand Up @@ -232,6 +233,7 @@ export class Metapage extends MetapageShared {
this.setOutputStateOnlyMetaframeInputValue = this.setOutputStateOnlyMetaframeInputValue.bind(this);
this.setOutputStateOnlyMetaframeInputMap = this.setOutputStateOnlyMetaframeInputMap.bind(this);
this.setOutputStateOnlyMetapageInstanceInputs = this.setOutputStateOnlyMetapageInstanceInputs.bind(this);
this.setMetadata = this.setMetadata.bind(this);
this.setMetaframeClientInputAndSentClientEvent =
this.setMetaframeClientInputAndSentClientEvent.bind(this);
this.setState = this.setState.bind(this);
Expand Down Expand Up @@ -382,6 +384,13 @@ export class Metapage extends MetapageShared {
return this;
}

setMetadata(metadata: MetapageMetadataV1) {
this._definition = create(this._definition, (draft) => {
draft.meta = metadata;
});
this._emitDefinitionEvent();
}

// Convenience method
_emitDefinitionEvent() {
if (this.listenerCount(MetapageEvents.Definition) > 0) {
Expand Down

0 comments on commit 6ac14ca

Please sign in to comment.