Socket
Book a DemoInstallSign in
Socket

mocking-frog

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocking-frog

``` import { MockingFrog } from 'mocking-frog';

latest
npmnpm
Version
0.2.7
Version published
Maintainers
1
Created
Source

Usage:

import { MockingFrog } from 'mocking-frog';

const STATE_MAP = {
  case0: {

    // range
    num1: {
      value: 3,
      limit: {
        min: 0,
        max: 10,
        step: 0.1,
      },
      onChange: (state) => { // optional
        console.log(state.value);
        console.log(state.id); // 'num1'
      },
      // ext info(optional)
      id: 'num1',
      desc: 'fooooo',
    },

    // dropdown
    select: {
      value: 'b',
      limit: ['a', 'b'],
      onChange: () => {}, // optional
    },

    // input
    username: {
      value: 'immediatelyChange',
      immediatelyChange: true, // whether or not emit its onChange by 'input event'
      onChange: () => {}, // optional
    },

    // checkbox
    male: {
      value: false,
      onChange: () => {}, // optional
    },

    // button
    log: {
      value: () => { console.log('button on click')},
    },

    // folder
    test_folder: {
      value: { // widget map
        log: {
          value: () => { console.log('button on click')},
        },
      },
      active: false, // fold or not
      onChange: () => {}, // active onChange, optional
    },
  },
  case1: {
    //...
  }
};

let frog;
const CURRENT_STATE = 'case0';
const OPTIONS = {
  scale: 2, // optional
  wrapStyle: { // optional
    background: '#fff',
  },
  contentStyle: {}, // optional
  stateDropdownOnChange: () => {}, // optional
  onChange: (state) => { // optional
    console.log('global onChange');
    frog.save();
  },
}
frog = new MockingFrog(STATE_MAP, CURRENT_STATE, OPTIONS);

FAQs

Package last updated on 29 Nov 2017

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