Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 04 19:35
    bablukid commented #27
  • Dec 04 19:32
    bablukid commented #27
  • Dec 02 14:20

    kevinresol on master

    Dependencies updated [fixes #97] Merge pull request #98 from San… (compare)

  • Dec 02 14:20
    kevinresol closed #98
  • Dec 02 14:20
    kevinresol commented #98
  • Dec 02 13:54
    Sanva commented #97
  • Dec 02 13:53
    Sanva opened #98
  • Dec 02 13:18
    kevinresol commented #97
  • Dec 02 12:23
    Sanva closed #97
  • Dec 02 12:23
    Sanva commented #97
  • Dec 02 11:12
    gene-pavlovsky opened #13
  • Nov 29 21:22
    Sanva opened #97
  • Nov 29 15:43
    0b1kn00b commented on e6b2df6
  • Nov 28 07:41
    back2dos closed #10
  • Nov 28 07:41
    back2dos commented #10
  • Nov 27 21:45
    nadako opened #10
  • Nov 27 20:29
    back2dos opened #9
  • Nov 27 19:39
    back2dos closed #8
  • Nov 27 19:39

    back2dos on master

    Fixes #8. (compare)

  • Nov 27 19:33
    back2dos closed #7
Juraj Kirchheim
@back2dos
nothing*
the problem is that your function argument has no type
Juraj Kirchheim
@back2dos
@:jsonParse(function (json:DynamicAccess<{ fields: DynamicAccess<{ field:String, value:String }> }>){
    trace(json);
    return [];
})
if I understand the raw data correctly
tjrhodes
@tjrhodes
Hey, is it possible to redirect with tink_web, so If I have no valid session User /in/a/deeper/path I can send them to / instead?
I know I can show them the content of / but I want to redirect the browser
Laurent Deketelaere
@aliokan
@back2dos DynamicAccess was the missing part, thx!
Kevin Leung
@kevinresol
@tjrhodes you can return a tink.Url
tjrhodes
@tjrhodes
Thanks Kevin :)
François Barbut
@bablukid
Hi guys, is it possible to use tink_http in a synchronous way ? I'd like to rewrite API calls with tink_http but the whole app is written in a synchronous way, I can't rewrite the whole app for that ...
Juraj Kirchheim
@back2dos
oh boy ^^
I guess the simple answer is "no"
if you know for certain that a future/promise is synchronous, you can retrieve the value synchronously
François Barbut
@bablukid
Ok, if I compile in PHP, or use Neko with Curl it's synchronous anyway
Shall I use Future.sync() with tink_http in some way ?
Juraj Kirchheim
@back2dos
are you writing the server or the client? ^^
François Barbut
@bablukid
client only
it's backend code compiled to neko or PHP7, accessing a remote REST Api
Juraj Kirchheim
@back2dos
mhh, basically, you can write something like this:
using tink.CoreApi;

function await<X>(p:Promise<X>):X {
  var ret = Failure(new Error('operation was async'));
  p.handle(function (o) ret = o);
  return ret.sure();
}
that'll throw in case it's actually async though
not sure I would recommend it ^^
François Barbut
@bablukid
ah ah ok thanks :)
Peter Achberger
@Antriel
What's that @:require('tink_tcp') in https://github.com/haxetink/tink_http/blob/master/src/tink/http/containers/TcpContainer.hx#L51, is that handled by some global tink macro or something?
Peter Achberger
@Antriel
Damn, right. Thanks. :)
Was hoping it was something automatic, but couldn't imagine how that would work.
Kevin Leung
@kevinresol
But it doesn't really work as expected. Because the typer will fail first
e.g. Cannot find type tink.tcp.Handler will come first then the @:require guard
Peter Achberger
@Antriel
Ah.
Kevin Leung
@kevinresol
Should be using #if !tink_tcp #error #end instead
Peter Achberger
@Antriel
Less nice, but as long as it works. Would be at the top of the file, so less visible. Which is good as there's less noise and less repetition, and bad as it's less obvious.
But I guess the point of require was to work per-field, so the module could still work and just certain functions would be missing, as if wrapped in #if tink_tcp ... #end.
Kevin Leung
@kevinresol
@:require is more a mechansim for custom defines (vs the default define associated with library name)
like @:require(python_version >= 3.4), where the information is more about the runtime than compile time
Peter Achberger
@Antriel
It could be both, but yeah. :)
Kevin Leung
@kevinresol
does hxx pass ref to attr of a function?
function mycomponent(attr:{ref:MyComponent}):ReactSingleFragment;
and what does that compare with the hxxMeta arg?
Juraj Kirchheim
@back2dos
IIRC if hxxMeta is found, it is preferred but otherwise it'll work with attributes
the main reason for supporting a separate object is so that the ref and key don't mix with the props
Peter Achberger
@Antriel
TcpContainer isn't production ready, is it?
Is it silly idea to try to run REST server from haxe --interp?
Kevin Leung
@kevinresol
tink_io doesn't work well on sync targets
Peter Achberger
@Antriel
I've realized even if I solved this, it wouldn't solve the same problem for other parts, so it's ok.
But I couldn't even figure out how to run it at all. :D
Peter Achberger
@Antriel
Just to confirm: there's no way to dynamically add routes at runtime in tink_web?
Kevin Leung
@kevinresol
perhaps you can use a catch-all route and do the stuff there
Peter Achberger
@Antriel
Looking into it, seems like just using tink_http and implementing stuff via handlers will be fine enough.
Kevin Leung
@kevinresol
yup
Peter Achberger
@Antriel
Is there some helper middleware for adding content type based on file name? And maybe other standard things, like returning index file when root is requested?
Peter Achberger
@Antriel