You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2019/11/28 13:27:09 UTC
[royale-asjs] branch develop updated: Added cacheBust for URLs
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 5f73c37 Added cacheBust for URLs
5f73c37 is described below
commit 5f73c37cf8d5c587e06e1831ab9af48532748341
Author: Harbs <ha...@in-tools.com>
AuthorDate: Thu Nov 28 15:26:53 2019 +0200
Added cacheBust for URLs
---
.../projects/Core/src/main/royale/CoreClasses.as | 1 +
.../org/apache/royale/utils/string/cacheBust.as | 40 ++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 6145af7..1da668b 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -306,6 +306,7 @@ internal class CoreClasses
import org.apache.royale.utils.string.trim; trim;
import org.apache.royale.utils.string.trimRight; trimRight;
import org.apache.royale.utils.string.trimLeft; trimLeft;
+ import org.apache.royale.utils.string.cacheBust; cacheBust;
import org.apache.royale.utils.date.addDays; addDays;
import org.apache.royale.utils.date.addHours; addHours;
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/cacheBust.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/cacheBust.as
new file mode 100644
index 0000000..2935c49
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/string/cacheBust.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.utils.string
+{
+ /**
+ * Converts a url into a version which will be loaded even if it's already cached.
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.7
+ */
+ public function cacheBust(url:String):String
+ {
+ var stamp:String
+ if(url.indexOf("?") < 0)
+ stamp = "?";
+ else
+ stamp = "&";
+
+ stamp += new Date().getTime();
+ return url + stamp;
+ }
+
+}
\ No newline at end of file