Questions tagged [stampit.js]

A prototype-based JavaScript object composition library

Stampit is a prototype-based JavaScript object composition library that was originally created as an example for the book Programming JavaScript Applications by Eric Elliot.

Resources

Related Tags

10 questions
3
votes
4 answers

How to define private variables with behavior delegation (OLOO) in JS?

I'm trying to wrap my mind around Object Linking Other Objects to write a Node module. This is what I have so far (inspired by this answer): 'use strict' // Composable prototype object var parent = { publicVar: 1, doSomething() { return…
nachocab
  • 13,328
  • 21
  • 91
  • 149
2
votes
1 answer

Interfaces with stampit 2

As mentioned in the interface section of 'Programming javascript applications' you can implement interfaces with stampit. When reducing the unnecessary stuff from the example, I end up with something like this: const fooBarInterface = …
Marc Dix
  • 1,864
  • 15
  • 29
2
votes
2 answers

"Unexpected reserved word” -- import in stampit.js

I am working my way through Eric Elliott’s book Programming JavaScript Applications. In it he uses stampit.js (https://github.com/stampit-org/stampit). I downloaded stampit.js and tried to use it with the book's examples, but I’m getting nowhere.…
Thad
  • 898
  • 13
  • 24
1
vote
0 answers

How to automatically create TypeScript or Flow definitions for Stampit objects?

The Stampit javascript library is awesome for composing JS object factories using behavior prototypes (see https://github.com/stampit-org/stampit). But after creating objects from a stamp that may have been exported from a module, the intellisense…
1
vote
0 answers

Object Factory Node Module with nested Objects using Generators

I'm writing a object Factory Node module in ES6. I'm using the stamptit library https://github.com/stampit-org/stampit to get base objects started but enhance them and return my own objects through my factory. Lets say I have these two files in…
1
vote
1 answer

stampit.js `state` objects not instance-safe

Hello fellow JavaScripters. I have recently started to mess around with the stampit.js library as a way of studying different inheritance methods in JavaScript. My question is in regards to my state objects (there are two in my example), each state…
Ichigo Kurosaki
  • 317
  • 2
  • 12
0
votes
1 answer

Stampit - TypeError: is not a function

autor.js: var stampit = require('./stampit'); var Autor = function () { var objetoAutor = stampit(); var Clase = function() { var nombreCompleto =''; var fechaNacimiento =''; var nacionalidad =''; …
Javier
  • 39
  • 3
0
votes
1 answer

stampit.js beginner needs some guidance

I'm implementing service between a view and a Rest API. Beside, i'm completly new to stamp programming and i'm in search of some advices about this sort of code: import {compose, methods} from '@stamp/it' import ArgOverProp from…
Sté
  • 195
  • 11
0
votes
1 answer

Get new version (v2) of stampit from bower

I want to get the v2 version of stampit just by typing the 'bower install'. I also set in bower config like this "stampit": "git://github.com/ericelliott/stampit#v2_0" and it seems that it did not created a compiled / dist for this new script.…
dumb myy
  • 1
  • 1
0
votes
2 answers

Enclosed functions variable

I started to read the source code for stampit js yesterday, and found an interesting way of enclose function variables in an object by calling apply() instance = fn.apply(instance, arguments) || instance; How does this really work? And why does the…