MCPcopy Create free account
hub / github.com/cryptii/cryptii / view

Method view

src/Viewer.js:23–54  ·  view source on GitHub ↗

* Views content. * @param {Chain} content * @return {Promise} Resolves when completed.

(content)

Source from the content-addressed store, hash-verified

21 * @return {Promise} Resolves when completed.
22 */
23 async view (content) {
24 try {
25 // check for invalid settings
26 const invalidSettings = this.getSettingsForm().getInvalidFields()
27 if (invalidSettings.length > 0) {
28 throw new InvalidInputError(
29 'Can\'t view content with invalid settings: ' +
30 invalidSettings.map(setting => setting.getLabel()).join(', '))
31 }
32
33 if (!this.hasView()) {
34 // run view as soon as the view is being created
35 this._queuedContent = content
36 return
37 }
38
39 // perform actual view
40 content = await this.willView(content)
41 await this.performView(content)
42 await this.didView(content)
43
44 // clear error
45 if (this._error !== null) {
46 this._error = null
47 this.updateView()
48 }
49 } catch (error) {
50 this._error = error
51 this.updateView()
52 throw error
53 }
54 }
55
56 /**
57 * Triggered before performing view of given content.

Callers 2

didCreateViewMethod · 0.95
_triggerViewerViewMethod · 0.80

Calls 9

willViewMethod · 0.95
performViewMethod · 0.95
didViewMethod · 0.95
getInvalidFieldsMethod · 0.80
getSettingsFormMethod · 0.80
joinMethod · 0.80
getLabelMethod · 0.80
hasViewMethod · 0.80
updateViewMethod · 0.80

Tested by

no test coverage detected