Request re-execution during processing Even when you come back and forth, you only re-execute once.
yarn add soshoku
npm i -S soshoku
Or access to releases page. Then, download the latest version.
import soshoku from 'soshoku';
const soshoku = require('soshoku');
or
<script src="/path/tp/soshoku.js"></script>
func
:Promise
Register function.
Execute function.
import Soshoku from 'soshoku';
const doSomethingAsync = () => {
return new Promise(resolve => {
setTimeout(() => {
console.log('called!');
resolve();
}, 5000)
});
}
new soshoku = new Soshoku(doSomethingAsync);
soshoku.exec();
setTimeout(soshoku.exec, 1000);
setTimeout(soshoku.exec, 2000);
// The result comes out as 'called!' After 5s.
// And after 5s we also get 'called!'.
// But after 5s there is nothing.
The MIT License (MIT)
Copyright (c) 2017 nju33 nju33.ki@gmail.com