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

@icreate/ics-chromely-plugin-core

v0.0.22

Published

提供Ics Chromely Client核心本地操作插件js sdk,包含本地日志、主窗体控制、打开三方浏览器、打印机列表、硬件IP和Mac地址、本地配置获取和注册表读写等

Downloads

417

Readme

Usage

npm i @icreate/[email protected]

feature

0.0.20-beta.8 适配chrome浏览器
0.0.20-beta1 增加html转pdf和打印html
0.0.20 增加获取打印机列表扩展方法
0.0.19-beta.1 增加pdf打印设置
0.0.19 增加pdf打印
0.0.18-beta7 新增获取本机Ip和Mac地址列表方法`getIpMacAddress`
0.0.18-beta6 修复注册表调用方法对应路由
0.0.18-beta5 注册表帮助类调用修改为Get方式
0.0.18-beta4 修复获取和设置注册表路由地址
0.0.18-beta3 增加发送按键事件、切换输入语言、切换为中文输入法、切换为英文输入法、切换当前语言的具体输入法、获取当前语言输入法列表和KeyCode定义
0.0.18-beta2 增加显示屏幕键盘
0.0.18 修改导出对象为默认导出
0.0.17 修改Chromely为单例模式
0.0.16 WindowHelper增加关闭和重绘闪屏README描述
0.0.15 WindowHelper增加关闭和重绘闪屏
0.0.14 ConfigHelper增加获取调试信息
0.0.13 HardwareHelper增加设置本地日期
0.0.12 修改注册表调用方法提供注册键设置
0.0.11 HardwareHelper增加获取操作系统版本、关闭操作系统和重启操作系统
0.0.10 HardwareHelper增加获取操作系统描述GetOSDesc()

Features

  • LocalLogger:本地日志
  • BrowserHelper:浏览器帮助类
  • WindowHelper:主window帮助类
  • chromely:chromely对象
  • HardwareHelper:获取电脑Mac地址、Ip地址、主机名
  • PrinterHelper:打印机类
  • RegeditHelper:注册表类
  • ConfigHelper:本地配置类

Importing library

You can import the generated bundle to use the whole library generated by this starter:

import { LocalLogger, BrowserHelper, WindowHelper, Chromely, ConfigHelper, KeyCode } from '@icreate/ics-chromely-plugin-core'

LocalLogger

  
  /**
   * 日志级别
   */
  level: LogLevels
  
  /**
   * 输出调试日志
   */
  debug(logObject: any): Promise<String>

  /**
   * 输出普通日志
   */
  info(logObject: any): Promise<String>
  
  /**
   * 输出警告日志
   */
  warn(logObject: any): Promise<String>
  
  /**
   * 输出错误日志
   */
  error(logObject: any): Promise<String>
  
  /**
   * 输出致命错误日志
   */
  fatal(logObject: any): Promise<String>

BrowserHelper

 /**
 * 打开Google浏览器
 */
  OpenChrome(url:string):void

  /**
   * 打开IE浏览器
   */
  OpenIE(url:string):void

  /**
   * 打开FireFox浏览器
   */
  OpenFireFox(url:string):void
  
  /**
   * 打开默认浏览器
   */
  OpenDefault(url:string):void
  
  /**
   * @description: Html转Pdf
   * @param {PdfSettings} settings pdf设置
   * @return 返回流或者错误消息
   */
  public static HtmlToPdf(settings: PdfSettings): Promise<any>

  /**
   * @description: 打印html字符串
   * @param {PrintSettings} settings 打印设置
   * @return 返回 ok或错误消息
   */
  public static PrintHtml(settings: PrintSettings): Promise<any>

WindowHelper

  /**
   * 主窗体最小化
   */
  Minimize(): void

  /**
   * 主窗体最大化
   */
  Maximize(): void

  /**
   * 主窗体还原
   */
  Restore(): void

  /**
   * 主窗体关闭
   */
  Close(): void

  /**
   * 重启程序
   */
  Restart(): void

  /**
   * 主窗体状态
   */
  State(): Promise<String>

  /**
   * 关闭闪屏
   */
  CloseSplash(): void

  /**
   * 重绘闪屏
   */
  RedrawSplash(message: string): void
  
  /**
   * 显示屏幕键盘
   */
  ShowScreenKeyboard(): void 

  /**
   * 发送按键事件
   */
  SendKeyEvent(keycode: number): void

  /**
   * 切换输入语言
   */
  SwitchLanguage(cultureType: string): void

  /**
   * 切换为中文输入法
   */
  SwitchLanguageToChinese(): void
  
  /**
   * 切换为英文输入法
   */
  SwitchLanguageToEnglish(): void
  
  /**
   * 切换当前语言的具体输入法
   */
  ChangeInputMethod(name: string): Promise<any>
  
  /**
   * 获取当前语言输入法列表
   */
  GetInputMethodList(): Promise<any>

Chromely

  /**
   * 是否处于非浏览器环境
   */
  isChromely: boolean

  /**
   * 订阅C#事件
   */
  $on(eventName: string, callback: Function): void

  /**
   * 取消订阅C#事件
   */
  $off(eventName: string, callback: Function): void
  
  /**
   * 触发C#事件
   */
  $emit(eventName: string): void

HardwareHelper

   /**
    * 获取本机Mac地址 ["00:E0:4C:68:0B:D4"] 
    */
  getMacAddress(): Promise<array>

  /**
   * 获取本机Ip地址 ["192.168.2.8"] 
   */
  getIpAddress(): Promise<array> 
  
  /**
   * 获取本机Ip和Mac地址列表 [{"Ip":"192.168.2.8","Mac":"00:E0:4C:68:0B:D4"}] 
   */
  getIpMacAddress(): Promise<array>
  
  /**
   * 获取本机主机名
   */
  getHostName(): Promise<string>

  /**
   * 获取操作系统描述
   */
  GetOSDesc(): Promise<string>

  /**
   * 获取操作系统版本
   */
  GetOsVersion(): Promise<string>  
  
  /**
   * 重启操作系统
   */
  RestartOS(): void
  
  /**
   * 关闭操作系统
   */
  CloseOS(): void
  /**
   * 设置本地日期时间
   * @param date 日期字符串
   * 支持:
   *  yyyy-MM-dd HH:mm:ss
   *  yyyy.MM.dd HH:mm:ss
   *  yyyy/MM/dd HH:mm:ss
   * @returns
   */
  SetLocalTime(): Promise<string>  

PrinterHelper

/**
 * 获取本地打印机列表
 */
  getPrinterList(): Promise<array> 

/**
 * 获取本地打印机对象列表
 * Ex: [
        {
            "Name": "HP LaserJet Pro MFP M225-M226 PCL 6", //打印机名称
            "IsDefault": false, //是否默认打印机
            "IsDuplex": true  //是否支持双面打印
        }
        {
            "Name": "Microsoft Print to PDF",
            "IsDefault": true,
            "IsDuplex": false
        }
    ]
 */

  getPrinterListEx(): Promise<array> 

/**
 * 获取本地打印机列表
 */
  getPrinterDefault(): Promise<string>

/**
 * 判断指定打印机名称是否存在
 */
  isPrinterExists(printerName: string): Promise<bool> 

   /**
   * 打印pdf内容
   * @param bytes 二进制内容
   */
   printPdf(
    bytes: ArrayBuffer,
    settings: PrinterSettings | null = null
  ): Promise<any>

RegeditHelper


  /**
   * 获取指定的注册表键对应的值
   */
  getRegeditValue(key: string, name: string): Promise<string> 
  
  /**
   * 设置注册表键值
   */
  setRegeditValue(key: string, name: string, value: string): Promise<string> 

ConfigHelper


  /**
   * 获取指定的配置键对应的值 多级可以使用:key1:key2:key3...
   */
  Get(key: string): Promise<string>
  
  /**
   * 获取appsetting.json中的BaseUrl值
   */
  GetBaseUrl(): Promise<string>
  /
  /**
   * 获取调试信息
   */
  GetDebug(): Promise<string>