state-toggle

WebJar for state-toggle

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

state-toggle
Последняя версия

Последняя версия

1.0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

state-toggle
WebJar for state-toggle
Ссылка на сайт

Ссылка на сайт

https://www.webjars.org
Система контроля версий

Система контроля версий

https://github.com/wooorm/state-toggle

Скачать state-toggle

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/state-toggle/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>state-toggle</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/state-toggle/
implementation 'org.webjars.npm:state-toggle:1.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/state-toggle/
implementation ("org.webjars.npm:state-toggle:1.0.3")
'org.webjars.npm:state-toggle:jar:1.0.3'
<dependency org="org.webjars.npm" name="state-toggle" rev="1.0.3">
  <artifact name="state-toggle" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='state-toggle', version='1.0.3')
)
libraryDependencies += "org.webjars.npm" % "state-toggle" % "1.0.3"
[org.webjars.npm/state-toggle "1.0.3"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

state-toggle

Build Coverage Downloads Size

Enter/exit a state.

Install

npm:

npm install state-toggle

Use

var toggle = require('state-toggle')

var ctx = {on: false}
var enter = toggle('on', ctx.on, ctx)
var exit

// Entering:
exit = enter()
console.log(ctx.on) // => true

// Exiting:
exit()
console.log(ctx.on) // => false

API

toggle(key, initial[, ctx])

Create a toggle, which when entering toggles key on ctx (or this, if ctx is not given) to !initial, and when exiting, sets key on the context back to the value it had before entering.

Returns

Functionenter.

enter()

Enter the state.

Context

If no ctx was given to toggle, the context object (this) of enter() is used to toggle.

Returns

Functionexit.

exit()

Exit the state, reverting key to the value it had before entering.

License

MIT © Titus Wormer

Версии библиотеки

Версия
1.0.3
1.0.2
1.0.1
1.0.0