
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
hash-trigger
Advanced tools
The URL Hash Trigger library
This project has been created by Vessel CLI. For a simple and quick reference about it, click here.
window.location.hash ์ฒ๋ฆฌ๋ฅผ ์ํ ์ฌํ ํจํค์ง.
ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉ ํ ํ๋ก์ ํธ์์๋ ์๋์ ๊ฐ์ด ์์กด์ฑ ๋ชจ๋๋ก ์ค์นํ๋ค.
$ npm install --save hash-trigger
or
$ yarn add hash-trigger
๋ณธ ํจํค์ง์๋ ์๋์ ๊ฐ์ ๋ชจ๋๋ค์ ํฌํจํ๋ค.
์ ๊ณต๋๋ ๋ชจ๋๊ณผ ๋ฉ์๋ ์ฌ์ฉ๋ฒ ๋ฑ์ ์ฝ๋ ์ค๋ํ์ ์ฐธ๊ณ ํ๋ค.
HashTrigger ๋ชจ๋์ ๋ค์๊ณผ ๊ฐ์ ๋ฉ์๋๋ค์ ์ ๊ณตํ๋ค.
HashTrigger.hashTrigger
์ด๊ธฐํ ์คํ ๋ฉ์๋.
HashTrigger.hashTrigger(option: HashUrlOption);
์ต์ ์ ์๋์ ๊ฐ๋ค.
type HashUrlOption = {
test?: RegExp; // hash URL ๋ด์์ ํ์ํ ๊ฐ๋ง ์ถ์ถ๋ฐ์๋ ์ฌ์ฉ
once? (matched: Matched): void; // hashTrigger ๋ฉ์๋ ์คํ ์ฆ์ ์ฝ๋ฐฑ
onLoaded? (matched: Matched): void; // window.onload ์ ์ฝ๋ฐฑ
onChanged (matched: Matched, event: HashChangeEvent): void; // hash URL ๋ณ๊ฒฝ์๋ง๋ค ์ฝ๋ฐฑ
};
์๋์ ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ฌ์ฉํ๋ค.
import { hashTrigger, Matched } from 'hash-trigger';
// ...
window.location.href = '/sample#test1234';
hashTrigger({
test: /test(\d+)/,
once: (matched: Matched) => {
console.log('Results for immediate:', matched[0]); // 1234
},
onLoaded: (matched: Matched) => {
console.log('Results for window.onload:', matched[0]); // 1234
},
onChanged: (matched: Matched) => {
console.log('Changed window.location.hash:', matched[0]); // 5678
},
});
// ...
window.location.href = '/sample#test5678';
ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ฐ๋ฐํ๊ฒฝ๊ณผ ๋น๋/๋ฐฐํฌ ์งํ ๋ฑ์ ์ํ ์ค์ ์ผ๋ก ์๋์ ๊ฐ์ด ์ ์ญ CLI ๋ชจ๋์ ์ค์นํ๋ค.
$ npm install -g @mornya/vessel @lintest/cli sonarqube-scanner
or
$ yarn global add @mornya/vessel @lintest/cli sonarqube-scanner
package.json
์ ์ ์๋ script ํญ๋ชฉ์ ๋ํ ๋ด์ฉ์ ์๋์ ๊ฐ๋ค.
clean
๋น๋ ๋๋ ํ ๋ฆฌ ์ญ์ .
$ npm run clean
build
์ปดํ์ผ๋ฌ๋ฅผ ํตํด ์์ค์ฝ๋๋ฅผ ๋น๋ ํ ๋๋ ํ ํ์ฌ
dist
๋๋ ํ ๋ฆฌ์ ์ถ๋ ฅํ๋ค.
$ npm run build
$ npm run build --esm # ESM ๋น๋ ํฌํจ
watch
์ปดํ์ผ๋ฌ์ watch ๋ชจ๋๋ก ์์ค์ฝ๋ ๋ณ๊ฒฝ์ ๊ฐ์ํ์ฌ ์ปดํ์ผ ํ๋ค.
$ npm run watch
check
ํ์ ์คํฌ๋ฆฝํธ ์ฝ๋ ๊ฒ์ฆ์ ์ํด ์ปดํ์ผ๋ฌ๋ฅผ ์คํํ๋ค.
lint-stage
๋ฑ์์ ํ์์ ์ฌ์ฉํ๋ค.
$ npm run check
lint
Lintest CLI๋ฅผ ์คํํ์ฌ ์ฝ๋ ๋ฆฐํธ ์คํ.
$ npm run lint
lint:fix
Lintest CLI๋ฅผ ์คํํ์ฌ ์ฝ๋ ๋ฆฐํธ ์คํ ๋ฐ ์๋ ๊ต์ ํ๋ค.
$ npm run lint:fix
test
Lintest CLI๋ฅผ ์คํํ์ฌ ํ ์คํธ๋ฅผ ์ํํ๋ค.
$ npm run test
test:watch
Lintest CLI๋ฅผ ์คํํ์ฌ watch mode๋ก ํ ์คํธ๋ฅผ ์ํํ๋ค.
$ npm run test:watch
test:coverage
Lintest CLI๋ฅผ ์คํํ์ฌ ํ ์คํธ ์ปค๋ฒ๋ฆฌ์ง ๋ฐ์ดํฐ๋ฅผ ์์งํ์ฌ
/coverage
๋๋ ํ ๋ฆฌ์ ์ถ๋ ฅํ๋ค.
$ npm run test:coverage
login
NPM ๋ ์ง์คํธ๋ฆฌ๋ก์ ํผ๋ธ๋ฆฌ์๋ฅผ ์ํ ๋ก๊ทธ์ธ ์ฒ๋ฆฌ.
npm login
์ scope๋ฅผ ์ ์ธํ์ฌ ์ฒ๋ฆฌํ๋ ๋ฐฉ์๊ณผ ๊ฐ๋ค.
๋ ์ง์คํธ๋ฆฌ ๊ฒฝ๋ก๋package.json
์ publishConfig ํญ๋ชฉ ๊ฐ์ด ์ฐธ์กฐ ๋๋ค.
$ npm run login (not "npm login")
publish
ํผ๋ธ๋ฆฌ์ ์ํ ์ ๋ก๊ทธ์ธ / ๋น๋ / ๋ฒ์ ์ฒดํฌ ๋ฑ์ ๋จผ์ ์คํ ํ ์ ์์๋ฃ์ ํผ๋ธ๋ฆฌ์๊ฐ ์ํ ๋๋ค.
$ npm publish
sonar
์๋ํ๋ธ๋ฅผ ์ด์ฉํ ์ ์ ๋ถ์์ด ํ์ํ๋ฉด sonarqube-scanner
๋ฅผ ๊ธ๋ก๋ฒ ์ค์น ํ ์๋ ๋ช
๋ น์ ์คํํ๋ฉด ๋๋ค. ์งํ ํ์ธ์ sonar-project.properties
ํ์ผ ๋ด ์ ์ ๋ URL ๋ฐ projectKey๋ฅผ ์ฐธ์กฐํ๋ค.
$ npm run sonar
ํ๋ก์ ํธ ๋ณ๊ฒฝ์ฌํญ์ CHANGELOG.md ํ์ผ ์ฐธ์กฐ.
ํ๋ก์ ํธ ๋ผ์ด์ผ์ค๋ LICENSE ํ์ผ ์ฐธ์กฐ.
FAQs
The URL Hash Trigger library
The npm package hash-trigger receives a total of 9 weekly downloads. As such, hash-trigger popularity was classified as not popular.
We found that hash-trigger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.