generated from garrettmills/template-npm-typescript
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
547 B
20 lines
547 B
2 years ago
|
import {LogicalComponent} from './Logical.component.js'
|
||
|
import {Component} from '../decorators.js'
|
||
|
|
||
|
@Component('ex-session')
|
||
|
export class SessionComponent extends LogicalComponent {
|
||
|
mount() {
|
||
|
super.mount()
|
||
|
|
||
|
;(window as any).session = this.session()
|
||
|
|
||
|
try {
|
||
|
const data = JSON.parse(this.value())
|
||
|
this.session().populate(data)
|
||
|
} catch (e) {
|
||
|
console.error('Error parsing JSON session data!', this.value()) // eslint-disable-line no-console
|
||
|
throw e
|
||
|
}
|
||
|
}
|
||
|
}
|