refactor: move emitPrimApp