summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/epoch/src/adapters/zepto.coffee
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit129b974b59c74140570847bb4a2774d41d1e5fae (patch)
treef2dc68e7186b8157e33aebbc2526e016912ded82 /debian/missing-sources/epoch/src/adapters/zepto.coffee
parentAdding upstream version 3.2.1. (diff)
downloadknot-resolver-129b974b59c74140570847bb4a2774d41d1e5fae.tar.xz
knot-resolver-129b974b59c74140570847bb4a2774d41d1e5fae.zip
Adding debian version 3.2.1-3.debian/3.2.1-3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/epoch/src/adapters/zepto.coffee')
-rw-r--r--debian/missing-sources/epoch/src/adapters/zepto.coffee27
1 files changed, 27 insertions, 0 deletions
diff --git a/debian/missing-sources/epoch/src/adapters/zepto.coffee b/debian/missing-sources/epoch/src/adapters/zepto.coffee
new file mode 100644
index 0000000..81153dc
--- /dev/null
+++ b/debian/missing-sources/epoch/src/adapters/zepto.coffee
@@ -0,0 +1,27 @@
+zeptoModule = ($) ->
+ # For mapping charts to selected elements
+ DATA_NAME = 'epoch-chart'
+ chartMap = {}
+ chartId = 0
+ next_cid = -> "#{DATA_NAME}-#{++chartId}"
+
+ # Adds an Epoch chart of the given type to the referenced element.
+ # @param [Object] options Options for the chart.
+ # @option options [String] type The type of chart to append to the referenced element.
+ # @return [Object] The chart instance that was associated with the containing element.
+ $.extend $.fn,
+ epoch: (options) ->
+ return chartMap[cid] if (cid = @data(DATA_NAME))?
+ options.el = @get(0)
+
+ klass = Epoch._typeMap[options.type]
+ unless klass?
+ Epoch.exception "Unknown chart type '#{options.type}'"
+
+ @data DATA_NAME, (cid = next_cid())
+ chart = new klass options
+ chartMap[cid] = chart
+
+ return chart
+
+zeptoModule(Zepto) if window.Zepto?