Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020년 3월.
WebAssembly.Global 객체는 전역 변수 인스턴스를 나타내며 JavaScript 및 하나 이상의 WebAssembly.Module 인스턴스에서 가져오거나 내보낼 수 있습니다. 이렇게 하면 여러 모듈을 동적으로 연결할 수 있습니다.
새로운 Global 객체를 생성합니다.
모든 Global 인스턴스는 Global() 생성자의 프로토타입 객체에서 상속합니다. 모든 Global 인스턴스에 영향을 미치도록 수정할 수 있습니다.
이 객체의 인스턴스를 생성한 함수를 반환합니다. 기본적으로 이것은 WebAssembly.Global() 생성자입니다.
Global.prototype[@@toStringTag]@@toStringTag 프로퍼티의 초기값은 문자열 값 "WebAssembly.Global" 입니다.
Global.prototype.value전역 변수 내부에 포함된 값 - 전역 값을 직접 설정하고 가져오는 데 사용할 수 있습니다.
전역 변수 내부에 포함된 값을 반환하는 구식 메소드입니다.
다음 예제에서는 WebAssembly.Global() 생성자를 사용하여 만드는 새 전역 인스턴스를 보여줍니다. 값이 0 인 변경 가능한 i32 유형으로 정의됩니다.
먼저 Global.value 속성을 사용하여 '42'로 전역 값이 변경되고, global.wasm 모듈에서 내보낸 incGlobal() 함수를 사용하여 43으로 변경됩니다. (이 함수는 주어진 값에 1을 더한 다음 새 값을 반환합니다).
Note: GitHub에서 실행 중인 예제(running live on GitHub)를 볼 수 있습니다. source code도 참조하십시오.
| WebAssembly JavaScript Interface # globals |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 6월 27일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.