How to use the @nteract/commutable.fromJS function in @nteract/commutable

To help you get started, we’ve selected a few @nteract/commutable 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 nteract / nteract / packages / reducers / src / core / entities / contents / index.ts View on Github external
// The listing is all these contents in aggregate
                    items: sorted
                  }),
                  filepath: fetchContentFulfilledAction.payload.filepath,
                  lastSaved:
                    fetchContentFulfilledAction.payload.model.last_modified,
                  created: fetchContentFulfilledAction.payload.model.created,
                  loading: false,
                  saving: false,
                  error: null
                })
              )
          );
        }
        case "notebook": {
          const immutableNotebook = fromJS(
            fetchContentFulfilledAction.payload.model.content
          );

          return state.set(
            fetchContentFulfilledAction.payload.contentRef,
            makeNotebookContentRecord({
              created: fetchContentFulfilledAction.payload.created,
              lastSaved: fetchContentFulfilledAction.payload.lastSaved,
              filepath: fetchContentFulfilledAction.payload.filepath,
              model: makeDocumentRecord({
                notebook: immutableNotebook,
                savedNotebook: immutableNotebook,
                transient: Map({
                  keyPathsForDisplays: Map(),
                  cellMap: Map()
                }),
github nteract / nteract / packages / notebook-render / src / index.tsx View on Github external
constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }
github nteract / nteract / packages / notebook-render / src / index.tsx View on Github external
componentWillReceiveProps(nextProps: Props) {
    if (nextProps.notebook !== this.props.notebook) {
      this.setState({ notebook: fromJS(nextProps.notebook) });
    }
  }
github nteract / nteract / packages / core / src / dummy / dummy-nb.js View on Github external
"source":["## The Notable Nteract Notebook\\n","\\n","**It\'s a notebook!**\\n"]},\
{"cell_type":"code","execution_count":11,"metadata":{"collapsed":false},\
"outputs":[{"data":{"text/plain":["<h1>Multiple</h1>"],\
"text/plain":[""]},"metadata":{},"output_type":"display_data"}],\
"source":["import IPython\\n","\\n","from IPython.display import HTML\\n",\
"from IPython.display import Markdown\\n","from IPython.display import display\\n","\\n",\
"display(HTML(\'<h1>Multiple</h1>\'))\\n","display(HTML(\'<p>Display Elements</p>\'))\\n",\
"display(Markdown(\'**awesome**\'))\\n","\\n","print(\'hey\')\\n","42"]}],\
"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},\
"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py",\
"mimetype":"text/x-python","name":"python","nbconvert_exporter":"python",\
"pygments_lexer":"ipython3","version":"3.5.1"}},"nbformat":4,"nbformat_minor":0}';

export const dummyJSON = JSON.parse(dummy);

export const dummyCommutable = fromJS(dummyJSON);

export const bigDummyJSON = {
  cells: [
    {
      cell_type: "markdown",
      source: [
        "# This is an example notebook\n",
        "\n",
        "## Used for test purposes...\n",
        "\nThe idea is to have enough real data in here to make a non-trivial NB."
      ],
      metadata: {
        trusted: false
      }
    },
    {
github nteract / nteract / packages / core / src / dummy / dummy-nb.js View on Github external
version: "3.6.0",
      mimetype: "text/x-python",
      codemirror_mode: {
        name: "ipython",
        version: 3
      },
      pygments_lexer: "ipython3",
      nbconvert_exporter: "python",
      file_extension: ".py"
    }
  },
  nbformat: 4,
  nbformat_minor: 2
};

export const bigDummyCommutable = fromJS(bigDummyJSON);

export const bigDummy = JSON.stringify(bigDummyJSON);
github nteract / nteract / applications / jupyter-extension / nteract_on_jupyter / epics / notebook.js View on Github external
map(action => ({
      type: "SET_NOTEBOOK",
      filename: action.payload.name,
      notebook: fromJS(action.payload.content)
    })),
    catchError((xhrError: any) =>
github nteract / nteract / packages / fixtures / src / dummy-nb.ts View on Github external
"source":["## The Notable Nteract Notebook\\n","\\n","**It\'s a notebook!**\\n"]},\
{"cell_type":"code","execution_count":11,"metadata":{"collapsed":false},\
"outputs":[{"data":{"text/plain":["<h1>Multiple</h1>"],\
"text/plain":[""]},"metadata":{},"output_type":"display_data"}],\
"source":["import IPython\\n","\\n","from IPython.display import HTML\\n",\
"from IPython.display import Markdown\\n","from IPython.display import display\\n","\\n",\
"display(HTML(\'<h1>Multiple</h1>\'))\\n","display(HTML(\'<p>Display Elements</p>\'))\\n",\
"display(Markdown(\'**awesome**\'))\\n","\\n","print(\'hey\')\\n","42"]}],\
"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},\
"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py",\
"mimetype":"text/x-python","name":"python","nbconvert_exporter":"python",\
"pygments_lexer":"ipython3","version":"3.5.1"}},"nbformat":4,"nbformat_minor":0}';

export const dummyJSON = JSON.parse(dummy);

export const dummyCommutable = fromJS(dummyJSON);

export const bigDummyJSON: Notebook = {
  cells: [
    {
      cell_type: "markdown",
      source: [
        "# This is an example notebook\n",
        "\n",
        "## Used for test purposes...\n",
        "\nThe idea is to have enough real data in here to make a non-trivial NB."
      ],
      metadata: {
        trusted: false
      }
    },
    {
github nteract / nteract / packages / notebook-preview / src / index.tsx View on Github external
componentWillReceiveProps(nextProps: Props) {
    if (nextProps.notebook !== this.props.notebook) {
      this.setState({ notebook: fromJS(nextProps.notebook) });
    }
  }
github nteract / nteract / packages / notebook-preview / src / index.tsx View on Github external
constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }
github nteract / nteract / packages / notebook-render / src / index.tsx View on Github external
constructor(props: Props) {
    super(props);

    this.state = {
      notebook: fromJS(props.notebook)
    };
  }