How to use the overmind.createOvermind function in overmind

To help you get started, we’ve selected a few overmind examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nscozzaro / physics-is-beautiful / courses / static / courses / js / containers / StudioViews / EditorsViews / containers / LessonWorkSpace / Codesandbox / Editor / init.jsx View on Github external
export const initialize = (component, callback1) => {
  /*
    Configure Cerebral and Overmind
  */
  const overmind = createOvermind(config, {
    // devtools:
    // (window.opener && window.opener !== window) || !window.chrome
    //   ? false
    //   : 'localhost:3031',
    devtools: false,
    name:
      'PIB material editor - ' +
      (navigator.userAgent.indexOf('Chrome/76') > 0 ? 'Chrome' : 'Canary'),
    logProxies: true
  })

  getState = path =>
    path
      ? path.split('.').reduce((aggr, key) => aggr[key], overmind.state)
      : overmind.state
  getSignal = path =>
github codesandbox / codesandbox-client / packages / app / src / app / index.js View on Github external
const debug = _debug('cs:app');

window.setImmediate = (func, delay) => setTimeout(func, delay);

window.addEventListener('unhandledrejection', e => {
  if (e && e.reason && e.reason.name === 'Canceled') {
    // This is an error from vscode that vscode uses to cancel some actions
    // We don't want to show this to the user
    e.preventDefault();
  }
});

window.__isTouch = !matchMedia('(pointer:fine)').matches;

const overmind = createOvermind(config, {
  devtools:
    (window.opener && window.opener !== window) || !window.chrome
      ? false
      : 'localhost:3031',
  name:
    'CodeSandbox - ' +
    (navigator.userAgent.indexOf('Chrome/76') > 0 ? 'Chrome' : 'Canary'),
  logProxies: true,
});

if (process.env.NODE_ENV === 'production') {
  const ignoredOvermindActions = [
    'onInitialize',
    'server.onCodeSandboxAPIMessage',
    'track',
    'editor.previewActionReceived',
github zeit / next.js / examples / with-overmind / pages / _app.js View on Github external
constructor(props) {
    super(props)

    const mutations = props.pageProps.mutations || []

    if (typeof window !== 'undefined') {
      // On the client we just instantiate the Overmind instance and run
      // the "changePage" action
      this.overmind = createOvermind(config)
      this.overmind.actions.changePage(mutations)
    } else {
      // On the server we rehydrate the mutations to an SSR instance of Overmind,
      // as we do not want to run any additional logic here
      this.overmind = createOvermindSSR(config)
      rehydrate(this.overmind.state, mutations)
    }
  }
  // CLIENT: After initial route, on page change
github SaraVieira / svg-to-jsx-electron / src / index.js View on Github external
import React from "react"
import { render } from "react-dom"
import App from "./components/App"
import { config } from "./overmind"
import { createOvermind } from "overmind"
import { Provider } from "overmind-react"

const overmind = createOvermind(config)

// Since we are using HtmlWebpackPlugin WITHOUT a template, we should create our own root node in the body element before rendering into it
const root = document.createElement("div")

root.id = "root"
document.body.appendChild(root)

render(
  
    
  ,
  document.getElementById("root")
)
github cerebral / overmind / packages / overmind-website / src / index.tsx View on Github external
import { injectGlobal } from 'emotion'
import { createOvermind } from 'overmind'
import { Provider } from 'overmind-react'
import { createElement } from 'react'
import { render } from 'react-dom'
import { setConfig } from 'react-hot-loader'

import App from './components/App'
import * as iconFont from './icomoon.woff2'
import { config } from './overmind'

const overmind = createOvermind(
  config,
  process.env.NODE_ENV === 'production'
    ? {
        devtools: false,
      }
    : {
        devtools: true,
      }
)

setConfig({
  ignoreSFC: true, // RHL will be __completely__ disabled for SFC
  pureRender: true, // RHL will not change render method
})

injectGlobal`
github cerebral / overmind / packages / node_modules / overmind-devtools-client / src / index.tsx View on Github external
opacity: 1;
  }
  
  .Resizer.disabled {
    cursor: not-allowed;
  }
  .Resizer.disabled:hover {
    border-color: transparent;
  }
`

window.onerror = (_, _2, _3, _4, error) => {
  overmind.actions.setError(error.message)
}

const overmind = createOvermind(config, {
  devtools: false,
})

const container = document.createElement('div')
container.id = 'app'
document.body.appendChild(container)
render(
  
    
  ,
  container
)
github frontity / frontity / packages / core / src / stores / server.ts View on Github external
export default ({
  namespaces
}: {
  namespaces: { [key: string]: Namespace };
}) => {
  const config = getConfig({ namespaces, settings });
  const stores = createOvermind(config, {
    devtools: false
  }) as any;
  const mutationTree = stores.proxyStateTree.getMutationTree();
  stores.state = mutationTree.state;
  stores.hydrate = () => {
    return mutationTree.flush().mutations;
  };
  return { stores, mutationTree };
};
github SurenAt93 / monaco-react / demo / src / store / index.js View on Github external
import { createOvermind } from 'overmind';
import { createHook } from 'overmind-react';

import { initialState } from './state';
import * as actions from './actions';
import * as effects from './effects';

export const store = createOvermind({
  state: initialState,
  actions,
  effects,
});

export const useStore = createHook();