Add phase protection for event emission. closes troopjs/troopjs-core#100