This repository has been archived by the owner on Aug 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major API change, bump version to 0.1.0
- Loading branch information
Showing
21 changed files
with
160 additions
and
132 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
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
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
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
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
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/com/github/sanity/kweb/demos/errorDetection/jsError/jsError.kt
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,13 @@ | ||
package com.github.sanity.kweb.demos.errorDetection.jsError | ||
|
||
import com.github.sanity.kweb.Kweb | ||
|
||
/** | ||
* Created by ian on 3/28/17. | ||
*/ | ||
|
||
fun main(args: Array<String>) { | ||
Kweb(port = 4124, debug = true) { | ||
doc.body.execute("deliberate 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,15 +1,41 @@ | ||
package com.github.sanity.kweb.dom | ||
|
||
import com.github.sanity.kweb.RootReceiver | ||
import com.github.sanity.kweb.Kweb | ||
import com.github.sanity.kweb.WebBrowser | ||
import com.github.sanity.kweb.dom.cookies.CookieReceiver | ||
import com.github.sanity.kweb.dom.element.Element | ||
import com.github.sanity.kweb.dom.element.creation.tags.h1 | ||
import com.github.sanity.kweb.dom.element.modification.text | ||
import com.github.sanity.kweb.dom.element.new | ||
|
||
class Document(private val receiver: RootReceiver) { | ||
/** | ||
* Represents the in-browser Document Object Model, corresponding to the JavaScript | ||
* [document](https://www.w3schools.com/jsref/dom_obj_document.asp) object. | ||
* | ||
* Passed in as `doc` to the `buildPage` lambda of the [Kweb] constructor. | ||
* | ||
* @sample document_sample | ||
*/ | ||
class Document(val receiver: WebBrowser) { | ||
fun getElementById(id: String) = Element(receiver, "document.getElementById(\"$id\")") | ||
|
||
val cookie = CookieReceiver(receiver) | ||
|
||
val body = BodyElement(receiver) | ||
} | ||
|
||
class BodyElement(rootReceiver: RootReceiver, id: String? = null) : Element(rootReceiver, "document.body", "body", id) | ||
/** | ||
* Represents the `body` element of the in-browser Document Object Model, corresponding to | ||
* the JavaScript [body](https://www.w3schools.com/tags/tag_body.asp) tag. | ||
* | ||
* @sample document_sample | ||
*/ | ||
class BodyElement(webBrowser: WebBrowser, id: String? = null) : Element(webBrowser, "document.body", "body", id) | ||
|
||
private fun document_sample() { | ||
Kweb(port = 1234) { | ||
doc.body.new { | ||
h1().text("Hello World!") | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.