โ โ โ Have you built a Webflow project with WF Localization? Is it working for you? Slater support for WF Localization has been a common request, so we now support it. If you have a Webflow project with Localization, give it a try. Next, we are exploring how to support code sharing across files. Currently, we are binding functions to the window object, but that solution has some downsides. With the work we are doing on the next version of edgarallan.com, function sharing across files is becoming increasingly important to us. Let's take a look at some new scripts in the community library. Community library scriptsโ๏ธ Bind function to window objectโ ๐ Save data to localStorageโ ๐ Retrieve data from localStorageโ โ -- Javascript 101: Fetch Requests to GreenhouseLast week, we looked at code written by Ben Parker to display Jobs coming from the Greenhouse API. Let's spend more time with his code. Here is the code if you want to review it again. Understanding how to handle network requests and asynchronous operations can be daunting. In this Javascript 101, we will explore Fetch API, Promises, and Error Handling through the Greenhouse Jobs API. Fetch API: The Modern Way to Make RequestsJavaScript's Fetch API is a powerful tool for making network requests. It allows you to request resources from a server, like fetching data from an API. The Fetch API is straightforward to use and returns a promise, making it a great way to handle asynchronous operations. Here we fetch a list of departments from a company's Greenhouse API:
In this function, we use Promises: Managing Asynchronous OperationsPromises are a fundamental concept in JavaScript for handling asynchronous operations. They provide a way to work with values that may not be available yet, like data fetched from a server. A promise can be in one of three states:
When you call
In this example:
Error Handling: Making Your Code RobustError handling is crucial to ensure your code can gracefully handle unexpected situations, like network failures or invalid responses. In our
This error is then caught in the
By throwing an error when the response is not okay, we ensure that our code can handle problems like network issues or server errors appropriately. Understanding the Fetch API, Promises, and Error Handling is essential for working with asynchronous operations in JavaScript. The Fetch API allows you to make network requests easily, promises help manage asynchronous data, and proper error handling ensures your code can handle unexpected situations. By understanding these concepts, you'll be well-equipped to handle more other APIs and share data across services. โ -- Your projects, supported by SlaterLong-time Slater friend, Jeff McAvoy | The Rive Guy, is running a class called Interactive Animation with Rive. Check it out.โ โ Happy coding! ๐ค the Slater Team โ If Slater helps you create better websites, please support the team behind it.
|
Slater resources, updates and community activity
Do you get confused when undoing (cmd + z) in Slater? We auto-format your code on save. The auto-formatting updates your code, and those updates get pushed into the undo stack. You can now improve your workflow by formatting the code when you chooseโnot just on save. To gain more control over when your code formats: Turn off auto-format code in the Code Editor Settings Use cmd + shift + f to format your code We added a handful of other improvements: Console logs and debuggers are now...
Last week, we announced that CSS updates were on the wayโand now they're here! You can now generate CSS files just as quickly and easily as JS files. In the video below, we give a quick demo of the new functionality. If you have a Smart Script loaded in your project, you can instantly add CSS. In the demo, we also show how to add CSS in the Webflow designer. Give it a try and let us know what you're building! Community Library ๐๏ธ Text Highlight ColorCSS code for custom text selection. ๐ ฐ...
Do you use Slater for CSS? CSS support in Slater has always been somewhat of an afterthoughtโJavaScript is our love language! But sometimes, you need a simple way to add CSS to your project. Maybe you want to write a complex grid or use a CSS property that Webflow doesn't support. That's why we've decided to make CSS a first-class citizen. We considered launching the new CSS functionality today, but we want to test it a bit more. Expect it early next week. To prepare for the launch, let's...