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

@alicloud/xconsole-context

v2.6.2

Published

通用的 Console 方法库, 用于和 阿里云 Console 环境打交道包括

Downloads

744

Readme

XConsole Util

通用的 Console 方法库, 用于和 阿里云 Console 环境打交道包括

  • OneConsole
  • RegionBar
  • 资源组
  • Biz Widget

用法

基础用法

import ConsoleContext from '@alicloud/console-context';

consoleContext.consoleConfig

consoleContext.region

React Context 用法

import { withConsoleConfig, ConsoleContext } from '@alicloud/console-context';

const App = withConsoleConfig(
  (props) => {
    const { region, consoleConfig } = useContext(ConsoleContext);
    return (<>
      <div>{region.getCurrentRegionId()}</div>;
      <div>{consoleConfig.getChannel()}</div>;
    </>)
  }
);

OneConsole

consoleContext.consoleConfig 中封装了和控制台配置打交道的部分,包括了当前用户,当前渠道,当前灰度等等,具体 API 参考如下:

consoleContext.isCertified()

获取用户实名认证状态

consoleContext.getChannel()

获取用户当前渠道

consoleContext.getfEnv()

获取用户当前

consoleContext.getLang()

获取当前用户语言

consoleContext.getLocale()

获取当前用户语言

consoleContext.getAccoutLoginLink()

获取当前登录地址

consoleContext.getSecToken()

获取 secToken 用户防止 csrf 攻击

consoleContext.getAccountName()

获取当前用户名

consoleContext.getMainAccountPK()

获取当前用户主账号 PK, 主要用于 Ram User 的主账号获取

consoleContext.getCurrentPK()

获取当前用户账号 PK。

consoleContext.getAccountType()

获取当前账号的账号类型,主账号,子账号,STS。

consoleContext.getOpenStatus(code: string)

获取某个产品的开通状态

consoleContext.getGrayStatus(grayId: string)

获取某个产品的开通状态

consoleContext.getChannelFeature(featureId: string)

获取某个产品的开通状态

consoleContext.getChannelLink(linkId: string)

获取某个产品的开通状态

consoleContext.getLabel()

获取某个用户当前账号上的标签

consoleContext.getUserPreference()

获取当前用户设置偏好

consoleContext.getRuleConfig()

获取当前规则中心的信息

consoleContext.getRegions()

获取当前 location 中配置的信息

consoleContext.getStaticAPI(field: string)

获取 Viper 中配置的 staticAPI 配置的信息

Region

onRegionChange

监听 RegionBar 上 Region 变更的事件

toggleRegion()

触发 RegionBar 的显示移仓

setRegionId

设置 RegionBar 的 RegionId

setRegions

设置 RegionBar 上的 Region 列表

setRegionResourceCount

设置 RegionBar 上的 每个 Region 中的数字

getCurrentRegionId

获取当前的 RegionId

React Utils

ChannelLink

<ChannelLink id="linkId" />

Gray

<Gray id="grayId" >
  <div> hello world </div>
</Gray>

ChannelFeature

<ChannelFeature id="featureId" >
  <div> hello world </div>
</ChannelFeature>