
Product
Introducing Custom Pull Request Alert Comment Headers
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
yg-portaljs-sdk
Advanced tools
npm install yg-portaljs-sdk
es6
逐一指定要加载的方法
import { changeTheme, refresh } from './yg-portaljs-sdk';
整体加载的写法如下。
import * as ypsdk from 'yg-portaljs-sdk';
ypsdk.changeTheme('techblue')
script tag
window.ypsdk.changeTheme('techblue');
amd
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js"></script>
<script>
window.requirejs(['yg-portaljs-sdk'], function(ypsdk) {
console.log(ypsdk.add(1, 2));
});
</script>
函数 | 说明 | 参数 |
---|---|---|
changeTheme | 改变主题 | (string: 'techblue','sunorange','dark') |
refresh | 刷新 | 无 |
goHome | 回到主页 | 无 |
logOut | 退出 | 无 |
onAddTab | 监听tab | options |
addTab | 添加tab | 无 |
onHighLightMenu | 监听菜单高亮 | options |
highLightMenu | 菜单高亮 | options |
onTitleTab | 监听tabTitle变化 | options |
titleTab | 设置tabTitle | 无 |
onRouterChange | 监听RouterChange | options |
routerChange | 设置router change | options |
onRemoveTab | 监听onRemoveTab | options |
removeTab | 设置router change | options |
onHideTabs | 监听第一层tab隐藏 | options |
hideTabs | 触发hide Tabs | 无 |
clearTab | 清除所有 Tabs | 无 |
let funcConfig = {
complete: function(...options) {
console.log(options);
},
success: function(...options) {
console.log(options);
},
cancel: function(...options) {
console.log(options);
},
fail: function(...options) {
console.log(options);
},
};
路由、tab 统一 参数
const newTab = {
title: `名称啊-${this.index}`,
content: `名称啊-${this.index}`,
key: `tab-${this.index}`,
urlpath: `https://www.baidu.com?${this.index}`,
} ;
触发
ypsdk.addTab(newTab);
监听
ypsdk.onAddTab({success: this.onAddTab});
菜单高亮 门户用
ypsdk.onHighLightMenu({success: this.onHighLightMenu});
子应用使用
const menuOptions = {
menuSelectedKeys: ['100000000000000068'],
menuOpenKeys: ['100000000000000047', '100000000000000004', '100000000000000068'],
};
ypsdk.highLightMenu(menuOptions);
路由变化
ypsdk.onRouterChange({success:function(){
console.log('this is router subscribe success.',arguments);
}});
ypsdk.routerChange(newTab);
https://cdn.jsdelivr.net/npm/yg-portaljs-sdk@1.0.14/lib/ypsdk.min.js
window.setTimeout(() => {
ypsdk.onRouterChange({
isIframe: true,
success: function() {
console.log('this is componentDidMount router subscribe success.', arguments);
}});
}, 300);
highLightMenu = () => {
const menuOptions = {
menuSelectedKeys: ['100000000000000068'],
menuOpenKeys: ['100000000000000047', '100000000000000004', '100000000000000068'],
};
ypsdk.highLightMenu(menuOptions);
}
jsdelivr
地址格式为:
https://cdn.jsdelivr.net/npm/(your packagename)@(version)/(file)
https://cdn.jsdelivr.net/npm/yg-portaljs-sdk@1.0.12/lib/ypsdk.min.js
unpkg.com
地址格式为: example
https://www.unpkg.com/yg-portaljs-sdk@1.0.12/lib/ypsdk.min.js
https://www.unpkg.com/:package@:version/:file
通过webpack 打包
new CopyWebpackPlugin([
{
from: './node_modules/yg-portaljs-sdk/lib',
to: 'lib',
},
]),
<script type="test/javascript" src="/lib/ypsdk.min.js"></script>
FAQs
yg portal jssdk umd
We found that yg-portaljs-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.