npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

e-stella-code-editor

v1.0.8

Published

Code Editor component for E-Stella project (and not only)

Downloads

2

Readme

e-stella-code-editor

Code Editor component for E-Stella project (and not only)

NPM JavaScript Style Guide

Install

npm install --save e-stella-code-editor

Usage

import React from 'react'

import { CodeEditor } from 'e-stella-code-editor'
import { Realtime } from "ably/browser/static/ably-commonjs.js"


const App = () => {

  const id = Math.floor(Math.random() * 100)

  const ably = new Realtime({ key: process.env.REACT_APP_ABLY_API_KEY })
  const channel = ably.channels.get('code')

  const sub = (func) => channel.subscribe(func)
  const pub = (data) => channel.publish('codeChanged', data, (err) => err ? console.log(err) : console.log(''))

  return (
    <div style={{overflowX: 'hidden', overflowY: 'hidden'}}>
      <CodeEditor
        fetchTasks={
          () => fetch("https://recruitment-service-estella.herokuapp.com/api/tasks?process=16").then(response => response.json())
        }
        solverId="f0dee915-9291-449f-9b37-33ef547adeb0"
        codeCheckerBaseLink="https://e-stella-code-executor.herokuapp.com"
        sharingCodeFunctions={{ sub, pub, id }}
      />
    </div>
  )
}

export default App

To use Code Editor it's enough to just install it. Follow table of props to see more advanced usage.

Table of props

outerMonacoWrapperStyle, fetchFiles, codeCheckerBaseLink, outerOnSubmit, absoluteOffset | Prop | Type | Deafult | IsRequired | Meaning | |---|---|---|---|---| | outerMonacoWrapperStyle | object | {height: '300px'} | false | Style of monaco editor (big black rectangle in which you write code) | | fetchTasks | function | None | true | Function that gets tasks. See below to see what task object should return | | solverId | string | None | true | Task solver identification string | | codeCheckerBaseLink | string | "https://e-stella-code-executor.herokuapp.com" | false | Link to REST Api that should execute tests. See below to see what endpoints it must have | | outerOnSubmit | function | None | false | Function that will be called when Submit button is clicked (aside of checking tests). It will be called with object { code, language, task } | | absoluteOffset | object | None | false | Offset of absolute position of settings and submit buttons. Check example to see how it must be shaped. | | sharingCodeFunctions | object | None | false | Functions and utils we'll use to share your code in realtime. If you don't want to use them, leave this prop empty. |

Fetch Tasks

TODO

CodeCheckerBaseLink

TODO

sharingCodeFunctions

Utils that we need to share your code in real time. As we don't want to set technology in stone, we didn't provide them by default. Check out out example to see how we implemented them with Ably. Utils we need:

  • pub - publish function
  • sub - subscribe function - should receive one argument - callback that will be called when message comes. We'll use it to set a code message.
  • id - unique identifier that we'll use to determine who sent the code
  • codeSharingInterval - interval of sharing code in ms (if not set, will fallback to default 2000)

License

MIT © e-Stella-AGH