1.0.1 • Published 5 years ago

teambition-mobile-jssdk v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

teambition-mobile-jssdk

Teambition mobile JavaScript SDK.

NPM version Downloads

Installation

browser:

<script src="/pathTo/jssdk.js"></script>

API

window.TeambitionMobileSDK.call(funcName: string, jsonRequest: Object): Promise

JS SDK 的基础函数,在 Teambition 移动端的 WebView 中可以调用所有的 SDK 能力。

if (!window.TeambitionMobileSDK) {
  return
}

const sdk = window.TeambitionMobileSDK
sdk.call('getAuthCode', {
  client_id: YOUR_APP_ID,
  audience: ORGANIZATION_ID
})
.then((authResponse) => {
  console.log(authResponse)
  // authResponse
  // {
  //   "code": "AUTHORIZATION_CODE", // 免登授权码,5分钟有效,且只能使用一次
  //   "expires_in": 300
  // }
})
.catch((err) => {
  console.error(err)
  // error response
  // {
  //   "name": "NotFound", // 错误代码
  //   "message": "app not found" // 错误消息
  //   "data": SDK_RESPONSE_DETAIL // for debug...
  // }
})

License

teambition-mobile-jssdk is licensed under the MIT license. Copyright © 2019 Teambition.