@chaos-kit/browser
v0.0.2
Published
> a kit box for browser
Downloads
3
Readme
@chaos-kit/browser
a kit box for browser
features
copyClipboard
import { copyClipboard } from '@chaos-kit/browser';
let flag = copyClipboard('test text');
if(flag){
console.log('copy clipboard successful')
}else{
console.log('copy clipboard failed')
}
Fullscreen
import { FullScreen } from '@chaos-kit/browser';
// create
let demo = document.getElementById('demo');
let fullscreen = new FullScreen(demo, ()=>{
console.log('dom fullscreen state changed')
});
// enable fullscreen
fullscreen.enable();
// exit fullscreen
fullscreen.exit();
// get state for fullscreen
fullscreen.getIsOnFull(); // => false
scrollTo
import { scrollTo } from '@chaos-kit/browser';
let demo = document.getElementById('demo', {
// scroll option
});
scrollTo(demo);
state watcher
import { StateWatcher } from '@chaos-kit/browser';
let handle = StateWatcher.visibilityWatcher()
handle.onChange = function onVisibilityHandle(pageShow:tybooleanpe) {
console.log('pageShow')
}
// cancel watcher
handle();
visibilityWatcher
: page show state watchernetWorkWatcher
: web sit network state watcherlongTaskWatcher
: long task state watcher