How to use idyll-compiler - 6 common examples

To help you get started, we’ve selected a few idyll-compiler 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 idyll-lang / idyll-studio / src / components / idyll-document / src / index.js View on Github external
componentWillReceiveProps(newProps) {
    if (newProps.ast) {
      console.log('newProps.ast',newProps.ast)
      //this.setState({ast: newProps.ast})
      return;
    }

    if (newProps.markup) {
    const hash = hashCode(newProps.markup);
    if (hash !== this.state.hash) {
      this.setState({ previousAST: this.state.ast });
      compile(newProps.markup, newProps.compilerOptions)
        .then((ast) => {
          this.setState({ previousAST: ast, ast, hash, error: null });
        })
        .catch(this.componentDidCatch.bind(this));
    }
  }
  }
github idyll-lang / idyll / packages / idyll-document / src / index.js View on Github external
componentWillReceiveProps(newProps) {
    if (newProps.ast) {
      return;
    }

    const hash = hashCode(newProps.markup);
    if (hash !== this.state.hash) {
      this.setState({ previousAST: this.state.ast });
      compile(newProps.markup, newProps.compilerOptions)
        .then(ast => {
          this.setState({ previousAST: ast, ast, hash, error: null });
        })
        .catch(this.componentDidCatch.bind(this));
    }
  }
github idyll-lang / idyll / packages / idyll-editor / src / app.js View on Github external
handleChange(value) {
    const hash = hashCode(value.trim());
    if (hash === this.state.hashCode) {
      return;
    }
    try {
      const ast = compile(value);
      this.setState({
        idyllHash: hash,
        idyllMarkup: value,
        ast: ast,
        error: null
      })
    } catch(e) {
      this.setState({
        error: e.message
      })
    }
  }
github idyll-lang / idyll / packages / idyll-editor / src / app.js View on Github external
constructor(props) {
    super(props);
    this.state = {
      idyllMarkup: initialValue,
      idyllHash: '',
      error: null,
      ast: compile(initialValue)
    }
    this.handleChange = this.handleChange.bind(this);
  }
github idyll-lang / idyll / packages / idyll-document / src / index.js View on Github external
componentDidMount() {
    if (!this.props.ast && this.props.markup) {
      compile(this.props.markup, this.props.compilerOptions).then(ast => {
        this.setState({ ast, hash: hashCode(this.props.markup), error: null });
      });
    }
  }
github idyll-lang / idyll-studio / src / components / idyll-document / src / index.js View on Github external
componentDidMount() {
    if (!this.props.ast && this.props.markup) {
      compile(this.props.markup, this.props.compilerOptions)
        .then((ast) => {
          this.setState({ ast, hash: hashCode(this.props.markup), error: null });
        })
    }
  }

idyll-compiler

Compiler for idyll

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis

Popular idyll-compiler functions