Skip to content

Instantly share code, notes, and snippets.

@akfish
Created June 24, 2014 06:59
Show Gist options
  • Save akfish/c5d850189049d85ea28e to your computer and use it in GitHub Desktop.
Save akfish/c5d850189049d85ea28e to your computer and use it in GitHub Desktop.
Shared object in sea.js
define (require, exports, module) ->
# Get shared object container
shared = require './shared'
# Get things out
# As long as this code is run after producer, everything will be there
console.assert shared.flag?
console.assert shared.flag
console.assert shared.doggy == 'wow'
define (require, exports, module) ->
# Get shared object container
shared = require './shared'
# Put things in
shared.flag = true
shared.doggy = 'wow'
define (require, exports, module) ->
# Exports an object as a container
exports = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment