-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreload.js
More file actions
63 lines (51 loc) · 1.73 KB
/
preload.js
File metadata and controls
63 lines (51 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// preload.js
// All the Node.js APIs are available in the preload process.
// It has the same sandbox as a Chrome extension.
// window.addEventListener('DOMContentLoaded', () => {
// })
const { contextBridge } = require('electron')
const {Memory, addToMemory} = require('./fnc/Memory.js')
const {
start,
loadAdd,
deposit,
examinate,
continueSw,
stop,
singStep,
singInst,
} = require('./pdpFunc.js')
const { getRegistersValues } = require('./fnc/Register.js')
const { validateInstruction, Instruction} = require('./fnc/instructions/Instruction.js')
const ProgramConter = require('./fnc/ProgramCounter.js')
const { findWord, assemble } = require('./fnc/Word.js')
const PDP = require('./fnc/PDP.js')
const { IF, OF, INPR } = require('./fnc/Register.js')
contextBridge.exposeInMainWorld('api', {
addToMemory: (assem) => addToMemory(assem),
Memory: Memory,
ProgramConter,
getProgramCounterMem: () => ProgramConter.get(),
findWord: (start) => findWord(start),
assemble: (inp) => assemble(inp),
IFGetMem: () => IF.getMem(),
IFSetMem: (inp) => IF.setMem(inp),
OFGetMem: () => OF.getMem(),
OFSetMem: (inp) => OF.setMem(inp),
setInputRegister: (inp) => INPR.setMem(inp),
Instruction,
createCodeLine: (inst) => Instruction.createCodeLine(inst),
power: () => PDP.PDP.power(),
start: (inp) => start(inp),
loadAdd: (value) => loadAdd(value),
deposit: (value) => deposit(value),
examinate: () => examinate(),
continueSw: () => continueSw(),
stop: () => stop(),
singStep: () => singStep(),
singInst: () => singInst(),
getRegistersValues: () => getRegistersValues(),
validateInstruction: (inst) => validateInstruction(inst),
// Instruction: Instruction,
// we can also expose variables, not just functions
})