JS: refactor constructor.
Export Document type.