Your Choice JavaScript News

TypeScript News Friday, March 16 Model simple choices, Types, Progressive web app & more…

TypeScript News TLDR / Table of Contents

  • TypeScript 2.8 introduces a new construct called conditional types.
  • For example, we could have written as follows: – – Similarly, we could write helper functions to get returned types of function types: – – One last thing to note is that conditional types distribute if the type being checked is a type parameter that ends up being instantiated with…
  • So for example, in the following example, has the type : – – For convenience, TypeScript 2.8 provides several new type aliases in that use conditional types: – – TypeScript now supports a pragma comment for specifying the source of a JSX factory within any file.
  • Similarly, TypeScript now provides a new type in that removes optionality from each property: – – Currently, when TypeScript uses JSX, it looks up a global namespace to look up certain types (e.g. whats the type of a JSX component?)
  • For example, if your JSX factory is , TypeScript will try to first resolve , and then resolve within the current scope.

Tags: model simple choices, types, single JavaScript function, React-like element factory, respective factory function

  • In the part 2, we use Firebase as a database but Firebase also offers a free storage service!
  • Go to the firebase interface storage tab rules and update the rules to make the storage public.
  • This manipulation is only good for prototyping, to secure the storage, use the firebase auth.You remenber the firebase service?
  • We will add an new line to this service to export the storage service from firebaseWe can now import this service in our components to access to our firebase storage.Ok lets try to upload a picture, you should see your picture in your firebase console.Add the picture to thelistAfter the…
  • We learned:how to use MediaStream to access to the native camera;how to store picture in Firebase with VueFire;Lets have a look to our Progressive Web App checklist:One of our last requirements is not yet met.

Tags: progressive web app, firebase console, firebase storage, firebase service, firebase auth

  • Replace the content of the up method with the following below: – public function up() – { – Schema::create(‘photos’, function (Blueprint $table) { – $table-increments(‘id’); – $table-timestamps(); – }); – }This will create the photos table when the migrations are run using the artisan command.
  • php – namespace App; – – use Photo extends Model – { – protected $with = [‘comments’]; – – protected $fillable = [‘url’, ‘image’]; – – public function comments() – { – return } – }In the above, we have added the fillable property which stops us from having mass…
  • php – namespace App; – – use PhotoComment extends Model – { – protected $fillable = [‘photo_id’, ‘comment’, ‘top’, ‘left’]; – – protected $appends = [‘position’]; – – public function getPositionAttribute() – { – return [ – ‘top’ = $this-attributes[‘top’], – ‘left’ = $this-attributes[‘left’] – ]; – } – }Just…
  • css’) }} – /head – body – div id=app – div class=flex-center position-ref full-height – div class=content – uploadarea/uploadarea – /div – /div – /div – script is a simple HTML document, and if you look closely, you will see a reference to an uploadarea tag which does not exist…
  • hotspot-point { – z-index: 2; – position: absolute; – display: block; – span { – position: relative; – display: flex; – justify-content: center; – align-items: center; – width: 1.8em; – height: 1.8em; – background: #cf00f1; – border-radius: 50%; – animation: pulse 3s ease infinite; – transition: background .3s; – box-shadow:…

Tags: public function, Vue component, div class=, prototype feedback app, php artisan make