Top Ten Corvid Tips

Updated: Jul 27, 2020

Check out these top ten tips as written by Corvid Master Salman.


Tip #1

Use a consistent name

Consistent naming of element ID, variable and function name will improve the readability of the code and easy to re-write the code. A great way to set the name of the element is to write what type of element it is (input, dropdown, checkbox, box or stripe) and their placeholder. This way, when you want to select a dropdown in the code just type in drop and IntelliSense will show all the dropdown elements. Example : 

  • input element to get the first name => inFirstName

  • input element to get the last name => inLastName

  • checkbox to select product names => checkProd

  • box containing form => boxForm


Tip #2

Wait for the dataset to ready

Make sure all the datasets ready, before running the init code. This code is useful if you have more than one dataset.

$w.onReady(function() { 
let dataset1, dataset2, dataset3;     
dataset1 = true;         

dataset2 = true;         

dataset3 = true;         

functionAllDatasetReady() { 
if(dataset1 && dataset2 && dataset3) init();     

functioninit() { 
// all the dataset is ready 

Tip #3

Top three key shortcuts to remember

  • Ctrl + Space  - Open the intellisense 

  • Alt + Up / Alt + down - move the line of code up/down

  • Alt  + Shift + Up / Alt + Shift + down - copy the line of code up/down

More Shortcuts available here.


Tip #4

Step by Step to create a new feature or project

Before you start a project:

  1. Design the database structure Simple pen/note or whiteboard is fine but also if you want there is a number of database design editors online available for free:

  2. Design UI Create all the pages and dynamic pages, drag and drop the element and update the property ID.

  3. Start Writing code After you finish the first two steps it becomes easier to write the code.


Tip #5

Use a Comment

One word comment is more useful, keep the comment as short and precise as possible

// global Variable
let brand = "code queen"; 

// initialize the code    
init(); // event    
// submit the form on "enter" key press
if(e.code === "Enter") {         
// insert the full name before form save
let fullName = e.firstName + e.lastName;         $w('#dataset').setFieldValue("fullName" , fullName);     


Tip #6

Debug using Site events

All the logs, error both in the page and backend will be shown in the live site will update in the site event. To open the Site event:

  1. Go to Dashboards

  2. Click on Setting

  3. Site Monitoring (Under Product tools)

  4. Click on the open button


Tip #7

Using try/catch with async/await

Using try/catch with async/await will help you to write clean, readable and error handling code.

asyncfunctionhandlePayment() { 
try { 
let user =