1
0
Fork 0
mirror of synced 2024-06-21 11:51:00 +12:00
This commit is contained in:
Andrew Kingston 2021-03-16 09:28:58 +00:00
parent cee0decfcc
commit 5da828a11c
2 changed files with 19 additions and 17 deletions

View file

@ -1,38 +1,42 @@
<script>
import { createEventDispatcher } from 'svelte'
import { createEventDispatcher } from "svelte"
import Colorpicker from "@budibase/colorpicker"
const dispatch = createEventDispatcher();
const dispatch = createEventDispatcher()
export let value
const WAIT = 150;
const WAIT = 150
function throttle(callback, wait, immediate = false) {
let timeout = null
let timeout = null
let initialCall = true
return function() {
const callNow = immediate && initialCall
const next = () => {
callback.apply(this, arguments)
timeout = null
}
if (callNow) {
if (callNow) {
initialCall = false
next()
}
if (!timeout) {
timeout = setTimeout(next, wait)
}
}
}
const onChange = throttle(e => {
dispatch('change', e.detail)
}, WAIT, true)
const onChange = throttle(
e => {
dispatch("change", e.detail)
},
WAIT,
true
)
</script>
<Colorpicker value={value || '#C4C4C4'} on:change={onChange} />

View file

@ -5,8 +5,6 @@ const { resolve, join } = require("../../../utilities/centralPath")
const fetch = require("node-fetch")
const fs = require("fs-extra")
const uuid = require("uuid")
const AWS = require("aws-sdk")
const { prepareUpload } = require("../deploy/utils")
const { processString } = require("@budibase/string-templates")
const {
budibaseAppsDir,