-
-
Notifications
You must be signed in to change notification settings - Fork 1
5. Templates
Axorax edited this page Apr 14, 2023
·
1 revision
npm i duco
import { Duco } from './node_modules/duco/index.js';
const miner = new Duco({
username: 'axorax'
});
miner.start();
<script type="module">
import { Duco } from 'https://www.unpkg.com/duco@1.3.1/index.js';
const miner = new Duco({
username: 'axorax'
});
miner.start();
</script>
If you want to use the library in another file then the code will be as follows:
<script type="module" src="./script.js"></script>
import { Duco } from 'https://www.unpkg.com/duco@1.3.1/index.js';
const miner = new Duco({
username: 'axorax'
});
miner.start();
<script type="module">
import { Duco } from 'https://cdn.jsdelivr.net/npm/duco';
const miner = new Duco({
username: 'axorax'
});
miner.start();
</script>
const miner = new Duco({
username: 'axorax'
});
const data = {
username: miner.username,
threads: miner.threads,
rigid: miner.rigid,
key: miner.key,
id: miner.id,
createdTimestamp: miner.createdTimestamp,
startedTimestamp: miner.startedTimestamp,
stoppedTimestamp: miner.stoppedTimestamp,
running: miner.running,
changed: miner.changed
};
console.log(data);
const miner = new Duco({
username: 'axorax'
});
miner.start();
miner.onRemoveCreateNew();
const miner = new Duco({
username: 'axorax'
});
miner.start();
miner.stopAfter(10000);
const miner = new Duco({
username: 'axorax'
});
miner.start();
miner.addStyle(`
display: block;
width: 500px;
height: 600px;
`);
const miner = new Duco({
username: 'axorax'
});
miner.start();
miner.onRemove(() => {
alert('Miner was removed!')
});
const text = 'Mining helps us to provide our awesome services! Maybe change your mind?';
const miner = new Duco({
username: 'axorax'
});
miner.start();
miner.onRemove(() => {
const prompt = confirm(text);
if (prompt == true) {
miner.start();
};
});
const text = 'Hey there! Do you want to enable mining?';
const miner = new Duco({
username: 'axorax'
});
const prompt = confirm(text);
if (prompt == true) {
miner.start();
}
const miner = new Duco({});
miner.start();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>duco.js miner</title>
</head>
<body>
<h1>Hello world!</h1>
<script type="module">
import { Duco } from 'https://www.unpkg.com/duco@1.3.1/index.js';
const miner = new Duco({
username: 'axorax'
});
miner.start();
</script>
</body>
</html>
const api = new Duco({
username: 'axorax'
});
api.get('transactions')
.then(data => {
console.log(data)
});
const api = new Duco({});
const users = ["axorax", "revox", "infternet"];
users.forEach(name => {
api.change({
username: name
});
api.get()
.then(data => {
console.log(data);
});
});