1.1.1 • Published 2 years ago

garbagebox v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Garbagebox

Type safe Javascript and uhh, Multi-threading

How do I do it

You just do it

npm i garbagebox

Supported types

box.string
box.number
box.boolean
box.object
box.function
box.symbol
box.null
box.undefined

GarbagePacks

const myPack = box.pack(() => {
    console.log('Hello world!');
});

myPack.data(); // Returns () => { console.log('Hello world!'); }
myPack.type(); // Returns 'GarbagePack'
myPack.run(); // Returns {}

const myPack2 = box.pack(() => {
    module.exports = 'Hello world!';
});

myPack.run(); // Returns 'Hello world!'

Multi-Threading

const myPack = box.pack(() => {
    console.log('Running in worker!');
    send('Hello world!');
    receive((message) => {
        console.log('From parent thread: ' + message);
    });
});

const spawner = box.spawn(myPack);
spawner.onMessage((data) => { console.log('From thread: ' + data); });

spawner.send('Hello World!');

Type safety

const x = box.new(box.number, 2);
const y = box.new(box.number, 3);

x.get() + y.get() // Returns 5

x.set(5)
x.get() + y.get() // Returns 8
1.1.1

2 years ago

1.1.0

2 years ago

1.0.7-0

2 years ago

1.0.7

2 years ago

1.0.6-0

2 years ago

1.0.5-0

2 years ago

1.0.4-0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2-1

2 years ago

1.0.2-0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0-0

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago