clemos / haxe-js-kit Goto Github PK
View Code? Open in Web Editor NEWThis project forked from haxe-nodejs/node-api
Haxe tools and externs for Javascript and Node.js
License: MIT License
This project forked from haxe-nodejs/node-api
Haxe tools and externs for Javascript and Node.js
License: MIT License
or merge with abe ?
I think this is one of the best libraries out there for web and general js development with Haxe, because let's be honest, UFront is a niche framework currently and is not really under active development.
I suggest we brand this over and create a slick marketing site. The name could changed maybe, but I think haxe-js-kit
is fine.
Food for though! What do you guys think?
Currently Mixed
is used in the mongoose schema when the type is abstract. Is it possible to drill down to the concrete type of an abstract when creating the schema?
e.g. A field of type abstract MyAb(String)
will become a String instead of Mixed in the schema
i want to create restful api with mysql and express and simple chat room with socket.io is there any example for that? because i'm struggling using Router and Route.
thank you
Currently at npm.Package:232 we have
extern interface Require<Const,Const> {}
Need fix to optional second argument:
extern interface Require<Const, ?Const> {}
Hi, soon I'll have a large bunch of packages ready to be merged from https://github.com/ciscoheat/meadowlark/tree/master/js-kit/js, how would you like them to be reviewed and pull-requested? Not all have a complete API but they are all working fine.
I'm using an abstract class here for settings, would you like me to use an inline static string in the class instead? https://github.com/ciscoheat/meadowlark/blob/master/js-kit/js/npm/express/Morgan.hx
I haven't made packages for all subclasses, for example here with CsurfOptions
. Is that ok still? https://github.com/ciscoheat/meadowlark/blob/master/js-kit/js/npm/express/Csurf.hx
js.npm.express, connect or neither? Sometimes I'm struggling where to put the class. Any guidelines?
see HaxeFoundation/haxe#4209
(js.Regexp
, js.Lib
, js.JQuery
, ... ?)
Hi
I am just starting with node js and wanted to use this library with haxe: https://github.com/niegowski/node-pngjs
The PNG class both implement Readable and Writable stream.
Unfortunately the extern used in haxe-js-kit for Readable and Writable are classes and I thus need to use "extends" for my extern but this block me for using both Readable and Writable.
Is there any workarround ?
Is this an issue of js-kit or extern not allowing interfaces?
Thanks for your lib by the way, that is quite useful
haxe -lib js-kit -js mongoose.js -main test.MongooseTest tells me:
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Mongoose.hx:17: characters 8-134 : Constraint check failure for js.npm.mongoose.TModels.M
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Mongoose.hx:17: characters 8-134 : model.M should be js.npm.mongoose.TModel<model.T>
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Model.hx:20: characters 8-60 : Constraint check failure for js.npm.mongoose.TModels.M
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Model.hx:20: characters 8-60 : model.M should be js.npm.mongoose.TModel<model.T>
After changing the code as suggested it works well :)
This code:
Fs.writeFile( filePath, someHtml, function(err,val) {});
Gives me the error:
Arguments and variables of type Void are not allowed
These are used almost everywhere, so I'm not sure if I'm doing something wrong - does this work for other people? I'm using the latest Haxe from git.
For me the solution is to replace all the Callback<Void>
types in the externs with Callback<Class<Void>>
. Juraj explained the meaning of this type in this post: https://groups.google.com/d/msg/haxelang/8erB4mxm0n4/hzhFoykK8x8J
Let me know if I'm the only one having problems :)
The file https://github.com/clemos/haxe-js-kit/blob/dev/js/npm/connect/support/Middleware.hx won't compile as it is now (missing two imports), but it seems to be replaceable with https://github.com/clemos/haxe-js-kit/blob/dev/js/npm/express/Middleware.hx anyway. Remove it?
Wondering if the electron (atom-shell) externs are up to date? Any example of how to use it with Haxe?
Thanks!
First I's like to know if it makes any sense to have
@:overload( function ( mount : String , middleware : Middleware<Request,Response> ) : Connect {} )
two times in the Application class.
then I wanted to use methods of the servers classes from the routes following the advices on http://stackoverflow.com/questions/15039045/access-app-js-variables-in-routes-but-without-global-express I tried both approaches - the first one didn't work and I would like to know why the following code inside the user.js route file
var user = require("../nodeOne");
console.log(user);
just prints an empty object: {} (nodeOne.js is my haxe output server)
so I used the second approach which seems to work:
var createUser:Request->Response->User = User.create;
app.use(function(req,res,next){
req.createUser = createUser;
next();
});
to get this compiled I had to add to the Application.use signatures:
@:overload( function ( fn:Request->Response->(Void->Void)->Void) : Connect {} )
and make the js.npm.express.Request class implement Dynamic
would you suggest any better way to achieve this?
If you initialize Express it tries to use some of Connects functions rather than it's node_module version.
Could be sharing of scope, or the use of new in the generated code, I just replaced mine with @:natve to get round it for the time being.
Also, Express is the global object, and an ExpressServer built with a function() which I don't see anywhere.
(It might be an issue between express/connect: not sure)
cheers
I love the @async
feature, but I'm tired of the error testing and callback passing. What do you think about adding error handling in the metadata? Something like:
public function start(cb : Error -> Void) {
var err, client = @async(err => cb) Soap.createClient('https://some/service.asmx?wsdl');
// ...
}
With this (err => cb)
construct, it will generate this code:
Soap.createClient('https://some/service.asmx?wsdl', function(err, client) {
if(err != null) return cb(err);
// ...
});
I'm not sure how to handle callback signatures with different number of parameters though. What do you think about this idea?
Please provide haxelib.json file for use with haxelib git
command, so people can install this lib directly from command-line.
Hello,
I have tried to use your library, for this i have in my hxml file the path of a clone of your code.
and i use a simplified version of your express example ( just static entry)
But i have the following errors messages:
/home/systrans/haxemk/haxe-js-kit/npm/Package.hx:249: characters 7-40 : Duplicate type parameter name: Const
/home/systrans/haxemk/haxe-js-kit/npm/Package.hx:252: characters 7-49 : Duplicate type parameter name: Const
When i look at line 249 :
extern interface Require<Const,Const> {}
And when i look at line 252
extern interface RequireNamespace<Const,Const> {}
I have the same errors when i do:
haxe test.hxml
in the haxe-js-kit directory
how do you use @async to get all documents with mongoose?
this in the normal callback way that works
post.find().exec(function( err:String, docs:Array<Post> ){
res.render('index', { posts : docs });
});
if i do this, i get a compile time error
using Haxe version 3.1.3 [stable]
var query = post.find();
var err,docs = @async query.exec();
if(err != null) trace(err);
res.render('index', { posts : docs });
// error
Local variable err used without being initialized
this compiles, yet does not give me an array of documents like i expected
var err,docs = @async query.exec();
res.render('index', { posts : docs });
tracing docs
shows this
{
domain : null,
_events : {
},
_maxListeners : 10,
emitted : {
},
ended : false
}
i think i'm using the model find and query exec incorrectly, can you show me an example please?
I am trying to combine a couple things in Electron.
Doesn't work...
electron externs from js-kit are ... still called Atom
So I moved to hxelectron from Franco Ponticelli
and he uses -lib hxnodejs
But also want to use express (from js-kit)
you see where I am going...
it doesn't work.
if I copy js.npm
files to a folder without the js.node
I get:
lib/js/npm/express/Application.hx:3: characters 7-26 : Type not found : js.support.Callback
copied js.support
folder
lib/js/npm/express/Middleware.hx:21: characters 2-7 : Type not found : util.CopyMethods
(magical stuff happening there)
and I remove -lib hxnodejs
and add -lib js-kit
lib/electron/main/BrowserWindow.hx:7: lines 7-26 : Type not found : Event
Hi Clemos,
it looks like
--macro npm.Package.export("package.json")
doesn't work anymore
Edit
perhaps something to do with my Haxe version: 3.2.0
Hi contributors !
@cloudshift @as3boyan @async-cl @dionjwa @Peekmo @JbIPSย @andyli @sledorze @labe-me @nesboxย @jasononeil @ccapndave
I'd like to licence haxe-js-kit code, as @underscorediscovery asked me, so people can use it freely.
I think MIT would be fine, but since you contributed one way or another to this project, I thought I'd let you know.
Let me know if you have any problem with that; otherwise I'll just add the licence by the end of the week.
Hello there!
I'm doing a Youtube Scraper and need to search through tags.
I tried to do use this typedef for a mongoose stored data
"
typedef ChannelStatsData =
{
linkedChannelID:String,
tags:Map<String, Int>,
averageByVideo :
{
likes:Float,
dislikes:Float,
comments:Float,
views:Float
},
best:
{
like:Float,
dislike:Float,
comments:Float,
views:Float
}
}
"
But it seems that Mongoose doesn't like the tags:Map<String,Int>, part.
Is it a problem of the lib or I should do a workaround? thx!
It would be nice if the Manager
could take SchemaOptions
so even when the schema is auto-generated by the macro, it takes those options.
Maybe by giving it to the build()
method?
Hi !
I'm trying to attach a passport strategy to express routes.
In js, it would look like this:
File auth.js:
var passport = require('passport');
var BasicStrategy = require('passport-http').BasicStrategy;
var User = require('../models/user');
passport.use(new BasicStrategy(
function(username, password, callback) {
User.findOne({ username: username }, function (err, user) {
if (err) { return callback(err); }
// No user found with that username
if (!user) { return callback(null, false); }
// Make sure the password is correct
user.verifyPassword(password, function(err, isMatch) {
if (err) { return callback(err); }
// Password did not match
if (!isMatch) { return callback(null, false); }
// Success
return callback(null, user);
});
});
}
));
exports.isAuthenticated = passport.authenticate('basic', { session : false });
Main.js:
var passport = require('passport');
var authController = require('./controllers/auth');
mongoose.connect('mongodb://localhost:27017/beerlocker');
var app = express();
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(passport.initialize());
var router = express.Router();
router.route('/beers')
.post(authController.isAuthenticated, beerController.postBeers)
.get(authController.isAuthenticated, beerController.getBeers);
Here is my try to do something similar with haxe:
expressSrv = new js.npm.Express();
function isAuthenticated(req : Request, res : Response) : Void {
trace('isAuthenticated triggered');
js.npm.Passport.authenticate('basic', { session : false });
}
function initExpressRoutes() : Void {
var r = new Router();
r.route('/beers')
.post(isAuthenticated, postBeerAction)
.get(isAuthenticated, getBeersAction);
js.npm.Passport.use(new js.npm.passport.BasicStrategy(
function(email, password, cb) {
trace('basic strategy triggered!');
app.userDao.md.findOne({ email: email },
function (err, user) {
if (err != null) {
cb(err);
return;
}
if (user == null) {
cb(null, false);
return;
}
user.verifyPassword(password,
function(err, isMatch) {
if (err != null) {
cb(err);
return;
}
if (!isMatch) {
cb(null, false);
return;
}
cb(null, user);
});
});
}
));
r.use(js.npm.Passport.initialize());
r.use(BodyParser.json());
expressSrv.use(r);
}
And it might not be the right way to do it as calls hangs on the isAuthenticated method...
What am I doing wrong ?
Hey guys,
I need to read some files from the filesystem from my Haxe nodejs app, but I just found out that externs for the fs
module are not complete. There's only a FSWatcher.hx
and a Stats.hx
there.
I'd like to add the extern for fs.readFile()
, and also learn the pattern for adding others - I'm not sure how I should name the class, and also what is needed, since I see some macro magic is being used there (in the implements call). Could someone point me in the right direction - an example would be great!
Thanks in advance!
Consider a model defined as follow:
typedef StuffData = {
test : String,
foo : Int,
?bar : {
hello : String,
world : Array<Dynamic>
}
}
// declare the model
// the typedef fields will be "copied" to Stuff instance
@:schemaOptions({
autoIndex: true
})
class Stuff extends Model<StuffData>{}
class StuffManager extends js.npm.mongoose.macro.Manager<StuffData,Stuff>{}
The following code will compile (but it should not):
function test(stuff:Stuff) stuff.nonExistentField;
Any idea?
and $type(stuff.nonExistentField)
gives me Dynamic
Just found this repo, and as someone currently using Haxe for js work, this is will certainly be useful. Do you have any samples apps available, i.e for expressjs? It'd be great to see how the same app would look written in Haxe vs vanilla Javascript, to compare the cost/benefits of using either languages.
Keep up the great work!
Check out this gist: https://gist.github.com/ciscoheat/2ea2034a239024c89547
When using Date.now()
in the call to construct, the javascript output isn't compiled to new attractions({...})
, but when using a variable it works.
Thanks for the great mongoose API you've made, it really simplifies things.
Thanks for the great work!
Any plan to publish to haxelib in the near future or should I turn to using the git repo if I need a new feature? (namely node's https support).
Thanks
I am currently working on making a socketio example.
I use https://github.com/clemos/haxe-js-kit/blob/develop/test/SocketIoTest.hx as a reverence
And I ran into a bug on the client:
client.js:2 Uncaught ReferenceError: process is not defined
Played around with it and I can stop that error when I remove js-kit
-lib js-kit
Source will be generated
// Generated by Haxe 3.3.0
(function () { "use strict";
...
instead off
// Generated by Haxe 3.3.0
if (process.version < "v4.0.0") console.warn("Module " + (typeof(module) == "undefined" ? "" : module.filename) + " requires node.js version 4.0.0 or higher");
(function () { "use strict";
...
So I guess you do some macro magic (yes I still call it magic) and checks for Node/Node-version, which is not necessary on the client.
So perhaps first a check for process
if (typeof process !== 'undefined' ) if (process.version < "v4.0.0") console.warn("Module " + (typeof(module) == "undefined" ? "" : module.filename) + " requires node.js version 4.0.0 or higher");
Hey guys,
I'm trying to use haxe-js-kit
with @frabbit's angular.haxe
(https://github.com/frabbit/angular.haxe), but if I add both as -lib
to the build.hxml
, I get the following errors:
/usr/lib/haxe/std/js/html/MediaElement.hx:79: characters 1-64 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeys.hx:34: characters 1-122 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:34: characters 1-42 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:36: characters 1-131 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:37: characters 1-53 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:38: characters 1-99 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:39: characters 1-34 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:40: characters 1-35 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:41: characters 1-58 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:33: characters 1-41 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:45: characters 1-81 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:38: characters 1-46 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:43: characters 1-37 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/Navigator.hx:60: characters 1-149 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaElement.hx:79: characters 1-64 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeys.hx:34: characters 1-122 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:34: characters 1-42 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:36: characters 1-131 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:37: characters 1-53 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:38: characters 1-99 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:39: characters 1-34 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:40: characters 1-35 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:41: characters 1-58 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:33: characters 1-41 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:45: characters 1-81 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:38: characters 1-46 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:43: characters 1-37 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/Navigator.hx:60: characters 1-149 : Type name js.Promise is redefined from module js.JQuery
I have no idea what might be causing this. Any hints?
Thanks!
Hi, only now i noticed there exists a dev
branch and i switched to it to avoid rewriting new additions like Morgan like i did a couple of days ago.
I found i cannot use Router.get()
while i can use Router.all()
and Router.post()
I was using the following code to place routes on different folders.
class App {
static function main() {
var port = 8000;
var app = new Express();
app.use('/', new Index().router);
app.use('/users', new Users().router);
}
}
class Index {
public var router:Router;
public function new() {
router = new Router();
router.all('/', function(req:Request, res:Response) {
res.end("Index");
});
}
}
class Users { .... }
Now i have to replace Router.get()
with Router.all()
.
PS - If you know a better way to place routes on different folders let me know, i found this hacky way so far.
I wanted to use this Lib for Express. As soon as I use it though Sublime auto completion does not work anymore:
package;
class ServerMain {
public static function main() {
trace('hello world');
// here auto completion still works.
var app = new js.npm.Express();
// from here on auto completion is broken
}
}
I tried all 3 branches ("master", "develop", "haxelib").. I installed via haxelib and via git. No luck. I am on OS X with Haxe 3.2.1
It still compiles ok though. Also there is no error message in Sublime whatsoever. So I am not sure if it is a js-kit issue or a Sublime Plugin issue. Never had that kind of trouble with Sublime before though.
Hi,
I'm trying to save a mongoose document with its save method. I saw in js.npm.mongoose.Model.hx
:
@:native("Model")
extern class TModel<T>
extends Document<T>
implements npm.Package.RequireNamespace<"mongoose","*">
{
...
public function save( fn : Callback<TModel<T>> ) : Void;
...
}
So I tried:
class MyModel extends Model<MyModelData>{}
class MyModelDOA{
public function clone(mod: MyModel, callback: Callback<MyModel>):Void
{
mod.save(callback);
}
}
But I get Function 'save' requires no arguments
. The weird thing is that I can use any function on the model and it didn't trigger any compilation errors (I tried mod.hjdzjhuhef()
and it compiled), like it's a Dynamic.
Is there an interference with another save function ?
This is a follow up on #141, however the problems we encounter are more far-reaching.
Among other things hxnodejs:
-D nodejs
which is why haxe.Http
will attempt using the nodejs specific implementation in the browserBuffer
(I believe you have to use haxe.io.Bytes
or something for that to happen) into the build and thus `require("buffer")I'm not sure how to deal with this. As far as socket IO is concerned, I wonder though if the nodejs dependency is all that useful. From the looks of it, it really just uses EventEmitter.
Maybe this would work:
package js.npm.socketio;
#if nodejs
typedef EventEmitter<T> = js.node.events.EventEmitter;
#else
extern class EventEmitter<T> {
// ...
}
#end
I guess down the line the real question is though whether haxe-js-kit is really intended for pure browser development (i.e. not electron or some other environment that has access to the nodejs APIs).
Hi !
I'm quite lost with the Mongoose externs...
Here is a javascript version of what I would like to do:
var mongoose = require('mongoose');
// Define our user schema
var UserSchema = new mongoose.Schema({
username: String,
password: String
});
// Execute before each user.save() call
UserSchema.pre('save', function(callback) {
var user = this;
// Break out if the password hasn't changed
if (!user.isModified('password')) return callback();
console.log("password has changed: "+user.password);
});
// Export the Mongoose model
module.exports = mongoose.model('User', UserSchema);
Now, here is what I have in my haxe project:
typedef UserData = {
username : String,
password : String
}
@:schemaOptions({
versionKey: false
})
class User extends Model<UserData> { }
class UserManager extends Manager<UserData, User> { }
class UserDao {
public function new(db : Mongoose) {
md = UserManager.build(db, "User");
}
public var md : TModels<UserData, User>;
}
I see in the Mongoose externs that the pre method is defined. But how can I call it ? And in its callback, how will I be able to access the user instance it concerns ("this" in the raw javascript version)?
Thanks in advance !
nodejs-std
has class which has contants for encoding and etc.
https://github.com/dionjwa/nodejs-std/blob/master/src/js/Node.hx#L861
Does haxe-js-kit has constants listed somewhere?
I am aware new Mongoose externs are still hot :), but maybe this is a simple fix. I am not able to create a Document out of a model with just calling the constructor. (not using create)
var stuff = new Stuff(); //non persisted doc
Thanks for your work!
There are a lot of NodeJS modules out there now. It would be impossible for a small group of people to generate wrappers for all of them.
But I was wondering how far we could get with a tool to generate module wrappers automatically.
For example the tool could:
require()
the given moduleA wrapper could then be generated that very simply exposes all the top-level properties we found in the returned module (functions, Strings, numbers or plain objects).
Of course when a function is encountered, we won't know the types of its arguments or return object, so we would have to write Dynamic.
But at least we could get the names of the top-level functions exposed by the library, and make these available to Haxe. This could catch very basic typos at compile time. :)
And it would offer a basic template for anyone wanting to tighten up the interface to the reflect the real types. (Then we just need a package manager so that people can upload their wrappers!)
(Looking further in the future, I think people might want to start consuming all these NodeJS modules in more type-safe languages. I can imagine one day performing static analysis on JS code to work out, where possible, what types are being passed around.)
Seems like your node.js externs is getting updated and improved very fast.
Currently I use this fork:
https://github.com/as3boyan/HIDE/tree/master/libs/nodejs-std
Main repo(https://github.com/dionjwa/nodejs-std) doesn't get updated, so maybe it's a good idea to add some basic externs for node modules(mv, mkdirp, walkdir, watchr) to your repo? I could add it if you like this idea. And node-webkit externs from there, licensed as BSD.
Currently mongoose (4.2.2) does not support multi-dimensional array in schema. So in the model schema macro we should convert them to Mixed
(or [Mixed]
?).
I am also getting this issue:
externs/haxe-js-kit/js/node/ChildProcess.hx:27: characters 1-21 : Class not found : IWritable
When I import ChildProcess
Which is weird
Not sure about the difference.... but I am guessing these lines should use M
instead of Model<T>
, just like findOne
?
I'm having trouble chaining functions/promises using the Bluebird extern. I believe Haxe's type inference engine is failing to deduce the return type of a fulfilledHandler that comes after a fulfilledHandler with a return type of Void.
Here's a small test case that exhibits the problem:
import buddy.BuddySuite;
import js.npm.Bluebird;
using buddy.Should;
class TestBluebird extends BuddySuite {
public function new() {
describe("Testing Bluebird", function () {
it("Allows chaining after a '* -> Void' function", function (done) {
var p = new Bluebird(function (resolve, reject) {
resolve("first value");
}).then(function (firstValue) {
firstValue.should.be("first value");
}).then(function () {
done();
});
});
});
}
}
I think I can work around the issue by returning "null" in one function and accepting a dummy arg in the next, but this is awkward for chaining existing functions together, and problematic for making use of externs or libs.
Hi !
Is this kind of Schema declarations supported ?
var mongoose = require('mongoose');
var UserSchema = new mongoose.Schema({
username: {
type: String,
unique: true,
required: true
},
password: {
type: String,
required: true
}
});
// Export the Mongoose model
module.exports = mongoose.model('User', UserSchema);
If yes, how can we do this ?
If not how could we add this ? :)
Thanks !
Hi !
I need to implement Mongoose discriminators : http://mongoosejs.com/docs/discriminators.html
I believe it's not supported yet by the haxe js kit...
If it's indeed so, what would be the best way to support it so that it supports both ways of declaring schemas (macro and non-macro ways) ?
Thanks
the compiler fails with this error
js-kit/npm/Package.hx:250: characters 25-26 : Unexpected @
line 250
extern interface Require<@:const P,@:const V> {}
context, in npm/Package.hx
@:autoBuild(npm.Include.build())
#if (haxe_ver > 3.2)
extern interface Require<@:const P,@:const V> {}
#else
extern interface Require<Const,Const> {}
#end
@:autoBuild(npm.Include.build())
#if (haxe_ver > 3.2)
extern interface RequireNamespace<@:const P,@:const V> {}
#else
extern interface RequireNamespace<Const,Const> {}
#end
I recently posted this as a stack overflow question, but I guess it's also relevant to the author(s) of this library.
After I posted that question, I read the rest of this repo's README, and it looks like there is a mechanism for including require statements. So I guess I'll look into that. But then my question is: why not just use @:jsRequire("fs")?
As the readme prominently displays: Warning : This is a work in progress and is definitely not stable nor complete !
I kind of disagree. :) I've been using the dev branch for a long time, it's simple and useful, and if I find any problems I submit a PR and it gets accepted quickly.
My plan is to use haxe-js-kit in a large project soon, so I'm curious if there will be a dev -> master merge soon, to stabilize the project? What are the dev/master differences right now, and why?
I was also thinking about a haxelib release, but maybe that depends on the official haxe/node externs?
As I said in #54 I'm happy to set up a Travis environment with the tests, so if that can help I'll start working on that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.