refactor ecma script wrappers for use with shared libs