Skip to content

Widgets, any solution other than one given does not work #14

Description

@chrisb1510

Hi I've tried this solution for a while now and get no success unless I use the given solution, the method setName is always undefined, while code.js is MIME-Type text/plain.

Here is one of many solutions I tried
//Coffeescript
domify = require 'domify'

Widget = () ->
if (!(@ instanceof Widget))
return new Widget()
@element = domify('

Hello !
')

Widget::setName = (name) ->
@element.querySelector('.name').textContent = name

Widget::appendTo = (target) ->
target.appendChild(@element)
module.exports = Widget

I've tried compiling with and without a function wrapper and run it from the .js file
Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions