Skip to content

Commit

Permalink
Removed injectCss and added some errors :D
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Mar 16, 2020
1 parent d6af0dd commit 364ab1c
Show file tree
Hide file tree
Showing 11 changed files with 716 additions and 438 deletions.
171 changes: 169 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "deno_webview"
version = "0.1.2"
version = "0.1.3"
authors = ["Elias Sjögreen <eliassjogreen1@gmail.com>"]
edition = "2018"

Expand All @@ -9,7 +9,7 @@ crate-type = ["cdylib"]

[dependencies]
deno_core = "0.36.0"
webview-sys = "0.4.2"
webview-sys = "0.5.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

Expand Down
19 changes: 11 additions & 8 deletions README.md
Expand Up @@ -81,18 +81,16 @@ A `WebView` instance
- WebView.step(): boolean
- Iterates the event loop and returns `false` if the the `WebView` has
been closed
- WebView.exit(): boolean
- WebView.exit(): Void
- Exits the `WebView`
- WebView.eval(js: string): boolean
- WebView.eval(js: string): Void
- Evaluates the provided js code in the `WebView`
- WebView.injectCss(css: string): boolean
- Injects the provided css into the WebView
- WebView.setColor(color: { r: number; g: number; b: number; a: number; }):
boolean
Void
- Sets the color of the title bar to the provided RGBA value
- WebView.setTitle(title: string): boolean
- WebView.setTitle(title: string): Void
- Sets the window title
- WebView.setFullscreen(fullscreen: boolean): boolean
- WebView.setFullscreen(fullscreen: boolean): Void
- Enables or disables fullscreen

## Development
Expand Down Expand Up @@ -176,6 +174,11 @@ using local binaries can be easier to do using the
deno -A scripts/dev.ts example.ts
```

## Contributing

Contributions either in the form of pull requests or issues are always welcome.
Just remember to format using `deno fmt` and `cargo fmt`. Thx <3

## Dependencies

### Deno
Expand All @@ -197,7 +200,7 @@ deno -A scripts/dev.ts example.ts
- [x] Multiple windows/instances? ~~(Help, need to create a static HashMap of
`*mut CWebView`)~~ Used solution found
[here](https://github.com/crabmusket/deno_sqlite_plugin/blob/2df9e495f34d246881de0b48c9c79cc9e271abeb/src/lib.rs#L18)
- [ ] Better errors and responses from rust land
- [x] Better errors and responses from rust land
- [ ] Update ci so building with Edge works
[#3](https://github.com/eliassjogreen/deno_webview/issues/3)
- [ ] Two-way deno bindings (to call deno from javascript)
Expand Down
14 changes: 7 additions & 7 deletions examples/local.ts
@@ -1,17 +1,17 @@
import { WebView } from "../mod.ts";

new WebView({
title: "Local deno_webview example",
url: `data:text/html,
title: "Local deno_webview example",
url: `data:text/html,
<html>
<body>
<h1>Hello from deno</h1>
</body>
</html>
`,
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
}).run();
28 changes: 14 additions & 14 deletions examples/multiple.ts
@@ -1,35 +1,35 @@
import { WebView } from "../mod.ts";

const webview1 = new WebView({
title: "Multiple deno_webview example",
url: `data:text/html,
title: "Multiple deno_webview example",
url: `data:text/html,
<html>
<body>
<h1>1</h1>
</body>
</html>
`,
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
});

const webview2 = new WebView({
title: "Multiple deno_webview example",
url: `data:text/html,
title: "Multiple deno_webview example",
url: `data:text/html,
<html>
<body>
<h1>2</h1>
</body>
</html>
`,
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
});

while (webview1.step() && webview2.step()) {}
14 changes: 7 additions & 7 deletions examples/remote.ts
@@ -1,11 +1,11 @@
import { WebView } from "../mod.ts";

new WebView({
title: "Remote deno_webview example",
url: `https://en.wikipedia.org/wiki/Main_Page`,
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
title: "Remote deno_webview example",
url: `https://en.wikipedia.org/wiki/Main_Page`,
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false
}).run();

0 comments on commit 364ab1c

Please sign in to comment.