Vertically Flip a Text Canvas Using Fabric.js

Shubham Vora
Updated on 28-Feb-2023 16:41:29

829 Views

There are two simple ways to flip a text canvas using Fabric.js vertically. You can use scaleY property or flipY property. The scaleY property determines how much the object should be scaled along the vertical axis. While the flipY property is a boolean property that defines the vertical flip state of an object. Fabric.js is a powerful and flexible JavaScript library that makes it easy to work with HTML5 canvas. It provides an object model that allows you to create, manipulate, and render graphics, images, and text on a canvas. Fabric.js abstracts away the complexities of the HTML5 canvas ... Read More

Create Previous and Next Buttons in JavaScript

Shubham Vora
Updated on 28-Feb-2023 16:39:53

7K+ Views

There are many ways to create previous and next button and non-working on-end positions using JavaScript. We will cover two approaches to achieve this functionality - one using normal if conditions and the other using the "disabled" attribute. The second approach utilizes the "disabled" attribute to make the button not clickable and updates the button style for nonworking end positions. By implementing these techniques, we can easily navigate through a set of elements, making the user experience more seamless and intuitive. Let’s see both methods with examples for creating this kind of button in JavaScript. Using only if conditions ... Read More

Create Your Own AJAX Functionality

Shubham Vora
Updated on 28-Feb-2023 16:38:20

355 Views

An Ajax (Asynchronous JavaScript and XML) request is an HTTP request made using JavaScript, typically with the XMLHttpRequest object, to exchange data with a server and update a specific part of a web page without requiring full page refresh. There are two ways to create own Ajax functionality. You can use JSONPlaceholder API or your own file. We will discuss these two ways in detail in this tutorial. Using JSONPlaceholder API JSONPlaceholder is a free online REST API that you can use to test and practice your development skills Syntax Users can follow the below syntax for creating an ... Read More

Show Page Loading Div Until Page Completes Loading

Shubham Vora
Updated on 28-Feb-2023 16:36:29

12K+ Views

Rather than showing the whole white or black screen while loading the page, it is better to show the loading indicator, which also improves the UX of the application. Nowadays, there are some libraries available to show loading indicators. However, we can use HTML and CSS to create a customized loading indicator div. In this tutorial, we will use HTML, CSS, and JavaScript to show page loading div until the page has finished loading Use the onreadystatechange event to show the loading indicator while loading the page In JavaScript, the onreadystatechange event triggers whenever the state of the web ... Read More

Serialize Cookie Name-Value Pair into Set-Cookie Header String in JavaScript

Shubham Vora
Updated on 28-Feb-2023 16:34:55

977 Views

The cookie allows us to store users’ data in the web browser for quick response. For example, when a user opens the profile page in any web application, the web page receives the data from the server. The server also sends the cookies containing the data to store in the web browser. When a user goes on the profile page again, it fetches the data from the cookie rather than fetching it from the server to load the webpage quickly. To get data browser looks in the cookie first, and if it doesn’t find data stored in the cookie, it ... Read More

What is the Some Keyword in SwiftUI

Nitin Aggarwal
Updated on 28-Feb-2023 13:27:08

1K+ Views

The "some" keyword in SwiftUI is used to indicate that a type conforms with a protocol, but the exact conformance is not specified. The AnyView type, a type-erased view that can represent any view conforming to the View protocol, is commonly used in association with it. SwiftUI defines some View as a type that, without identifying the specific view type, can represent any view that complies with the View protocol. This enables more generalized and adaptable code. In other words, some keyword is used to declare Opaque types. In the Swift 5.1 version, this is introduced with the support of ... Read More

Open Keyword in Swift

Nitin Aggarwal
Updated on 28-Feb-2023 13:25:35

2K+ Views

In swift, we have three keywords - Open, Public, and Final keyword. All these three words have different properties that help us understand whether the code can be extended to another module or not making the code easy to reuse. We will learn about the keywords' properties in this article.Example  Here's an example of how the open keyword is used in a class definition import Foundation open class Person { var firstName: String? var lastName: String? var age: Int? var address: String? } class Student: Person ... Read More

What is a Deinitializer and How to Write It in Swift

Nitin Aggarwal
Updated on 28-Feb-2023 13:21:42

263 Views

In this article, you will learn how and why to use a de-initializer in the Swift language. You will learn the concept of de-initializing using some examples. When a class instance is no longer required, Swift automatically calls a specific method called a deinitializer. It is utilized to carry out any necessary cleanup prior to deallocating an item from memory. The "deinit" keyword is used to create a deinitializer, which has no parameters or output.Syntax  Here is the basic syntax of a de-initializer in Swift class ClassName { // Other properties and methods ... Read More

What is a Completion Handler in Swift

Nitin Aggarwal
Updated on 28-Feb-2023 13:19:10

15K+ Views

In swift, the completion handler is a block of code that is used to perform and handle the completion state of a task. For example, completion handlers are very commonly used in network requests using URLSession class. Basically, the completion handler is passed as a function argument and called when the task is completed. It does not impact whether the task is completed successfully or not. You can use the completion handler to perform different actions in your iOS applications. There are some common practices to implement the completion handler such as returning status after cleaning up the unused resources ... Read More

What Does init Do in Swift

Nitin Aggarwal
Updated on 28-Feb-2023 13:17:33

634 Views

The init() method in Swift is used to initialize the objects of a class. When an object is created using the function Object() { [native code] } of the class, it is automatically called and establishes the object's initial state. To offer customized initialization behavior, such as establishing default values for properties or carrying out other setup chores, the init() method can be changed. Without returning any values, the function is sometimes used to initialize objects with some values. The class's designated initializer, the init() method, should be used to create objects of that class. Here is an example of ... Read More

Advertisements