-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split UI interface into Renderer and Updater
- Loading branch information
Showing
3 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package jaws | ||
|
||
import "io" | ||
|
||
type Renderer interface { | ||
// JawsRender is called once per Element when rendering the initial webpage. | ||
// Do not call this yourself unless it's from within another JawsRender implementation. | ||
JawsRender(e *Element, w io.Writer, params []any) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
package jaws | ||
|
||
import ( | ||
"io" | ||
) | ||
|
||
// UI defines the required methods on JaWS UI objects. | ||
// In addition, all UI objects must be comparable so they can be used as map keys. | ||
type UI interface { | ||
// JawsRender is called once per Element when rendering the initial webpage. | ||
// Do not call this yourself unless it's from within another JawsRender implementation. | ||
JawsRender(e *Element, w io.Writer, params []any) error | ||
|
||
// JawsUpdate is called for an Element that has been marked dirty to update it's HTML. | ||
// Do not call this yourself unless it's from within another JawsUpdate implementation. | ||
JawsUpdate(e *Element) | ||
Renderer | ||
Updater | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package jaws | ||
|
||
type Updater interface { | ||
// JawsUpdate is called for an Element that has been marked dirty to update it's HTML. | ||
// Do not call this yourself unless it's from within another JawsUpdate implementation. | ||
JawsUpdate(e *Element) | ||
} |