Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bobflux-monitor

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bobflux-monitor - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

30

components/monitorPanel.ts

@@ -40,2 +40,3 @@ import * as b from 'bobril';

stateStamps: IStateStamp[];
playToggled: (value: boolean) => void;
}

@@ -48,2 +49,3 @@

interval: number;
isPlaying: boolean;
}

@@ -60,2 +62,3 @@

ctx.interval = 500;
ctx.isPlaying = false;
},

@@ -127,3 +130,3 @@ render(ctx: ICtx, me: b.IBobrilNode) {

title: 'PLAY',
isDisabled: !ctx.data.stateStamps.length,
isDisabled: !ctx.data.stateStamps.length || ctx.isPlaying,
onClick: () => { play(ctx, cursor); }

@@ -164,15 +167,22 @@ }),

function play<TState extends f.IState>(ctx: ICtx, cursor: f.ICursor<TState>, isStart = true) {
const state = f.getState(cursor);
let currentIdx = ctx.data.stateStamps.map(stamp => stamp.state).indexOf(state);
if (currentIdx === ctx.data.stateStamps.length - 1 && isStart) {
currentIdx = -1;
function play<TState extends f.IState>(ctx: ICtx, cursor: f.ICursor<TState>, startIndex = -1) {
if (startIndex === -1) {
ctx.isPlaying = true;
ctx.data.playToggled(true);
const state = f.getState(cursor);
startIndex = ctx.data.stateStamps.map(stamp => stamp.state).indexOf(state);
if (startIndex === ctx.data.stateStamps.length - 1) {
startIndex = -1;
}
}
if (currentIdx < ctx.data.stateStamps.length - 1) {
f.setState(cursor, ctx.data.stateStamps[currentIdx + 1].state);
if (startIndex < ctx.data.stateStamps.length - 1) {
const newIndex = startIndex + 1;
f.setState(cursor, ctx.data.stateStamps[newIndex].state);
b.invalidate();
setTimeout(() => play(ctx, cursor, false), ctx.interval);
setTimeout(() => play(ctx, cursor, newIndex), ctx.interval);
} else {
ctx.isPlaying = false;
ctx.data.playToggled(false);
}
}

@@ -5,9 +5,2 @@ import * as b from 'bobril';

function createDefaultData(): IMonitorPanelData {
return {
isOpen: false,
stateStamps: []
};
}
function createStateStamp<TState extends f.IState>(state: TState) {

@@ -22,9 +15,18 @@ return {

// TODO: update fun-model to recognize calling action from stack
// TODO: update fun-model to recognize the calling action from stack
export function init<TState extends f.IState>(cursor: f.ICursor<TState> = { key: '' }): (m, p) => void {
const createMonitor = monitorGenericFactory(cursor);
const data = createDefaultData();
let routeUrl = '';
let isPlaying = false;
const data: IMonitorPanelData = {
isOpen: false,
stateStamps: [],
playToggled: (newIsPlaying) => isPlaying = newIsPlaying
};
const callback = (m, p) => {
if (isPlaying)
return;
if (m && m.indexOf('has been initialized') >= 0) {

@@ -31,0 +33,0 @@ data.stateStamps = [createStateStamp(f.getState(cursor))];

{
"name": "bobflux-monitor",
"version": "2.0.0",
"version": "2.0.1",
"description": "Component for time travelling in bobflux/fun-model application state history.",

@@ -5,0 +5,0 @@ "typescript": {

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