Giter VIP home page Giter VIP logo

fetch's Introduction

Light Table

Build Status Build Status Build status CircleCI codecov

Packaging status

Join the chat at https://gitter.im/LightTable/LightTable Code Shelter

Light Table is a next generation code editor that connects you to your creation with instant feedback. Light Table is very customizable and can display anything a Chromium browser can.

This is a development branch and is not clean like master and can have many breakages.

Downloads

Prebuilt binaries are available through lighttable.com. To build and use a developer version of Light Table see these instructions.

For OSX users, the install process involves the following steps until we officially sign our OSX App:

  • In Finder, Ctrl-click on LightTable.app/ and select Open.
  • When you see this prompt about LightTable being unidentified, click Open.
  • If Ctrl-click doesn't work for you, open System Preferences > Security & Privacy > General, temporarily change "Allow apps downloaded from:" to Anywhere and double click on LightTable.app.

Documentation

Plugins

Light Table has a powerful plugin system that allows almost any aspect of the editor to be extended and customized. With over 100+ plugins, the community is able to offer eval support for new languages, create domain-specific IDEs and much more. If you're interested in writing your own plugin, see the Write a Plugin and Submit a Plugin docs. For an example ClojureScript plugin, see LightTable-Declassifier.

Community

Want to ask a question or just say hi? Please do :). Our mailing list is the Light Table Google group. We also hang out in #lighttable on Freenode IRC.

For Developers

LightTable is primarily written in ClojureScript. If you aren't familiar with it, check out David Nolen's tutorial.

In order to develop for Light Table, you will need to install a developer version of Light Table. For more information, read CONTRIBUTING.md and For Developers.

License

All files in this project are under the LICENSE.md license unless otherwise stated in the file or by a dependency's license file.

Credits

Big thanks to all our contributors! Thanks of course to Kodowa for all they have done for Light Table and also to Cognitect for providing friday contributions for one of the core team members.

fetch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fetch's Issues

Release 0.3.0

@kenny-evitt can you please make a release for LightTable/fetch?

I realize this project is probably not active beyond LightTable and that noir is deprecated, but @brabadu's earlier work seems to resolve the warnings during lein cljsbuild once app after updating LightTable's clojurescript version for LightTable/LightTable#1973 . Unfortunately, since there is no release containing these changes I was forced to temporarily roll my own release.

ReferenceError: fetch is not defined - cljs

I have a simple client-side ping, using [fetch "0.1.0-alpha2"]:

(ns barker.client.main                                                                                                                                   
  (:require [fetch.remotes :as remotes])                                                                                                                 
  (:use [jayq.core :only [$ data attr]])                                                                                                                 
  (:require-macros [fetch.macros :as fm]))                                                                                                               


;; This is used to confirm the server is up from the
;; browser js console or browser-repl                                                                                                                    
(defn ping-server []                                                                                                                                     
  (fm/remote (ping) [pong-response]
    (js/alert pong-response)))

The server is simple:

(ns barker.views.welcome                                                                                                                                 
  (:require [barker.views.common :as common])                                                                                                            
  (:use [noir.core :only [defpage]]                                                                                                                      
        [noir.fetch.remotes :only  [defremote]]))

;; ### Remotes                                                                                                                                           
(defremote ping []                                                                                                                                         (do                                                                                                                                                    
    (println "Pinged by client!")                                                                                                                        
    (str "PONG - from the server")))

Everything compiles and run, but when I try to call it via the console:
>>> barker.client.main.ping_server();

I get the following error:

ReferenceError: fetch is not defined
http://localhost:8080/cljs/barker.js
Line 17701

the line is:
return fetch.remotes.remote_callback.call(null, "ping", cljs.core.Vector.fromArray([]), function (a) {

Also, even if I put (ping-server) at the bottom of my main.cljs file, I get nothing - no alert, no error.

Security

More of a question than an issue, but how do you recommend that the remotes be secured? For example let's say you had a remote to provide private user info, what is the best way to secure this? Standard auth via session?

Updating dependencies make fetch work again...

I needed to generate a new fetch jar to make things work with the following updated deps:


(defproject fetch "0.1.0-alpha2"
:description "A ClojureScript and Noir library to make client-server interaction painless."
:dependencies [[clojure "1.4.0"]
[noir "1.3.0-beta10"]])


After that it worked like a charm - thanks!

Firefox unable to call remote function

I'm getting Javascript errors in Firefox 10.0.1 when my app attempts to call a function using the remote macro, the request doesn't even reach the server (I've checked with logging etc), all I get returned in the "Firebug" javascript error console is the message uncaught exception: EOF every time this code is hit

What's odd is the fact that everything works fine in Webkit based browsers (Chrome, Safari, iOS Safari, Android etc) so I'm not really sure what's going on here

remotes cannot receive (to clojure) some unicode characters in strings

I was just bitten by this, which seems to be identical to pinot issue 16, ibdknox/pinot#16, reported by davesann. This is with latest available fetch/noir on Clojure 1.4.0, both OS X 10.7, OpenJDK 1.7 and Ubuntu 12.04, OpenJDK 1.7, and as far as I can tell everything is UTF-8.

It works fine retrieving a value like 'tésting' from the remote, but not posting the same.

There was also a discussion about read-string on the clojure list https://groups.google.com/forum/?fromgroups#!topic/clojure/Kl3WVtEE3FY, but I'm not sure if a fix there has been agreed upon yet. (The wiki page linked to there doesn't work for me right now.)

java.lang.RuntimeException: Unsupported escape character: \x
at clojure.lang.Util.runtimeException(Util.java:170)
at clojure.lang.LispReader$StringReader.invoke(LispReader.java:497)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1126)
at clojure.lang.LispReader$MapReader.invoke(LispReader.java:1069)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1126)
at clojure.lang.LispReader$VectorReader.invoke(LispReader.java:1061)
at clojure.lang.LispReader.read(LispReader.java:180)
at clojure.lang.RT.readString(RT.java:1707)
at clojure.core$read_string.invoke(core.clj:3361)
at noir.fetch.remotes$safe_read.invoke(remotes.clj:14)
at noir.fetch.remotes$ANY___fetch.invoke(remotes.clj:

I am currently investigating if davesann's proposed fix works for me:

(defn unescape [string]
  (s/replace 
    string #"\\x(..)" 
    (fn [m] (str (char (Integer/parseInt (second m) 16))))))

Wait for return from server

I understand that fetch has a callback model style for development, however I'm having trouble trying to work with this model effectively in my current application.

I'm developing a small CLJS application that has a "console" style interface, so the user inputs commands and I have a "handle" function that takes the input the user has submitted, parses it, and performs an action that ultimately returns a string as a result.

One of these functions goes to the server to return a map of data, however due to the nature of fetch it does nothing because nothing is "returned" from a remote until the callback function is called

e.g.

(defn get-results-from-server [arg]
  (fm/remote (get-results arg) [r]
     r))

(defn command-handler [input arg]
  (condp = input
   "get" (-> (get-results-from-server arg) (js/alert))) ;js alert doesn't show anything as nothing is 'returned' from get-results-froms-sever
     ... 

Is there any way of making fetch request data from the server, wait for a reply (or timeout with a nil result) and then return whatever was received, instead of a callback?

Sorry if that doesn't make sense

Problem with "fetch" when deploying as a war

I am including the conversation from clj-noir list -

Hi,

I have a clojurescript app which uses fetch for remoting. The app works fine when run as lein run. However when compiled as an uberwar and deployed on jetty, I can see the following error in chrome's js console -

POST http://localhost:8080/_fetch 404 (Not Found)

The url I am using to access the system is http://localhost:8080/tms. All other resources such as css, and css get resolved correctly.

I also tried setting the {:base-url "/tms"} option in my handler, but that didnt help too.

It seems fetch should be making a call to tms/_fetch while it is making a call to /_fetch? How do I resolve this ?

Another observation - I tried deploying it on elasticbeanstalk with tomcat and it works!

So it fails in jetty 6 while works in tomcat 7!

Thanks,
Murtaza

Mark Rathwell [email protected]
7:53 PM (34 minutes ago)

to clj-noir

Another observation - I tried deploying it on elasticbeanstalk with tomcat
and it works!

But on elasticbeanstalk, the servlet is running in the root context
('/' not '/tms'), right? I don't see a built-in way for fetch to
handle a context path, so you should probably open an issue on github
[1].

[1] https://github.com/ibdknox/fetch/issues

Murtaza Husain
8:29 PM (0 minutes ago)

to clj-noir
Yes it is running as root in beanstalk.

Thanks, I will open an issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.