New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@byzanteam/carbonium-timer

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byzanteam/carbonium-timer

Timer for Carbonium

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Carbonium-Timer

Timer support for Carbonium.

Installation

$ npm install @byzanteam/carbonium-timer

Usage

Create Timer

import {createTimer} from '@byzanteam/carbonium-timer'

const timer = createTimer()

// Create timer with given defaults.
const timer = createTimer({delay: 0, duration: 1e3, easingFunction: 'easeInOut'})

Subscribe

timer.subscribe() 向 timer 中添加任务,返回退订函数。调用退订函数会从任务队列中移除相关的所有任务。该函数一共有三种调用形式,如下所示。

interface StateType {
  width: number,
  height: number,
}

const handler = (progress: number, startState: StateType, endState: StateType) => {
  console.log(progress, startState, endState)
}

// 处理函数和配置分离的但任务。
timer.subscribe<StateType>(handler, {
  delay: 250,
  startState: {width: 100, height: 100},
  endState: {width: 200, height: 200},
})

// 单个任务配置对象。
timer.subscribe<StateType>({
  handler,
  duration: 2e3,
  startState: {width: 100, height: 100},
  endState: {width: 200, height: 200},
})

// 多个任务配置对象数组。
const unsubscribe = timer.subscribe<StateType>([
  {
    handler,
  },
  {
    handler,
  }
])

// 调用 unsubscribe 函数会移除第三次订阅的所有任务。
unsubscribe()

Keywords

FAQs

Package last updated on 17 May 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc