Node.js synchronize painter