num-client
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "num-client", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A NUM Protocol Client in TypeScript", | ||
@@ -23,2 +23,3 @@ "types": "index.d.ts", | ||
"@types/node": "^14.0.13", | ||
"browserify": "^17.0.0", | ||
"chai": "^4.2.0", | ||
@@ -44,3 +45,4 @@ "mocha": "^8.1.3", | ||
"prepare": "npm test", | ||
"publish": "git push && git push --tags --force" | ||
"publish": "git push && git push --tags --force", | ||
"browserify": "mkdir -p web && browserify -r ./index.js:num-client >web/${npm_package_name}-${npm_package_version}.js" | ||
}, | ||
@@ -57,4 +59,5 @@ "author": "NUM Technology Ltd", | ||
"index.d.ts", | ||
"index.js" | ||
"index.js", | ||
"web/*" | ||
] | ||
} | ||
} |
@@ -207,1 +207,44 @@ # NUM Client | ||
``` | ||
# HTML and JavaScript Example | ||
## The Simplest Usage | ||
This simple example can be modified as necessary by following the previous examples above. | ||
```html | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>NUM Protocol Example</title> | ||
</head> | ||
<body> | ||
<script src="../web/num-client-0.0.5.js"></script> | ||
<h1>num.uk:1</h1> | ||
<pre id='num'></pre> | ||
</body> | ||
<script> | ||
window.addEventListener('load', function () { | ||
const num = require('num-client'); | ||
function lookup(uri) { | ||
const numUri = num.parseNumUri(uri); | ||
const client = num.createClient(); | ||
const ctx = client.createContext(numUri); | ||
return client.retrieveNumRecord(ctx); | ||
} | ||
lookup('num.uk:1').then((result) => { | ||
const pretty = JSON.stringify(JSON.parse(result), null, 4); | ||
document.getElementById('num').innerHTML = pretty; | ||
}); | ||
}); | ||
</script> | ||
</html> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1402761
53
39421
249
11
1