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

Method setFocus

src/View.js:282–298  ·  view source on GitHub ↗

* Sets focus. * @param {boolean} focus * @return {View} Fluent interface

(focus)

Source from the content-addressed store, hash-verified

280 * @return {View} Fluent interface
281 */
282 setFocus (focus) {
283 if (focus !== this._focus) {
284 this._focus = focus
285 if (focus) {
286 // inform superview
287 if (this._superview !== null) {
288 this._superview.subviewDidFocus(this)
289 }
290 this.didFocus()
291 } else {
292 // blur subviews
293 this._subviews.forEach(subview => subview.blur())
294 this.didBlur()
295 }
296 }
297 return this
298 }
299
300 /**
301 * Returns true, if view or one of the subviews has focus.

Callers 2

focusMethod · 0.95
blurMethod · 0.95

Calls 4

didFocusMethod · 0.95
didBlurMethod · 0.95
subviewDidFocusMethod · 0.80
blurMethod · 0.80

Tested by

no test coverage detected