Skip to content

Commit

Permalink
Fixing a glitch on rendering at load time
Browse files Browse the repository at this point in the history
  • Loading branch information
Javiani committed Nov 20, 2024
1 parent b600740 commit 86c910e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/jails.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jails.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jails-js",
"version": "5.8.2",
"version": "5.8.3",
"description": "Jails - Elegant and Minimalistic Javascript Application Library",
"module": "./dist/jails.js",
"main": "./dist/jails.js",
Expand Down
8 changes: 4 additions & 4 deletions src/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Component from './component'
import { purge, rAF } from './utils'

export default function Element(module, dependencies, templates, components) {

return class extends HTMLElement {

base: any
Expand All @@ -16,13 +17,12 @@ export default function Element(module, dependencies, templates, components) {

this.base = base
this.options = options
this.base.render()
this.returns = module.default(base)
}

connectedCallback() {

this.base.render()

if( this.__template && this.__template.constructor === Promise ) {
this.__template.then( _ => {
if( this.base && this.options.main) {
Expand All @@ -44,7 +44,8 @@ export default function Element(module, dependencies, templates, components) {
}
}
})
}else {

} else {
if( this.base && this.options.main ){
const array = this.options.main(this.base)
if( array && array.length ) {
Expand All @@ -64,7 +65,6 @@ export default function Element(module, dependencies, templates, components) {
purge(this)
}
})

}

attributeChangedCallback() {
Expand Down

0 comments on commit 86c910e

Please sign in to comment.