Skip to main content

SDK Import Method

ZOfficeSDK currently provides support for non-modular as well as CommonJS and ES6 modular packages. The following are the packages corresponding to different modular specifications:

File NameModular SpecificationDescription
sdk.jsNon-modularDirect browser reference
sdk.esm.jsES6ES6 modular specification
sdk.cjsCommonJSCommonJS specification

Non-modular

<script src="sdk.js"></script>

Note: ZOfficeSDK does not include Promise Polyfill, so when you need to be compatible with older browsers (such as IE11), remember to introduce Promise Polyfill before introducing js-sdk

<!-- Reference babel -->
<script src="https://cdn.bootcss.com/babel-core/5.8.35/browser.min.js"></script>
<script src="https://cdn.bootcss.com/babel-core/5.8.35/browser-polyfill.min.js"></script>

<!-- Reference js-sdk -->
<script src="sdk address"></script>

<!-- Note: Add text/babel, otherwise it cannot be compiled -->
<script type="text/babel">
// Specific code
</script>

CommonJS Specification

let { ZOfficeSDK } = require('./sdk.cjs.js');

ES6 Modular Specification

import { ZOfficeSDK } from './sdk.esm.js';