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

ff-global

v4.1.57

Published

Fieldflint 全局属性

Downloads

387

Readme

Field Flint 系统全局变量

安装

npm install ff-global -S

引入方法

主进程

import "ff-global/main"

渲染进程

import 'ff-global/renderer'

预注入进程

import 'ff-global/preload'

工具(如果只是用到一部分工具)

import util from 'ff-global/util'

注意:上面的使用方法必须在入口顶端引入,以保证全局使用

使用方法

当上面正确引入后,系统会一个全局变量,主进程为global.ff,渲染进程为window.ff,在使用过程中可以直接使用ff 如判断对象为空对象的方法:ff.util.isEmptyObject({})

主进程


type ValueOf<T> = T[keyof T]

declare global {
	namespace ff {
		type MezzFileType = ValueOf<typeof MezzFileType>
		type MqttStatus = ValueOf<typeof MqttStatus>
		type LiveActionType = ValueOf<typeof LiveActionType>
		//gc全局
		namespace gc {
			type KeyboardShortcut = Gc.KeyboardShortcut
			type Client = Gc.Client
			type Subscribes = Gc.Subscribes
		}
	}
	var ff: {
		MqttStatus: typeof MqttStatus
		LiveActionType: typeof LiveActionType
		env: typeof env
		error: typeof error
		util: Util
		gc: ff.gc.Client
		Ajax: typeof Ajax
		//用户信息 store
		userInfo: User.UserInfo | null
		//cm列表
		cmList: User.CMItem[]
		browsers: { [id: string]: BrowserView } //打开的浏览器集合

		currentBrowserTab?: WebContents //当 前显示的浏览器tab页
		//当前浏览的account
		current_account: null | f2.ServerAccount
		//显示中的窗口
		show_popup: {
			[key: string]: boolean
		}
		//当前的tab页,位置
		$tabId: number
	}

	namespace NodeJS {
		interface Global {
			mainWindow: BrowserWindow
		}
	}
}

渲染进程


declare global {
	namespace Axios {
		type Canceler = C
		type RequestConfig = AxiosRequestConfig
	}

	namespace ff {
		type MezzFileType = ValueOf<typeof MezzFileType>
		type MqttStatus = ValueOf<typeof MqttStatus>
		type LiveActionType = ValueOf<typeof LiveActionType>

		//mqtt全局
		namespace mqtt {
			interface Subs {
				[topic: string]: (...data: any) => void
			}
		}

		//gc全局
		namespace gc {
			type KeyboardShortcut = Gc.KeyboardShortcut
			type Client = Gc.Client
			type IpcTopic = Gc.IpcTopic
			type Subscribes = Gc.Subscribes
		}

		namespace country {
			type CountryBase = CB
			type Country = Co
		}
		namespace linkedin {
			type AccountStatus = LinkedinAccount
			type LiStatData = GetLiStatData
		}
	}
}

declare global {
	var ff: Readonly<{
		env: typeof env
		MezzFileType: typeof MezzFileType //常量,mezz文件类型
		MqttStatus: typeof MqttStatus
		LiveActionType: typeof LiveActionType
		Ajax: typeof Ajax
		util: Util
		error: typeof error
		gc: typeof gc
		mqtt: typeof mqtt
		axios: AxiosStatic
		nameSplit: NameSplit
		dateTime: typeof DateTime
		contactInfo: typeof ContactInfo
		linkedin: Linkedin
		country: CountryClass
		analyzeText: {
			company: AnalyzeText
			contact: AnalyzeText
		}
		crawler: {
			util: CrawlerUtil
			db: CrawlerDb
		}
	}>
}