Tubo Man

Tubo Man

1560239482

How to build an App with Vue.js

Front-end frameworks like AngularJS allow us to build out very nice single page applications easily, especially when we become well versed with all the concepts.

If all we want to do is implement a few features a single page application, it's can be a bit much to setup the necessary config, routing, controllers, services and more that make up an Angular app.

For something more lightweight, a great solution is Vue.js. Vue is a library that focuses heavily on the ViewModel---the two-way data bindings that tie what we see and interact with on the screen with the application's data model. In this way (and as stated on the Vue.js website), the library is "not a full-blown framework - it is designed to be a view layer that is simple and flexible".

For many use cases this is awesome because it means we can get the benefits of a single page(ish) application without the overhead that can come with using larger frameworks.

In this tutorial we will be building a simple events bulletin board application that will allow users to add and remove events. To explore Vue's main features we will simply be working with local data on the client side, but towards the end we'll see how we can use the vue-resource package to send HTTP requests to a back end.

Similarities to AngularJS

If you're familiar with AngularJS, you'll likely notice a lot of similarities between it and Vue.js as we go. Vue is heavily influenced by Angular and this actually works to our benefit because concepts transfer nicely between the two.

Installing the Dependencies

Let's first grab Vue.js, Vue Resource, and Bootstrap with npm. From the command line:

npm install vue vue-resource bootstrap

We'll also need to create the main files:

touch index.html app.js

Setting Up the HTML

<!-- index.html -->

<!doctype html>
<html>
<head>
<meta charset=“utf-8”>
<title>Vue</title>

<!-- CSS -->
<link rel=“stylesheet” href=“node_modules/bootstrap/dist/css/bootstrap.min.css”>
</head>
<body>

<!-- navigation bar -->
<nav class=“navbar navbar-default”>
<div class=“container-fluid”>
<a class=“navbar-brand”><i class=“glyphicon glyphicon-bullhorn”></i> Vue Events Bulletin Board</a>
</div>
</nav>

<!-- main body of our application -->
<div class=“container” id=“events”>

&lt;!-- add an event form --&gt;
&lt;div class="col-sm-6"&gt;
  &lt;div class="panel panel-default"&gt;
    &lt;div class="panel-heading"&gt;
      &lt;h3&gt;Add an Event&lt;/h3&gt;
    &lt;/div&gt;
    &lt;div class="panel-body"&gt;

    &lt;/div&gt;

  &lt;/div&gt;
&lt;/div&gt;

&lt;!-- show the events --&gt;
&lt;div class="col-sm-6"&gt;
  &lt;div class="list-group"&gt;

  &lt;/div&gt;
&lt;/div&gt;

</div>

<!-- JS -->
<script src=“node_modules/vue/dist/vue.js”></script>
<script src=“node_modules/vue-resource/dist/vue-resource.js”></script>
<script src=“app.js”></script>
</body>
</html>

The main <div> with an ID of events is our target area for the application. As we’ll see in the next section, we need to create a Vue instance for each part of the application that we want to target.

In Angular, we can limit our application modules to certain parts of the HTML with ng-app=“{module}”. Vue works in a similar way. When we set up the Vue instance, we define an element to target and anything within that element will be available to the application.

Creating a Vue Instance

Within app.js, let’s setup a new Vue instance and target theeventssection of the HTML by setting it on the el key.

// app.js

new Vue({
// We want to target the div with an id of ‘events’
el: ‘#events’
});

At this point, Vue is available anywhere within div#events. Before setting up the rest of the HTML, let’s setup the other keys that we’ll need for our Vue instance and cover what they are responsible for.

// app.js

new Vue({

// We want to target the div with an id of ‘events’
el: ‘#events’,

// Here we can register any values or collections that hold data
// for the application
data: {},

// Anything within the ready function will run when the application loads
ready: function() {},

// Methods we want to use in our application are registered here
methods: {}
});

  • The data key will be the object where all our ViewModel data is registered
  • The ready function will run when the application loads and is useful for calling other methods to initialize the app with data
  • The methods key is where we can register custom methods for the application

Adding the Form

Our form will need inputs for the event details. We’ll use the native HTML5 datepicker for selecting the event date. NOTE: This will not work in Firefox.

<!-- index.html -->

<div class=“panel-heading”>
<h3>Add an Event</h3>
</div>
<div class=“panel-body”>

<div class=“form-group”>
<input class=“form-control” placeholder=“Event Name” v-model=“event.name”>
</div>

<div class=“form-group”>
<textarea class=“form-control” placeholder=“Event Description” v-model=“event.description”></textarea>
</div>

<div class=“form-group”>
<input type=“date” class=“form-control” placeholder=“Date” v-model=“event.date”>
</div>

<button class=“btn btn-primary” v-on=“click: addEvent”>Submit</button>

</div>


You’ll notice that we’re adding a directive called v-model to our input and textarea elements and we’re assigning distinct spots on an event object to each. Just like with ng-model in Angular, the values that we type into these fields will be bound to the ViewModel and will be available for use elsewhere in the application.

The submit button element has the v-on directive with a value of “click: addEvent” on it. This works much the same way that ng-click does with Angular: we pass a method to be run on the click event. The difference that Vue introduces is that we can use the v-on directive to specify the type of event we want the element to respond to. For example, we could say v-on=“keyup: addEvent” and the addEvent method would be called when a keystroke is finished.

If we view the app in the browser, we see that we get our form:

Adding Event Data

The addEvent method we added to the click event in the last section is obviously going to be responsible for adding new events in. We’ll add this method in now and also prime the application with some data.

// app.js

data: {
event: { name: ‘’, description: ‘’, date: ‘’ },
events: []
},

// Anything within the ready function will run when the application loads
ready: function() {
// When the application loads, we want to call the method that initializes
// some data
this.fetchEvents();
},

// Methods we want to use in our application are registered here
methods: {

// We dedicate a method to retrieving and setting some data
fetchEvents: function() {
var events = [
{
id: 1,
name: ‘TIFF’,
description: ‘Toronto International Film Festival’,
date: ‘2015-09-10’
},
{
id: 2,
name: ‘The Martian Premiere’,
description: ‘The Martian comes to theatres.’,
date: ‘2015-10-02’
},
{
id: 3,
name: ‘SXSW’,
description: ‘Music, film and interactive festival in Austin, TX.’,
date: ‘2016-03-11’
}
];
// $set is a convenience method provided by Vue that is similar to pushing
// data onto an array
this.$set(‘events’, events);
},

// Adds an event to the existing events array
addEvent: function() {
if(this.event.name) {
this.events.push(this.event);
this.event = { name: ‘’, description: ‘’, date: ‘’ };
}
}
}

On the data key, we are registering both the event object that will hold our form data, as well as an empty events array that will be populated with data when the application loads. If we didn’t pre-initialize the event object by registering it on the data key, we would still get values from our form as expected. However, by initializing it we get “more reliable reactivity and better performance” as a warning message in the console reveals.

Within the ready function we are calling fetchEvents which is a method that takes some data and uses Vue’s $set to put it onto the events array. The $set method is provided by Vue and when used to put data onto an array, triggers a view update. Its first argument needs to be a string with the name of the keypath that we want to target.

Finally, the addEvent method first checks to make sure we at least have a value present for event.name and if so, pushes the event onto the the events array. After this, the form is cleared by setting the event object keys back to empty strings. We’re ready to view existing listings and add new ones, but we’ll need some HTML to display them.

Adding the Listing Area

To list out the events, we’ll need HTML in which we will include some templating.

<!-- index.html -->

<div class=“list-group”>

<a href=“#” class=“list-group-item” v-repeat=“event in events”>
<h4 class=“list-group-item-heading”>
<i class=“glyphicon glyphicon-bullhorn”></i>
{{ event.name }}
</h4>

&lt;h5&gt;
  &lt;i class="glyphicon glyphicon-calendar" v-if="event.date"&gt;&lt;/i&gt; 
  {{ event.date }}
&lt;/h5&gt;

&lt;p class="list-group-item-text" v-if="event.description"&gt;{{ event.description }}&lt;/p&gt;

&lt;button class="btn btn-xs btn-danger" v-on="click: deleteEvent($index)"&gt;Delete&lt;/button&gt;

</a>

</div>


As you can see, we’re using Vue’s v-repeat on the a tag to loop over the events data. As you’re probably thinking, v-repeat works just like Angular’s ng-repeat. Templating works the same way as it does in Angular as well—we use the double curly braces to render data. In this case, we access the namedate, and description values within various elements to display the events data.

The button at the bottom triggers a click event that calls deleteEvent, which we have yet to create. This method accepts Vue’s $index property as an argument. This property gives us the index of the current element within the v-repeat loop and will be used to remove that element once we setup the deleteEvent method.

If we refresh the page, we see that we get the events data displayed and that we can also add in new events.

We’ve already got the button for deleting events set up, lets now create the method that should be called when it is clicked.

// app.js

deleteEvent: function(index) {
if(confirm(“Are you sure you want to delete this event?”)) {
// $remove is a Vue convenience method similar to splice
this.events.$remove(index);
}
}


In this method we are first prompting the user to confirm that they actually want to delete the event. If they click “OK”, the event is removed by using Vue’s $remove convenience method which takes care of finding the index passed in from the view and removing the element from the DOM.

Switching to a Back End

Like AngularJS, Vue is totally agnostic about the back end that we use for our applications. Just as long as the server responds to HTTP requests with JSON, we can use Vue Resource to handle data retrieval.

As previously mentioned, we won’t actually set up a back end in this tutorial, but we will show how to make the appropriate HTTP requests to one. A NodeJS back end would be an easy solution for a Vue app, and you can learn how to set one up with Scotch.io’s Mean Machine eBook (you’ll just need to swap out the Angular stuff for Vue).

The first step would be to move the events data over to the server and set up an endpoint which would take care of serving the events. Ideally we would have an endpoint that would respond to a GET request at something like api/events. We would then change our fetchEvents method up to send the request:

// app.js

// If we had a back end with an events endpoint set up that responds to GET requests
this.$http.get(‘api/events’).success(function(events) {
this.$set(‘events’, events);
}).error(function(error) {
console.log(error);
});


In the success handler of the GET request we are still using $set to put the returned data onto the events array. We could also make POST requests to add data:

// app.js

// If we had an endpoint set up that responds to POST requests
this.$http.post(‘api/events’, this.event).success(function(response) {
this.events.push(this.event);
console.log(“Event added!”);
}).error(function(error) {
console.log(error);
});


In this case we are sending the event object that contains the form data by including it as the second argument to the call. In the success handler, we are pushing the event onto the array to update the view, much like we were before.

Another way we could update the view is by making an additional GET request to retrieve the total list in the success handler, but this requires another network request which isn’t ideal. Deleting an event is simple as well.

// app.js

// We could also delete an event if we had the events endpoint set up to delete data
this.$http.delete(‘api/events/’ + event.id).success(function(response) {
this.events.$remove(index);
}).error(function(error) {
console.log(error);
});


In this case we are tacking the event.id onto the end of the route for our DELETE request which, if our API is setup to do it, will delete the record based on that ID. For this to work we would need to pass event into the method call from the view and then receive it on the deleteEvent method.

Wrapping Up

Vue.js offers us a great alternative to larger frameworks like AngularJS and is a perfect solution for cases in which we want to easily create single page apps without a lot of overhead. The library is flexible and easy to work with and if you have experience with Angular, you’ll feel right at home.

To build a full-fledged single page application with Vue, we can use vue-router which integrates with the Vue.js core to handle routing.

Thank for reading …

Originally published on https://scotch.io


#vue-js

What is GEEK

Buddha Community

How to build an App with Vue.js
Aria Barnes

Aria Barnes

1625232484

Why is Vue JS the most Preferred Choice for Responsive Web Application Development?

For more than two decades, JavaScript has facilitated businesses to develop responsive web applications for their customers. Used both client and server-side, JavaScript enables you to bring dynamics to pages through expanded functionality and real-time modifications.

Did you know!

According to a web development survey 2020, JavaScript is the most used language for the 8th year, with 67.7% of people choosing it. With this came up several javascript frameworks for frontend, backend development, or even testing.

And one such framework is Vue.Js. It is used to build simple projects and can also be advanced to create sophisticated apps using state-of-the-art tools. Beyond that, some other solid reasons give Vuejs a thumbs up for responsive web application development.

Want to know them? Then follow this blog until the end. Through this article, I will describe all the reasons and benefits of Vue js development. So, stay tuned.

Vue.Js - A Brief Introduction

Released in the year 2014 for public use, Vue.Js is an open-source JavaScript framework used to create UIs and single-page applications. It has over 77.4 million likes on Github for creating intuitive web interfaces.

The recent version is Vue.js 2.6, and is the second most preferred framework according to Stack Overflow Developer Survey 2019.

Every Vue.js development company is widely using the framework across the world for responsive web application development. It is centered around the view layer, provides a lot of functionality for the view layer, and builds single-page web applications.

Some most astonishing stats about Vue.Js:

• Vue was ranked #2 in the Front End JavaScript Framework rankings in the State of JS 2019 survey by developers.

• Approximately 427k to 693k sites are built with Vue js, according to Wappalyzer and BuiltWith statistics of June 2020.

• According to the State of JS 2019 survey, 40.5% of JavaScript developers are currently using Vue, while 34.5% have shown keen interest in using it in the future.

• In Stack Overflow's Developer Survey 2020, Vue was ranked the 3rd most popular front-end JavaScript framework.

Why is Vue.Js so popular?

• High-speed run-time performance
• Vue.Js uses a virtual DOM.
• The main focus is on the core library, while the collaborating libraries handle other features such as global state management and routing.
• Vue.JS provides responsive visual components.

Top 7 Reasons to Choose Vue JS for Web Application Development

Vue js development has certain benefits, which will encourage you to use it in your projects. For example, Vue.js is similar to Angular and React in many aspects, and it continues to enjoy increasing popularity compared to other frameworks.

The framework is only 20 kilobytes in size, making it easy for you to download files instantly. Vue.js easily beats other frameworks when it comes to loading times and usage.

Take a look at the compelling advantages of using Vue.Js for web app development.

#1 Simple Integration

Vue.Js is popular because it allows you to integrate Vue.js into other frameworks such as React, enabling you to customize the project as per your needs and requirements.

It helps you build apps with Vue.js from scratch and introduce Vue.js elements into their existing apps. Due to its ease of integration, Vue.js is becoming a popular choice for web development as it can be used with various existing web applications.

You can feel free to include Vue.js CDN and start using it. Most third-party Vue components and libraries are additionally accessible and supported with the Vue.js CDN.

You don't need to set up node and npm to start using Vue.js. This implies that it helps develop new web applications, just like modifying previous applications.

The diversity of components allows you to create different types of web applications and replace existing frameworks. In addition, you can also choose to hire Vue js developers to use the technology to experiment with many other JavaScript applications.

#2 Easy to Understand

One of the main reasons for the growing popularity of Vue.Js is that the framework is straightforward to understand for individuals. This means that you can easily add Vue.Js to your web projects.

Also, Vue.Js has a well-defined architecture for storing your data with life-cycle and custom methods. Vue.Js also provides additional features such as watchers, directives, and computed properties, making it extremely easy to build modern apps and web applications with ease.

Another significant advantage of using the Vue.Js framework is that it makes it easy to build small and large-scale web applications in the shortest amount of time.

#3 Well-defined Ecosystem

The VueJS ecosystem is vibrant and well-defined, allowing Vue.Js development company to switch users to VueJS over other frameworks for web app development.

Without spending hours, you can easily find solutions to your problems. Furthermore, VueJs lets you choose only the building blocks you need.

Although the main focus of Vue is the view layer, with the help of Vue Router, Vue Test Utils, Vuex, and Vue CLI, you can find solutions and recommendations for frequently occurring problems.

The problems fall into these categories, and hence it becomes easy for programmers to get started with coding right away and not waste time figuring out how to use these tools.

The Vue ecosystem is easy to customize and scales between a library and a framework. Compared to other frameworks, its development speed is excellent, and it can also integrate different projects. This is the reason why most website development companies also prefer the Vue.Js ecosystem over others.

#4 Flexibility

Another benefit of going with Vue.Js for web app development needs is flexibility. Vue.Js provides an excellent level of flexibility. And makes it easier for web app development companies to write their templates in HTML, JavaScript, or pure JavaScript using virtual nodes.

Another significant benefit of using Vue.Js is that it makes it easier for developers to work with tools like templating engines, CSS preprocessors, and type checking tools like TypeScript.

#5 Two-Way Communication

Vue.Js is an excellent option for you because it encourages two-way communication. This has become possible with the MVVM architecture to handle HTML blocks. In this way, Vue.Js is very similar to Angular.Js, making it easier to handle HTML blocks as well.

With Vue.Js, two-way data binding is straightforward. This means that any changes made by the developer to the UI are passed to the data, and the changes made to the data are reflected in the UI.

This is also one reason why Vue.Js is also known as reactive because it can react to changes made to the data. This sets it apart from other libraries such as React.Js, which are designed to support only one-way communication.

#6 Detailed Documentation

One essential thing is well-defined documentation that helps you understand the required mechanism and build your application with ease. It shows all the options offered by the framework and related best practice examples.

Vue has excellent docs, and its API references are one of the best in the industry. They are well written, clear, and accessible in dealing with everything you need to know to build a Vue application.

Besides, the documentation at Vue.js is constantly improved and updated. It also includes a simple introductory guide and an excellent overview of the API. Perhaps, this is one of the most detailed documentation available for this type of language.

#7 Large Community Support

Support for the platform is impressive. In 2018, support continued to impress as every question was answered diligently. Over 6,200 problems were solved with an average resolution time of just six hours.

To support the community, there are frequent release cycles of updated information. Furthermore, the community continues to grow and develop with backend support from developers.



Wrapping Up

VueJS is an incredible choice for responsive web app development. Since it is lightweight and user-friendly, it builds a fast and integrated web application. The capabilities and potential of VueJS for web app development are extensive.

While Vuejs is simple to get started with, using it to build scalable web apps requires professionalism. Hence, you can approach a top Vue js development company in India to develop high-performing web apps.

Equipped with all the above features, it doesn't matter whether you want to build a small concept app or a full-fledged web app; Vue.Js is the most performant you can rely on.

Original source

 

#vue js development company #vue js development company in india #vue js development company india #vue js development services #vue js development #vue js development companies

Top VueJS App Development Company in USA

AppClues Infotech is the best & most reliable VueJS App Development Company in USA that builds high-quality and top-notch mobile apps with advanced methodology. The company is focused on providing innovative & technology-oriented solutions as per your specific business needs.

The organization’s VueJS developers have high experience and we have the capability of handling small to big projects. Being one of the leading mobile app development company in USA we are using the latest programming languages and technologies for their clients.

Key Elements:

· Total year of experience - 8+

· Employees Strength - 120+

· Hourly Rate - $25 – $45 / hr

· Location - New York, USA

· Successfully launched projects - 450+

VueJS Development Services by AppClues Infotech

· Custom VueJS Development

· Portal Development Solutions

· Web Application Development

· VueJS Plugin Development

· VueJS Ecommerce Development

· SPA (Single Page App) Development

· VueJS Migration

Why Hire VueJS Developers from AppClues Infotech?

· Agile & Adaptive Development

· 8+ Years of Average Experience

· 100% Transparency

· Guaranteed Bug-free VueJS Solution

· Flexible Engagement Models

· On-Time Project Delivery

· Immediate Technical Support

If you have any project ideas for VueJS app development then share your requirements with AppClues Infotech to get the best solution for your dream projects.

For more info:
Share Yoru Requirements: https://www.appcluesinfotech.com/contact-us/
Email: info@appcluesinfotech.com
Call: +1-978-309-9910
**

#top vue.js development company #vue.js app development company #best vue js development company #hire top vue js developers #hire top vue.js developers in usa #vue js development company usa

NBB: Ad-hoc CLJS Scripting on Node.js

Nbb

Not babashka. Node.js babashka!?

Ad-hoc CLJS scripting on Node.js.

Status

Experimental. Please report issues here.

Goals and features

Nbb's main goal is to make it easy to get started with ad hoc CLJS scripting on Node.js.

Additional goals and features are:

  • Fast startup without relying on a custom version of Node.js.
  • Small artifact (current size is around 1.2MB).
  • First class macros.
  • Support building small TUI apps using Reagent.
  • Complement babashka with libraries from the Node.js ecosystem.

Requirements

Nbb requires Node.js v12 or newer.

How does this tool work?

CLJS code is evaluated through SCI, the same interpreter that powers babashka. Because SCI works with advanced compilation, the bundle size, especially when combined with other dependencies, is smaller than what you get with self-hosted CLJS. That makes startup faster. The trade-off is that execution is less performant and that only a subset of CLJS is available (e.g. no deftype, yet).

Usage

Install nbb from NPM:

$ npm install nbb -g

Omit -g for a local install.

Try out an expression:

$ nbb -e '(+ 1 2 3)'
6

And then install some other NPM libraries to use in the script. E.g.:

$ npm install csv-parse shelljs zx

Create a script which uses the NPM libraries:

(ns script
  (:require ["csv-parse/lib/sync$default" :as csv-parse]
            ["fs" :as fs]
            ["path" :as path]
            ["shelljs$default" :as sh]
            ["term-size$default" :as term-size]
            ["zx$default" :as zx]
            ["zx$fs" :as zxfs]
            [nbb.core :refer [*file*]]))

(prn (path/resolve "."))

(prn (term-size))

(println (count (str (fs/readFileSync *file*))))

(prn (sh/ls "."))

(prn (csv-parse "foo,bar"))

(prn (zxfs/existsSync *file*))

(zx/$ #js ["ls"])

Call the script:

$ nbb script.cljs
"/private/tmp/test-script"
#js {:columns 216, :rows 47}
510
#js ["node_modules" "package-lock.json" "package.json" "script.cljs"]
#js [#js ["foo" "bar"]]
true
$ ls
node_modules
package-lock.json
package.json
script.cljs

Macros

Nbb has first class support for macros: you can define them right inside your .cljs file, like you are used to from JVM Clojure. Consider the plet macro to make working with promises more palatable:

(defmacro plet
  [bindings & body]
  (let [binding-pairs (reverse (partition 2 bindings))
        body (cons 'do body)]
    (reduce (fn [body [sym expr]]
              (let [expr (list '.resolve 'js/Promise expr)]
                (list '.then expr (list 'clojure.core/fn (vector sym)
                                        body))))
            body
            binding-pairs)))

Using this macro we can look async code more like sync code. Consider this puppeteer example:

(-> (.launch puppeteer)
      (.then (fn [browser]
               (-> (.newPage browser)
                   (.then (fn [page]
                            (-> (.goto page "https://clojure.org")
                                (.then #(.screenshot page #js{:path "screenshot.png"}))
                                (.catch #(js/console.log %))
                                (.then #(.close browser)))))))))

Using plet this becomes:

(plet [browser (.launch puppeteer)
       page (.newPage browser)
       _ (.goto page "https://clojure.org")
       _ (-> (.screenshot page #js{:path "screenshot.png"})
             (.catch #(js/console.log %)))]
      (.close browser))

See the puppeteer example for the full code.

Since v0.0.36, nbb includes promesa which is a library to deal with promises. The above plet macro is similar to promesa.core/let.

Startup time

$ time nbb -e '(+ 1 2 3)'
6
nbb -e '(+ 1 2 3)'   0.17s  user 0.02s system 109% cpu 0.168 total

The baseline startup time for a script is about 170ms seconds on my laptop. When invoked via npx this adds another 300ms or so, so for faster startup, either use a globally installed nbb or use $(npm bin)/nbb script.cljs to bypass npx.

Dependencies

NPM dependencies

Nbb does not depend on any NPM dependencies. All NPM libraries loaded by a script are resolved relative to that script. When using the Reagent module, React is resolved in the same way as any other NPM library.

Classpath

To load .cljs files from local paths or dependencies, you can use the --classpath argument. The current dir is added to the classpath automatically. So if there is a file foo/bar.cljs relative to your current dir, then you can load it via (:require [foo.bar :as fb]). Note that nbb uses the same naming conventions for namespaces and directories as other Clojure tools: foo-bar in the namespace name becomes foo_bar in the directory name.

To load dependencies from the Clojure ecosystem, you can use the Clojure CLI or babashka to download them and produce a classpath:

$ classpath="$(clojure -A:nbb -Spath -Sdeps '{:aliases {:nbb {:replace-deps {com.github.seancorfield/honeysql {:git/tag "v2.0.0-rc5" :git/sha "01c3a55"}}}}}')"

and then feed it to the --classpath argument:

$ nbb --classpath "$classpath" -e "(require '[honey.sql :as sql]) (sql/format {:select :foo :from :bar :where [:= :baz 2]})"
["SELECT foo FROM bar WHERE baz = ?" 2]

Currently nbb only reads from directories, not jar files, so you are encouraged to use git libs. Support for .jar files will be added later.

Current file

The name of the file that is currently being executed is available via nbb.core/*file* or on the metadata of vars:

(ns foo
  (:require [nbb.core :refer [*file*]]))

(prn *file*) ;; "/private/tmp/foo.cljs"

(defn f [])
(prn (:file (meta #'f))) ;; "/private/tmp/foo.cljs"

Reagent

Nbb includes reagent.core which will be lazily loaded when required. You can use this together with ink to create a TUI application:

$ npm install ink

ink-demo.cljs:

(ns ink-demo
  (:require ["ink" :refer [render Text]]
            [reagent.core :as r]))

(defonce state (r/atom 0))

(doseq [n (range 1 11)]
  (js/setTimeout #(swap! state inc) (* n 500)))

(defn hello []
  [:> Text {:color "green"} "Hello, world! " @state])

(render (r/as-element [hello]))

Promesa

Working with callbacks and promises can become tedious. Since nbb v0.0.36 the promesa.core namespace is included with the let and do! macros. An example:

(ns prom
  (:require [promesa.core :as p]))

(defn sleep [ms]
  (js/Promise.
   (fn [resolve _]
     (js/setTimeout resolve ms))))

(defn do-stuff
  []
  (p/do!
   (println "Doing stuff which takes a while")
   (sleep 1000)
   1))

(p/let [a (do-stuff)
        b (inc a)
        c (do-stuff)
        d (+ b c)]
  (prn d))
$ nbb prom.cljs
Doing stuff which takes a while
Doing stuff which takes a while
3

Also see API docs.

Js-interop

Since nbb v0.0.75 applied-science/js-interop is available:

(ns example
  (:require [applied-science.js-interop :as j]))

(def o (j/lit {:a 1 :b 2 :c {:d 1}}))

(prn (j/select-keys o [:a :b])) ;; #js {:a 1, :b 2}
(prn (j/get-in o [:c :d])) ;; 1

Most of this library is supported in nbb, except the following:

  • destructuring using :syms
  • property access using .-x notation. In nbb, you must use keywords.

See the example of what is currently supported.

Examples

See the examples directory for small examples.

Also check out these projects built with nbb:

API

See API documentation.

Migrating to shadow-cljs

See this gist on how to convert an nbb script or project to shadow-cljs.

Build

Prequisites:

  • babashka >= 0.4.0
  • Clojure CLI >= 1.10.3.933
  • Node.js 16.5.0 (lower version may work, but this is the one I used to build)

To build:

  • Clone and cd into this repo
  • bb release

Run bb tasks for more project-related tasks.

Download Details:
Author: borkdude
Download Link: Download The Source Code
Official Website: https://github.com/borkdude/nbb 
License: EPL-1.0

#node #javascript

Fredy  Larson

Fredy Larson

1595059664

How long does it take to develop/build an app?

With more of us using smartphones, the popularity of mobile applications has exploded. In the digital era, the number of people looking for products and services online is growing rapidly. Smartphone owners look for mobile applications that give them quick access to companies’ products and services. As a result, mobile apps provide customers with a lot of benefits in just one device.

Likewise, companies use mobile apps to increase customer loyalty and improve their services. Mobile Developers are in high demand as companies use apps not only to create brand awareness but also to gather information. For that reason, mobile apps are used as tools to collect valuable data from customers to help companies improve their offer.

There are many types of mobile applications, each with its own advantages. For example, native apps perform better, while web apps don’t need to be customized for the platform or operating system (OS). Likewise, hybrid apps provide users with comfortable user experience. However, you may be wondering how long it takes to develop an app.

To give you an idea of how long the app development process takes, here’s a short guide.

App Idea & Research

app-idea-research

_Average time spent: two to five weeks _

This is the initial stage and a crucial step in setting the project in the right direction. In this stage, you brainstorm ideas and select the best one. Apart from that, you’ll need to do some research to see if your idea is viable. Remember that coming up with an idea is easy; the hard part is to make it a reality.

All your ideas may seem viable, but you still have to run some tests to keep it as real as possible. For that reason, when Web Developers are building a web app, they analyze the available ideas to see which one is the best match for the targeted audience.

Targeting the right audience is crucial when you are developing an app. It saves time when shaping the app in the right direction as you have a clear set of objectives. Likewise, analyzing how the app affects the market is essential. During the research process, App Developers must gather information about potential competitors and threats. This helps the app owners develop strategies to tackle difficulties that come up after the launch.

The research process can take several weeks, but it determines how successful your app can be. For that reason, you must take your time to know all the weaknesses and strengths of the competitors, possible app strategies, and targeted audience.

The outcomes of this stage are app prototypes and the minimum feasible product.

#android app #frontend #ios app #minimum viable product (mvp) #mobile app development #web development #android app development #app development #app development for ios and android #app development process #ios and android app development #ios app development #stages in app development

Luna  Mosciski

Luna Mosciski

1600583123

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework.

Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

This framework was created by Evan You and still it is maintained by his private team members. Vue is of course an open-source framework which is based on MVVM concept (Model-view view-Model) and used extensively in building sublime user-interfaces and also considered a prime choice for developing single-page heavy applications.

Released in February 2014, Vue JS has gained 64,828 stars on Github, making it very popular in recent times.

Evan used Angular JS on many operations while working for Google and integrated many features in Vue to cover the flaws of Angular.

“I figured, what if I could just extract the part that I really liked about Angular and build something really lightweight." - Evan You

#vuejs #vue #vue-with-laravel #vue-top-story #vue-3 #build-vue-frontend #vue-in-laravel #vue.js