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

Method run

src/App.js:53–95  ·  view source on GitHub ↗

* Bootstraps the application. * @param {?object} [pipeData=null] Initial pipe data * @return {App} Fluent interface

(pipeData = null)

Source from the content-addressed store, hash-verified

51 * @return {App} Fluent interface
52 */
53 run (pipeData = null) {
54 // Create and configure pipe instance
55 if (pipeData !== null) {
56 this._pipe = Pipe.extract(pipeData, BrickFactory.getInstance())
57 } else {
58 this._pipe = new Pipe()
59 this._pipe.setBrickFactory(BrickFactory.getInstance())
60 }
61
62 // Configure pipe service
63 this._pipe.setService(this._service)
64
65 // Trigger view creation and initial layout
66 const view = this.getView()
67 view.layout()
68 setTimeout(view.layout.bind(view), 100)
69
70 // Configure service worker, if supported
71 if (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {
72 if (this._config.serviceWorkerUrl) {
73 // Register the service worker
74 navigator.serviceWorker.register(this._config.serviceWorkerUrl, {
75 scope: this._config.scope
76 })
77 } else {
78 // Unregister existing service workers
79 navigator.serviceWorker.getRegistrations().then(registrations =>
80 registrations.forEach(registration => registration.unregister()))
81 }
82 }
83
84 // Listen for the debug shortcut `Ctrl+I`
85 if (EnvUtil.isBrowser()) {
86 document.addEventListener('keydown', evt => {
87 if (evt.ctrlKey && evt.key === 'i') {
88 evt.preventDefault()
89 window.alert(this.debug())
90 }
91 })
92 }
93
94 return this
95 }
96
97 /**
98 * Composes a JSON string containing debug information about the current app

Callers 1

initFunction · 0.95

Calls 9

debugMethod · 0.95
setBrickFactoryMethod · 0.80
setServiceMethod · 0.80
getViewMethod · 0.80
isBrowserMethod · 0.80
extractMethod · 0.45
getInstanceMethod · 0.45
layoutMethod · 0.45
registerMethod · 0.45

Tested by

no test coverage detected