I found a method of document centerOnLayer and it works perfectly fine, but only when you're on the page that contains it. Is there a way to view the page first and then center on layer?
Yep! You can set the selected document page.
let sketch = require('sketch') let doc = sketch.getSelectedDocument() let pageToBeSelected = doc.pages[0] doc.selectedPage = pageToBeSelected