Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Files

Latest commit

11c7051 · May 14, 2013

History

History
48 lines (33 loc) · 1.27 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.27 KB

Tin Foil

Thin Tin Can wrapper for statement generation

Getting Started

Install the module with: npm install tin-foil

Usage

Define your verbs, objects and contexts by extending Verb, TinFoil and Context:

CoffeeScript

{ Activity } = require 'tin-foil'

class SceneActivity extends Activity
  @inherit()

  @identify_from (event) -> "http://skilitix.com/xapi/activities/scene/#{event.scene.id}"

  @definition_named 'en-US': 'Scene'
  @definition_typed_as 'http://skilitix.com/xapi/activities/node'
  @definition_description_from (event) -> 'en-US': event.scene.title

JavaScript

Activity = require('tin-foil').Activity;

var SceneActivity = Activity.extend()
    .identify_from(function (event) { return "http://skilitix.com/xapi/activities/scene/" + event.scene.id; })
    .definition_named({'en-US': 'Scene'})
    .definition_typed_as('http://skilitix.com/xapi/activities/node')
    .definition_description_from(function (event) { return {'en-US': event.scene.title}; });

Then define and compile your statements

SceneEnteredStatement = Statement.as 'user', i: 'entered', a: 'scene', in: 'scenario'
SceneEnteredStatement.compile(myEvent)

License

Copyright (c) 2013 Skilitix Licensed under the MIT license.