From 642a68c2a1395966d2bd9b0ee3b27b6c8c5a7f5a Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 19 Jun 2017 21:44:32 +0200 Subject: [PATCH] Add browser support (#1) * add browser test target * add browser-manual target --- example.js | 2 ++ package.json | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/example.js b/example.js index bbcdc9c..a542a45 100644 --- a/example.js +++ b/example.js @@ -18,3 +18,5 @@ var plainText = new Buffer(cipher.length - sodium.crypto_secretbox_MACBYTES) sodium.crypto_secretbox_open_easy(plainText, cipher, nonce, key) console.log('Plaintext:', plainText.toString()) + +if (typeof window !== 'undefined') window.close() diff --git a/package.json b/package.json index 125dda8..6595b81 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,13 @@ "siphash24": "^1.0.1" }, "devDependencies": { + "browser-run": "^4.0.2", + "browserify": "^14.1.0", "sodium-test": "^0.4.0" }, "scripts": { + "browser": "browserify example.js | browser-run", + "browser-manual": "browserify example.js | browser-run -p 1234", "test": " node test.js" }, "browserify": {