Skip to content

Commit dcb4976

Browse files
committed
Rename the preload to injector
1 parent 919dd99 commit dcb4976

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/api/injector/dummy.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function dummy() {
2+
console.log('API of injector');
3+
}
File renamed without changes.

src/api/preload/dummy.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/main/workspace.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function createWorkspace() {
3131
createWorkspaceDirectories(id);
3232
const file = createProjectFiles(projectPath);
3333
const openFiles = [
34-
getFileInfo(projectPath, file.preloadJsPath),
34+
getFileInfo(projectPath, file.injectorJsPath),
3535
getFileInfo(projectPath, file.mainJsPath),
3636
];
3737

@@ -41,7 +41,7 @@ export function createWorkspace() {
4141
projectPath: projectPath,
4242
openFiles: openFiles,
4343
mainPath: file.mainJsPath,
44-
preloadPath: file.preloadJsPath,
44+
injectorPath: file.injectorJsPath,
4545
});
4646

4747
return id;
@@ -83,12 +83,12 @@ function createProjectFiles(projectPath) {
8383
fs.writeFileSync(mainJsPath, mainjs);
8484
}
8585

86-
const preloadJsPath = path.join(projectPath, 'preload.js');
87-
if (!fs.existsSync(preloadJsPath)) {
88-
fs.writeFileSync(preloadJsPath, preloadjs);
86+
const injectorJsPath = path.join(projectPath, 'injector.js');
87+
if (!fs.existsSync(injectorJsPath)) {
88+
fs.writeFileSync(injectorJsPath, injectorjs);
8989
}
9090

91-
return { preloadJsPath, mainJsPath };
91+
return { injectorJsPath, mainJsPath };
9292
}
9393

9494
function createDirectory(path) {
@@ -120,7 +120,7 @@ const { output } = window.codingbrowser;
120120
121121
`;
122122

123-
const preloadjs = `/**
123+
const injectorjs = `/**
124124
*
125125
* A script that will be injected into every frame
126126
*

src/renderer/webview-preload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ipcRenderer } from 'electron';
22
import fs from 'fs';
33
import { Hook } from 'console-feed';
44
import { IpcEvents } from '../ipcEvents';
5-
import * as preloadAPI from '../api/preload';
5+
import * as injectorAPI from '../api/injector';
66

77
window._codingbrowser_console = { ...window.console };
88

@@ -35,14 +35,14 @@ async function getCurrentWorkspace() {
3535
getCurrentWorkspace().then((workspace) => {
3636
if (!workspace || !workspace.enabled) return;
3737

38-
const script = fs.readFileSync(workspace.preloadPath, 'utf8');
38+
const script = fs.readFileSync(workspace.injectorPath, 'utf8');
3939
if (script) {
4040
var F = new Function(
4141
'console',
4242
'codingbrowser',
4343
`${script};${suffixScript}`
4444
);
45-
F(window._codingbrowser_console, preloadAPI);
45+
F(window._codingbrowser_console, injectorAPI);
4646
}
4747
});
4848

0 commit comments

Comments
 (0)