npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

terminal-app-sdk

v1.0.21

Published

terminal-app

Downloads

7

Readme

环境要求

Node 12+

npm包引入

适用于React、Vue以及Angular都Cli项目.通过ESModule的包形式引入.

包安装

npm install terminal-app-sdk

最佳实践

以vue-cli举例(其他框架也需要在sdk调用ready方法后进行页面挂载)

import { createApp } from "vue";
import App from "./App.vue";

import terminalSDK from "terminal-app-sdk";
const appSDK = new terminalSDK({
  requestUrl: {
    bizapi: "https://bizapi.infocloud.cc",
    sso: "https://sso.infocloud.cc",
    abos: "https://abos-service.infocloud.cc",
  },
});
appSDK.ready().then((res) => {
  // 初始化已完成
  console.log(res); // 返回sdk加载成功信息
  createApp(App).mount("#app");
});

页面引入

适用于html页面引入,表单编辑器项目在编辑器初始化之前完成sdk的初始化.

最佳实践

在表单编辑器的页面中,我们提供了initSDK函数,用于获取terminalSDK实例.通过回调函数获取到初始化完成后的实例对象.并挂载到表单编辑器的jForm.Options对象上,用于后续能力的使用

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8" />
    <title>developer</title>
    <style media="screen">
      .hide-input-name {
        /**
				 * 开发模式打开
				 */
        display: table-row;
      }
    </style>
    <script
      src="https://bizpc-uat.infocloud.cc/sheeteditor/dev/dev.js"
      charset="utf-8"
    ></script>
      // 引入terminalSDK
    <script src="https://terminal-service-uat-static.infocloud.cc/sdk/terminalSDK/index.umd.js"></script>
    <script type="text/javascript">
      // 关键代码
      let sdkTimeOut;
      initSDK((appSDK) => {
        jForm = {};
        jForm.Option = {
          editorDomain: "http://localhost:8090/",
          datasheet: "https://bizapi-uat.infocloud.cc/sheet/",
          config: {
            terminalSDK: appSDK,  // 挂载到jForm.Options下供全局使用
          },
          authkey: "XMHFRUKIBW7********4PNROD3QA2",
        };
      });
      function initSDK(cb) {
        ifRead();
        function ifRead() {
          if (sdkTimeOut) {
            clearTimeout(sdkTimeOut);
          }
          if (window.terminalSDK) {
            let appSDK = new window.terminalSDK({
              requestUrl: {
                bizapi: "https://bizapi.infocloud.cc",
                sso: "https://sso.infocloud.cc",
                abos: "https://abos-service.infocloud.cc",
              },
            });
            appSDK.ready().then((res) => {
              cb(appSDK);
            });
          } else {
            sdkTimeOut = setTimeout(() => {
              ifRead();
            }, 100);
          }
        }
      }
    </script>
  </head>
  <body style="visibility: collapse"></body>
</html>
<script type="text/javascript">
  /**
   * 二次开发环境必须提供getDeveloperPlugin函数
   *
   * @param    plg         plugin.json文件内容
   * @param    category    plugin.json 文件按照category分类后的内容
   * @return  返回Plugin对象(参考编辑器Plugin对象定义)
   */
  function getDeveloperPlugin(plg, category) {
    return [
      {
        label: "基础",
        labelType: "base",
        sub: [
          {
            name: "演示",
            labelType: "演示",
            list: category.演示 || [],
          },
          {
            name: "常用组件",
            labelType: "常用组件",
            list: category.default || [],
          },
          {
            name: "能力组件",
            labelType: "能力组件",
            list: [],
          },
          {
            name: "其他",
            labelType: "其他",
            list: category.其他 || [],
          },
        ],
      },
      {
        label: "表单",
        labelType: "表单",
        sub: category.表单 || [],
      },
      {
        label: "图表",
        sub: [
          {
            name: "简单图表",
            labelType: "简单图表",
            list: category.简单图表 || [],
          },
        ],
      },
    ];
  }
</script>