Coder Social home page Coder Social logo

qtjs's Introduction

Qtjs

This is an implementation of some of Qt's core types, ontop of Javascript's core types. This project modifies the prototypes of Array, String, and Object to adhere closer to QList, QString, and QMap. This makes Javascript much easier to work with from inside QML.

But, isn't modifying prototypes bad?

Generally, yes. Modifying the prototypes of the core types is like changing the language's API. Anything you code against it will only work with your changes, and things coded against the default api might break. In practice, I've found that modifying the prototype is acceptible when you're adding a small number of functions you need globally. Still, in general, I don't recommend it.

So why do it? Simple. This is targeted at a bare-bones QML Environment. When writing QML, I don't want to have to fight with Javascript, or change mental gears and use something like lodash. I'd rather use Qt's types, or at the very least, Qt's API.

That's what this is for.

Why not make QList, QString and QMap work-alikes?

Great question. Mostly, because I'm a bit lazy, it's slightly more work, and you'll be wrapping values returned from Qt in these custom types constantly.

I have considered having a version of this library that does exactly that. So the developer can choose which method he'd prefer. That's not what it does currently, but I'm open to it.

Unit tests

First, install node.js. Then, simply:

$ npm install

Once that completes, you can run the unit tests with:

$ npm test

This will run Karma, and try to launch Google Chrome. You can change what browser it launched in the config. Also, I have it set to continuous integration mode, since that's the easiest for me while developing.

License

Licensed under the MIT license. See LICENSE for details.

Inclusion in Qt

One of the goals for this project is to get this code included in Qt, as a nice extra. We'll see how that goes.

qtjs's People

Contributors

morgul avatar

Watchers

 avatar James Cloos avatar  avatar

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.