Forráskód Böngészése

Add ts-events library

Danilo Bargen 8 éve
szülő
commit
248c1e2f89
5 módosított fájl, 36 hozzáadás és 11 törlés
  1. 11 1
      LICENSE-3RD-PARTY.txt
  2. 1 0
      gather-licenses.sh
  3. 15 10
      npm-shrinkwrap.json
  4. 1 0
      package.json
  5. 8 0
      src/app.ts

+ 11 - 1
LICENSE-3RD-PARTY.txt

@@ -707,7 +707,7 @@ License for saltyrtc-client
 
 The MIT License (MIT)
 
-Copyright (c) 2016 Threema GmbH
+Copyright (c) 2016-2017 Threema GmbH
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
@@ -759,6 +759,16 @@ SOFTWARE.
 
 
 
+----------
+License for ts-events
+----------
+
+Copyright (c) 2015, Rogier Schouten <github@workingcode.ninja>
+Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+
 ----------
 License for tsify
 ----------

+ 1 - 0
gather-licenses.sh

@@ -29,6 +29,7 @@ LICENSE_FILES=(
     'node-sass' 'node_modules/node-sass/LICENSE'
     'saltyrtc-client' 'node_modules/saltyrtc-client/LICENSE.md'
     'saltyrtc-task-webrtc' 'node_modules/saltyrtc-task-webrtc/LICENSE.md'
+    'ts-events' 'node_modules/ts-events/LICENSE'
     'tsify' '.licenses/tsify'
     'tweetnacl' 'node_modules/tweetnacl/LICENSE'
     'typescript' 'node_modules/typescript/LICENSE.txt'

+ 15 - 10
npm-shrinkwrap.json

@@ -52,11 +52,6 @@
       "from": "@types/webrtc@>=0.0.21 <0.1.0",
       "resolved": "https://registry.npmjs.org/@types/webrtc/-/webrtc-0.0.21.tgz"
     },
-    "JSONStream": {
-      "version": "1.3.0",
-      "from": "JSONStream@>=1.0.3 <2.0.0",
-      "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.0.tgz"
-    },
     "abbrev": {
       "version": "1.0.9",
       "from": "abbrev@>=1.0.0 <2.0.0",
@@ -2274,6 +2269,11 @@
       "from": "jsonpointer@>=4.0.0 <5.0.0",
       "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz"
     },
+    "JSONStream": {
+      "version": "1.3.0",
+      "from": "JSONStream@>=1.0.3 <2.0.0",
+      "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.0.tgz"
+    },
     "jsprim": {
       "version": "1.3.1",
       "from": "jsprim@>=1.2.2 <2.0.0",
@@ -3741,16 +3741,16 @@
         }
       }
     },
-    "string-width": {
-      "version": "1.0.2",
-      "from": "string-width@>=1.0.1 <2.0.0",
-      "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz"
-    },
     "string_decoder": {
       "version": "0.10.31",
       "from": "string_decoder@>=0.10.0 <0.11.0",
       "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
     },
+    "string-width": {
+      "version": "1.0.2",
+      "from": "string-width@>=1.0.1 <2.0.0",
+      "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz"
+    },
     "stringstream": {
       "version": "0.0.5",
       "from": "stringstream@>=0.0.4 <0.1.0",
@@ -3925,6 +3925,11 @@
       "from": "trim-newlines@>=1.0.0 <2.0.0",
       "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz"
     },
+    "ts-events": {
+      "version": "3.1.5",
+      "from": "ts-events@latest",
+      "resolved": "https://registry.npmjs.org/ts-events/-/ts-events-3.1.5.tgz"
+    },
     "tsconfig": {
       "version": "5.0.3",
       "from": "tsconfig@>=5.0.3 <6.0.0",

+ 1 - 0
package.json

@@ -60,6 +60,7 @@
     "saltyrtc-client": "~0.9.1",
     "saltyrtc-task-webrtc": "~0.9.1",
     "sdp": "~1.3.0",
+    "ts-events": "^3.1.5",
     "tsify": "~2.0.1",
     "tweetnacl": "~0.14.4",
     "typescript": "~2.1.0",

+ 8 - 0
src/app.ts

@@ -17,6 +17,8 @@
  * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
  */
 
+import {AsyncEvent} from 'ts-events';
+
 import config from './config';
 import './controllers';
 import './directives';
@@ -26,6 +28,12 @@ import './partials/welcome';
 import './services';
 import './threema/container';
 
+// Configure asynchronous events
+AsyncEvent.setScheduler(function(callback) {
+    // Replace the default setImmediate() call by a setTimeout(, 0) call
+    setTimeout(callback, 0);
+});
+
 // Create app module and set dependencies
 angular.module('3ema', [
     // Angular