1.2.5 • Published 5 years ago

srm-utils v1.2.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

srm-utils

使用

Store

import $$ from 'srm-utils'
$$.setStore('TOKEN', 123)
$$.getStore('TOKEN')
$$.removeStore('TOKEN')
$$.clearStore()
$$.store(false).setStore() // 存储到 sessionStorage

Event

API

  • on 注册事件监听
  • off 移除事件监听
  • once 注册一次事件监听,只能触发一次 emit 触发后即自动从监听中移除
  • emit 触发事件

示例

import $$ from 'srm-utils'
$$.on("testEvent", function(event) {
  console.log("测试事件添加,传入参数为" + event);
});
$$.emit("testEvent", "事件触发成功");
$$.off("testEvent");
$$.$once("testOnce", function(event) {
  console.log("事件仅仅触发一次,传入参数为" + event);
});
1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago