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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@minstone/mcube

v1.1.4

Published

MCube Web Components

Readme

魔方平台前端类库

1 类库介绍

1.1 简介

  魔方平台前端类库集成了日志中心和附件中心的接口。日志中心提供了记录行为日志方法,附件中心提供了上传附件、二次确认、删除文件、压缩文件方法。

1.2 阅读对象

  本文档面向所有使用魔方平台的前端开发人员或对此感兴趣的其他用户。阅读该文档要求用户熟悉前端开发,并且对JavaScript 和TypeScript 有一定了解。

1.3 开发环境

  • Node
  • NPM
  • TypeScript

2 文档

  详细文档

3 开发示例

  本文以调用上传附件和记录行为日志为例,为开发者介绍如何使用集成附件中心和集成日志中心所提供的方法。

3.1 集成方式

  如果当前项目是 Vue 项目,使用以下命令即可集成类库:

$ npm install @minstone/mcube --save
$ npm install spark-md5 --save

  如果当前项目是使用后端模板引擎渲染(如freemarker等)的,或者是JSP页面,需要下载 mcube.min.js[下载] 和 spark-md5.min.js[下载] 文件,保存到你的项目工程中,然后在 HTML 中直接使用:

<script type="text/javascript" src="/path/to/mcube.min.js"/>
<script type="text/javascript" src="/path/to/spark-md5.min.js"/>

3.2 引用Mcube

  前端引用Mcube

// 在Vue页面,引入类库,同时需要引入spark-md5插件
import { mcube } from '@minstone/mcube';
import SparkMD5 from 'spark-md5';

window.SparkMD5 = SparkMD5;

3.3 上传附件

// 获取附件中心客户端
let attachment = mcube.requrie("attachment");
// 执行上传附件
let att = attachment.upload('test', token, file);

att.then(res => {
  // 下载文件
  downloadFile(res.id)
})

3.4 记录行为日志

// 获取日志中心客户端
let logging = mcube.requrie("logging");
// 记录行为日志
let log = logging.collectAction('mcube', 
{
    url: 'http: //127.0.0.1', 
    title: '测试标题', 
    appCode: 'mcube_dashboard', 
    module: '测试模块', 
    function: '新增', 
    actionSource: 'xxxxx'
});

log.then(res => {
  if (res) {
    console.log('记录成功')
  }
})