Skip to content

Commit

Permalink
web:fix init and build api
Browse files Browse the repository at this point in the history
  • Loading branch information
penfeizhou committed Mar 30, 2020
1 parent 050dfc4 commit bd5391a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
9 changes: 6 additions & 3 deletions doric-web/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion doric-web/dist/index.js.map

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions doric-web/src/DoricContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ export class DoricContext {
return Reflect.apply(jsCallEntityMethod, this.panel, argumentsList)
}

init(frame: {
init(extra?: object) {
this.invokeEntityMethod("__init__", extra ? JSON.stringify(extra) : undefined)
}
build(frame: {
width: number,
height: number,
}, extra?: object) {
this.invokeEntityMethod("__init__", frame, extra ? JSON.stringify(extra) : undefined)
}) {
this.invokeEntityMethod("__build__", frame)
}

teardown() {
for (let plugin of this.pluginInstances.values()) {
plugin.onTearDown()
Expand Down
2 changes: 1 addition & 1 deletion doric-web/src/DoricElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class DoricElement extends HTMLElement {
divElement.style.height = '100%'
this.append(divElement)
this.context.rootNode.view = divElement
this.context.init({
this.context.build({
width: divElement.offsetWidth,
height: divElement.offsetHeight,
})
Expand Down

0 comments on commit bd5391a

Please sign in to comment.