交易信号、职场吃瓜、产品上新、游戏限免…
有消息就…有力量!
js
import {script } from '@digshare/script';export defaultscript (asyncstate => {constresponse = awaitfetch ('https://registry.npmjs.org/typescript');const {'dist-tags': {latest },} = awaitresponse .json ();if (state ===undefined ) {// 初始化 state 为当前版本。return {state : {latest },};}if (state .latest ===latest ) {// 当前版本没有更新,不发送消息。return;}return {message : `TypeScript 发布了新版本 ${latest }。`,state : {latest },};});