Skip to content

Commit

Permalink
Small changes, bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Apr 15, 2020
1 parent e03caa2 commit 52d68b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
40 changes: 18 additions & 22 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
import * as Plugin from "./plugin.ts";

const DEFAULT_PARAMS: Plugin.WebViewNewParams = {
title: "deno_webview",
url: "about:blank",
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false,
};

/**
* The constructor parameters
*/
export type WebViewParams = Partial<Plugin.WebViewNewParams>;

/**
* A WebView instance
*/
export class WebView {
private id: number = 0;

constructor(args: {
title?: string;
url?: string;
width?: number;
height?: number;
resizable?: boolean;
debug?: boolean;
frameless?: boolean;
}) {
args = Object.assign(
{
title: "deno_webview",
url: "about:blank",
width: 800,
height: 600,
resizable: true,
debug: true,
frameless: false,
},
args,
);
constructor(params: WebViewParams) {
params = Object.assign(DEFAULT_PARAMS, params);

this.id = Plugin.WebViewNew(args as Plugin.WebViewNewParams).id;
this.id = Plugin.WebViewNew(params as Plugin.WebViewNewParams).id;
}

/**
Expand Down
10 changes: 6 additions & 4 deletions plugin.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { prepare } from "https://deno.land/x/plugin_prepare@v0.3.1/mod.ts";

const DEV = Deno.env("DEV");
const IS_DEV = DEV !== undefined;
const MSHTML = Deno.env("MSHTML");
const IS_MSHTML = MSHTML !== undefined;

const pluginPath = DEV !== undefined
const pluginPath = IS_DEV
? DEV
: "https://github.com/eliassjogreen/deno_webview/releases/download/0.3.1";
: "https://github.com/eliassjogreen/deno_webview/releases/download/0.3.2";

const plugin = await prepare({
name: "deno_webview",
checkCache: DEV === undefined,
checkCache: IS_DEV,
urls: {
mac: `${pluginPath}/libdeno_webview.dylib`,
win: MSHTML === undefined ? `${pluginPath}/deno_webview.dll` : MSHTML,
win: IS_MSHTML ? MSHTML : `${pluginPath}/deno_webview.dll`,
linux: `${pluginPath}/libdeno_webview.so`,
},
});
Expand Down

0 comments on commit 52d68b0

Please sign in to comment.