If you have to extend an existing object with additional property, always prefer Vue.set()
over Object.assign()
(or spread operator).
Example below explains implications for different implementations.
//settings.json.config file | |
//... Rest of file | |
"emeraldwalk.runonsave": { | |
"commands": [ | |
{ | |
"match": "\\.pug$", | |
"cmd": "pug ./ --doctype html --pretty" | |
}, | |
{ |
// MIT Licensed | |
// Author: jwilson8767 | |
/** | |
* Waits for an element satisfying selector to exist, then resolves promise with the element. | |
* Useful for resolving race conditions. | |
* | |
* @param selector | |
* @returns {Promise} | |
*/ |
// we have an array of objects, we want to remove one object using only the id property | |
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}]; | |
// get index of object with id of 37 | |
const removeIndex = apps.findIndex( item => item.id === 37 ); | |
// remove object | |
apps.splice( removeIndex, 1 ); | |
/******************************************************************************************************************** | |
Countdown.js is a simple script to add a countdown timer | |
for your website. Currently it can only do full minutes | |
and partial minutes aren't supported. This script is a fork of http://jsfiddle.net/HRrYG/ with some | |
added extensions. Since the original code that I forked was released under Creative Commons by SA license, | |
I have to release this code under the same license. You can view a live demo of this code at http://jsfiddle.net/JmrQE/2/. | |
********************************************************************************************************************/ | |
function countdown(minutes) { | |
var seconds = 60; | |
var mins = minutes |
A MultiWidget is a widget that contains more than one widget and bundles it into one. Sometimes you require two or more inputs from the user where the data is not mutually exclusive. For example the expiry date on a credit card or a phone number with the area code.
This blog post will show and explain how to create a MultiWidget for an expiry date that accepts a month and a year.
Creating a MultiWidget is similar to creating a custom Widget. Here is the code for an expiry date multiwidget that accepts two values the month and year that a credit card expires.
{ | |
"USD": { | |
"symbol": "$", | |
"name": "US Dollar", | |
"symbol_native": "$", | |
"decimal_digits": 2, | |
"rounding": 0, | |
"code": "USD", | |
"name_plural": "US dollars" | |
}, |