Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-view-import

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-view-import

Import dependencies in CanJS views

  • 3.0.0-pre.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.1K
decreased by-29.14%
Maintainers
3
Weekly downloads
 
Created
Source

can-view-import

Build Status

Import dependencies in Stache views.

  • can-view-import function

API

can-view-import function

<can-import from="MODULE_NAME" />

Statically import a module from with a [can-stache] template. MODULE_NAME will be imported before the template renders.

<can-import from="components/tabs" />
<tabs-widget />
  1. MODULE_NAME {moduleName}: A module that this template depends on.

<can-import from="MODULE_NAME">content</can-import>

Dynamically import a module. MODULE_NAME will be imported dynamically; the scope within the template is a Promise.

<can-import from="components/tabs">
	{{#if isResolved}}
		<tabs-widget />
	{{/if}}
</can-import>
  1. MODULE_NAME {moduleName}: A module that this template depends on.
from="MODULE_NAME"

Passes MODULE_NAME to [can-util/js/import/import] and sets the 's viewModel to be the returned Promise.

<can-import from="bootstrap/bootstrap.css" />
  1. MODULE_NAME {String}: The name of the module to import.
can-tag="TAG_NAME"

Instantiates the provided [can-view-callbacks.tag] and sets its [can-component::viewModel viewModel] to be the Promise for the import.

  1. TAG_NAME {String}: The tag name (usually a [can-component]) to use.
{^value}="*NAME"

Sets up a [can-stache-bindings.toParent] binding to *NAME in the references scope.

  1. NAME {String}: The variable name to assign to the references scope. This can be any string name you want to use, but must be preceded by * or it will be placed on the template's View Model.
<can-import from="app/person" {^value}="*person" />
	
<section>
	hello {{*person.name}}
</section>

Contributing

Making a Build

To make a build of the distributables into dist/ in the cloned repository run

npm install
node build

Running the tests

Tests can run in the browser by opening a webserver and visiting the test.html page. Automated tests that run the tests from the command line in Firefox can be run with

npm test

FAQs

Package last updated on 13 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc