Skip to content

Commit

Permalink
0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Oct 3, 2024
1 parent 210dc6c commit 41d2df9
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/html.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// const requireScript = require('node:module').createRequire(__filename);
// const { Application } = requireScript('../index.js');
const { Application } = require('../dist/index.js');
const { Application } = require('../index.js');

const app = new Application();

Expand Down
2 changes: 1 addition & 1 deletion examples/url.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Application, Theme } from '../dist/index.js';
import { Application, Theme } from '../index.js';

const app = new Application();
const window = app.createBrowserWindow({
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './binding';
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { Application, BrowserWindow, ControlFlow, FullscreenType, ProgressBarState, Theme, getWebviewVersion } = require('./binding')

module.exports = {
Application,
BrowserWindow,
ControlFlow,
FullscreenType,
ProgressBarState,
Theme,
getWebviewVersion
}
1 change: 0 additions & 1 deletion lib/index.ts

This file was deleted.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"webviewjs": "./cli/index.mjs"
},
"description": "Robust cross-platform webview library for Node.js written in Rust. It also works with deno and bun.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"main": "./index.js",
"types": "./index.d.ts",
"repository": "[email protected]:twlite/webview.git",
"license": "MIT",
"type": "commonjs",
Expand All @@ -20,7 +20,8 @@
],
"files": [
"cli",
"dist",
"index.d.ts",
"index.js",
"binding.d.ts",
"binding.js"
],
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ pub mod browser_window;

#[napi(object)]
pub struct HeaderData {
/// The key of the header.
pub key: String,
/// The value of the header.
pub value: Option<String>,
}

Expand Down Expand Up @@ -109,6 +111,7 @@ impl Application {
self.ipc_handler = handler;
}

/// Handles the IPC message.
fn handle_ipc_message(&self, req: Request<String>, id: &u32) {
let func = &self.ipc_handler.as_ref();

Expand Down
8 changes: 3 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ESNext",
"strict": true,
"moduleResolution": "node",
"module": "CommonJS",
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"outDir": "dist",
"declaration": true
"allowSyntheticDefaultImports": true
},
"include": ["./lib/**/*.ts"],
"include": ["."],
"exclude": ["node_modules", "bench", "__test__"]
}

0 comments on commit 41d2df9

Please sign in to comment.